Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Featurescript - Evaluate centre of circle
Hugh_Goodbody
Member Posts: 40 PRO
I am embarking on my first custom feature creation! I have run into an issue someone might be able to shed some light on.
I have selected the edge of a circle and would like to get the centre point to place a hole on. I have the below code to evaluate the selected circle:
var circleCentre = evCurveDefinition(context, { "edge" : definition.startVertex });
println(circleCentre);var myVar = circleCentre is map;
println(myVar);
println(circleCentre.radius);
println(circleCentre.center);
The first two println ststements give the expected results:
println(myVar) = radius 0.024999999999999994 meter
center (-0.10832993533461188 meter, -0.025 meter, 0.08940204711347347 meter)
println(circleCentre.radius) = 0.024999999999999994 meter
However, the last statement returns undefined, but I was expecting the coordinates.
println(circleCentre.center) = undefined
Tagged:
1
Comments
evCurveDefinition(context, { "edge" : definition.startVertex })<strong>.coordSystem</strong>
to get the coordinate system of the circle. You can useevCurveDefinition(context, { "edge" : definition.startVertex })<strong>.coordSystem.origin</strong>
to get the center of the circleIR for AS/NZS 1100