Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Options

Featurescript - Evaluate centre of circle

Hugh_GoodbodyHugh_Goodbody Member Posts: 39 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




Comments

  • Options
    MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    you can use evCurveDefinition(context, { "edge" : definition.startVertex })<strong>.coordSystem</strong> to get the coordinate system of the circle. You can use evCurveDefinition(context, { "edge" : definition.startVertex })<strong>.coordSystem.origin</strong> to get the center of the circle
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Options
    Hugh_GoodbodyHugh_Goodbody Member Posts: 39 PRO
    Splendid, thanks for the advice. Will give it a go.
Sign In or Register to comment.