装配和单个零件混合模式下Composite Curve曲线抽取实现方式
代码分享下,其实场景是这样的,我们要需要抽取一个边的线条,通过composite curve去处理,但是在非装配下,基本上是通过composite curve进行抽取,在装配下,需要通过 wave link composite curve,两个方法场景不同,这就需要进行分别判断。紧紧判断是不是一个occurence还不够,因为在选择边如果零件是工作部件的话,这种情况wave link是无法使用。
if (!selectFaceGroup1.empty()&& !selectFaceGroup2.empty()&& !selectCurveGroup.empty())
{
// we need add more check for the edge selection
for (int i = 0; i < selectCurveGroup.size();i++)
{
//////////////////////////////////////////////////////////////
Edge * selectEdge = dynamic_cast<Edge*>(selectCurveGroup.at(i));
if (selectEdge->IsOccurrence() == false)
{
selectedEdges.push_back(selectEdge);
}
else
{
if (selectEdge->Prototype()->OwningPart() == workPart)
{
selectedEdges.push_back(selectEdge);
}
else
{
selectedEdgesOcc.push_back(selectEdge);
}
}
}
//2 get composite curves
if(!selectedEdgesOcc.empty())
{
errorCode =createWaveEdges(selectedEdgesOcc,compositeWaveCurves);
if (errorCode || compositeWaveCurves == NULL)
{
CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Wave Composite Curvesfailed!");
return 1;
}
vector<NXObject *> allCurves = compositeWaveCurves->GetEntities();
for (int i = 0; i < allCurves.size();i++)
{
sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));
}
}
if (!selectedEdges.empty())
{
errorCode =createCurvesFromEdges(selectedEdges,compositeCurves);
if (errorCode || compositeCurves == NULL)
{
CheckDTS::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeWarning,"Create Composite Curvesfailed!");
return 1;
}
vector<NXObject *> allCurves = compositeCurves->GetEntities();
for (int i = 0; i < allCurves.size();i++)
{
sectionCurves.push_back(dynamic_cast<TaggedObject*>(allCurves.at(i)));
}
}
页:
[1]