Message 1 of 2
Moving an Occurrence from two known points in C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello I have a script where I am moving an occurrence from one point to another. One point is the center origin of a selected occurrence and the other is a drawn circle that has been previously positioned. The Sketch of the circle is drawn in the rootComp. I am trying to move the occurrence to the center of this circle.
Currently it is moving the component to the World Origin. Can anybody help me see what I am doing wrong.
// Have an occurrence selected.
Ptr<Selection> occSel = ui->selectEntity("Select an occurrence.", "Occurrences");
Ptr<Occurrence> occ = occSel->entity();
//Get Position Of Occurrence
Ptr<Point3D> occPos = occ->transform2()->translation()->asPoint();
//Get Center Point Of Circle
Ptr<Point3D> centerPoint = circle1->centerSketchPoint()->worldGeometry();
Ptr<Matrix3D> trans = adsk::core::Matrix3D::create();
trans->translation() = occPos->vectorTo(centerPoint);
occ->transform2(trans);