Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I made a script to move a sketched circle tangent between two projected arcs but it is not moving when I run it. Can anybody help me figure out why its not working properly? I have attached some pictures and the file aswell.
Here is my script:
// Prompt the user to select a plane.
Ptr<Selection> selection1 = ui->selectEntity("Select a Face On the Rolls", "Faces");
Ptr<BRepFace> plane1 = selection1->entity();
// Get the selected face and create a sketch on it
Ptr<Sketches> skt = rootComp->sketches();
Ptr<Sketch> skt1 = skt->addWithoutEdges(plane1);
Ptr<SketchCurves> curves = skt1->sketchCurves();
Ptr<SketchCircles> circles = curves->sketchCircles();
// Create a circle with a diameter
Ptr<SketchCircle> circle1 = circles->addByCenterRadius(Point3D::create(0, -30, 0), 20);
if (!circle1)
return false;
Ptr<SketchDimensions> dims = skt1->sketchDimensions();
// Add the dimension to the circle
Ptr<SketchDimension> dim1 = dims->addDiameterDimension(circle1, adsk::core::Point3D::create(0, 0, 0));
if (!dim1)
return false;
// Prompt the user to select a bRepEdge.
Ptr<Selection> selection2 = ui->selectEntity("Select The Round Edge On A Roll", "Edges");
Ptr<BRepEdge> edge1 = selection2->entity();
Ptr<SketchCurve> proj1;
proj1 = skt1->project(edge1);
// Prompt the user to select another bRepEdge.
Ptr<Selection> selection3 = ui->selectEntity("Select The Other Round Edge On A Roll", "Edges");
Ptr<BRepEdge> edge2 = selection3->entity();
Ptr<SketchCurve> proj2;
proj2 = skt1->project(edge2);
Ptr<GeometricConstraints> constraints = skt1->geometricConstraints();
Ptr<GeometricConstraint> tanCon1 = constraints->addTangent(circle1, proj1);
if (!tanCon1)
return false;
Ptr<GeometricConstraint> tanCon2 = constraints->addTangent(circle1, proj2);
if (!tanCon2)
return false;
Solved! Go to Solution.