NX二次开发 NXOpen方式遍历所有体 workPart->Bodies()
NX二次开发 NXOpen方式遍历所有体 workPart->Bodies()
VS8.0+VS2010
#include <NXOpen/DisplayManager.hxx>
#include <NXOpen/Body.hxx>
#include <NXOpen/BodyCollection.hxx>
#include <NXOpen/NXException.hxx>
#include <NXOpen/NXObject.hxx>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
std::vector<tag_t> BodyVecotor;
NXOpen::Body *WorkBody;
NXOpen::BodyCollection *Bodys = workPart->Bodies();
NXOpen::BodyCollection::iterator Ite = Bodys->begin();
for (; Ite != Bodys->end(); ++Ite)
{
WorkBody = (*Ite);
BodyVecotor.push_back(WorkBody->Tag());
NXOpen::DisplayModification *displayModification1;
displayModification1 = theSessi