Message 1 of 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello I am having some trouble rotating a body around the part axis. I have two bodies in my rootComp and I want to rotate the second body. I have tryed for a few hours now and I am unable to get this to work. Does anybody know what I am missing: Here is the code:
// Create a collection of entities for move
Ptr<BRepBodies> brepBodies = rootComp->bRepBodies();
if (!brepBodies)
return false;
Ptr<BRepBody> brepBody = brepBodies->item(1);
if (!brepBody)
return false;
Ptr<ObjectCollection> entities1 = adsk::core::ObjectCollection::create();
if (!entities1)
return false;
entities1->add(brepBody);
// Create a transform to do move
Ptr<Matrix3D> transform = adsk::core::Matrix3D::create();
// Convert deg -> radians
double angle1 = (90 * M_PI / 180.0);
transform->setToRotation(angle1, rootComp->xConstructionAxis()->geometry(), rootComp->originConstructionPoint()->geometry());
// Create a move feature
Ptr<MoveFeatures> moveFeats = features->moveFeatures();
if (!moveFeats)
return false;
Ptr<MoveFeatureInput> moveFeatureInput = moveFeats->createInput(entities1, transform);
if (!moveFeatureInput)
return false;
Ptr<MoveFeature> moveFeature = moveFeats->add(moveFeatureInput);
if (!moveFeature)
return false;
Solved! Go to Solution.