获取Super Section控件选择的对象,方法比较特殊,收藏学习
获取Super Section控件选择的对象,方法比较特殊,收藏学习
直接使用getoutputcurves是有问题的,这个只是临时的对象,需要通过下面的方法来获取选择的底层对象
vector<TaggedObject*> GetObjectsOfSection(Session* theSession, NXOpen::Section* theSection)
{
vector<TaggedObject*> theSectionObjects;
theSectionObjects.clear();
std::vector<NXOpen::SectionData*> theSectionData;
theSectionData.clear();
NXOpen::ScCollector* scCollector1 = theSession->Parts()->Work()->ScCollectors()->CreateCollector();
theSection->GetSectionData(theSectionData);
for each (SectionData * aSectionData in theSectionData)
{
vector<SelectionIntentRule*> rules;
rules.clear();
aSectionData->GetRules(rules);
scCollector1->ReplaceRules(rules, false);
for each (auto var in scCollector1->GetObjects())
{
theSectionObjects.push_back(var);
}
}
return theSectionObjects;
}
页:
[1]