eda 发表于 2014-6-27 14:52:48

Move Object 中出现报错

                Session *theSession = Session::GetSession();
                Part *workPart(theSession->Parts()->Work());
                Part *displayPart(theSession->Parts()->Display());

                Features::MoveObject *nullFeatures_MoveObject(NULL);
                Features::MoveObjectBuilder *moveObjectBuilder1;
                moveObjectBuilder1 = workPart->BaseFeatures()->CreateMoveObjectBuilder(nullFeatures_MoveObject);

                NXString angleValueString;
                std::stringstream ssang;
                std::vector<NXOpen::Body*>bodies;
                NXOpen::Body *bodyList;
                std::vector<NXOpen::Curve*>curves;
                NXOpen::Curve *curveList;
                std::vector<NXOpen::Point*>points;
                NXOpen::Point *pointList;

                //Get base point
                BlockStyler::PropertyList *pointProperty = point0->GetProperties();
                Point3d point= pointProperty->GetPoint("Point");
                delete pointProperty;
                pointProperty = NULL;

                //Get revolve Lie value
                BlockStyler::PropertyList *rValue = expression0->GetProperties();
                double rangle = rValue->GetDouble("Value");
                delete rValue;
                rValue = NULL;

                //Get Rod section Objects
                BlockStyler::PropertyList *bodyObjects = selection0->GetProperties();
                vector <NXOpen::TaggedObject*>taggedObjects = bodyObjects->GetTaggedObjectVector("SelectedObjects");
                delete bodyObjects;
                bodyObjects = NULL;

                //convert TaggedObject to body & curve & point
                bodyList = dynamic_cast<NXOpen::Body*>(taggedObjects);
                curveList = dynamic_cast<NXOpen::Curve*>(taggedObjects);
                pointList = dynamic_cast<NXOpen::Point*>(taggedObjects);


                //convert values to string
                ssang<<rangle;
                angleValueString = ssang.str();


                //create motion feature

                Point3d origin1(0.0, 0.0, 0.0);
                Vector3d vector1(-0.0, -1.0, -0.0);
                Direction *direction1;
                direction1 = workPart->Directions()->CreateDirection(origin1, vector1, SmartObject::UpdateOptionWithinModeling);

                Point *nullPoint(NULL);
                Axis *axis1;
                axis1 = workPart->Axes()->CreateAxis(nullPoint, direction1, SmartObject::UpdateOptionWithinModeling);

                Point *point1;
                point1 = workPart->Points()->CreatePoint(point);

                axis1->SetPoint(point1);
                moveObjectBuilder1->TransformMotion()->SetAngularAxis(axis1);
                moveObjectBuilder1->ObjectToMoveObject()->Add(bodyList);
                moveObjectBuilder1->ObjectToMoveObject()->Add(curveList);
                moveObjectBuilder1->ObjectToMoveObject()->Add(pointList);
                moveObjectBuilder1->TransformMotion()->Angle()->SetRightHandSide(angleValueString);
                moveObjectBuilder1->Destroy();

调试没有问题,执行的时候,总是后报错,还请指点一下:
http://www.plmhome.com/forum.php?mod=image&aid=847&size=300x300&key=cb5ea3c0fe9099f6&nocache=yes&type=fixnone



eda 发表于 2014-6-27 16:54:23

NX9中运行没问题,NX8.5中,可预视移动,仍会报错,按完报错确认,又回复原始状态

admin 发表于 2014-6-30 09:59:52

eda 发表于 2014-6-27 08:54
NX9中运行没问题,NX8.5中,可预视移动,仍会报错,按完报错确认,又回复原始状态

没见你commit吧
moveObjectBuilder
页: [1]
查看完整版本: Move Object 中出现报错