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.

query point coordinate

pierre_grpierre_gr Member Posts: 12
edited October 2017 in FeatureScript

I have a feature script which creates 2 line and place a point of the intersection, like

        skPoint(gearSketch, "A", {
                "position" : center + vector(1, 0) * (pitchCircleRadius + addendum)
        skConstraint(gearSketch, "A_coincident1", {
                "constraintType" : ConstraintType.COINCIDENT,
                "localFirst" : "A",
                "localSecond" : "axis"
        skConstraint(gearSketch, "A_coincident2", {
                "constraintType" : ConstraintType.COINCIDENT,
                "localFirst" : "A",
                "localSecond" : "pitchCircle"

It works fine but how do I query the new location of the point A, after the constraint are applied, and continue my sketch after that ?

Thank you,


  • lanalana Onshape Employees Posts: 552
    Sketch constraint is not applied when written, rather it is added to constraint system which is solved in function skSolve(). 
    When writing custom feature it is better to work out your sketch geometry instead of using constraints. Are you looking for an intersection point of circle and line?
  • pierre_grpierre_gr Member Posts: 12
    Yes, a line and a circle in that case, so I can do it by calculus, but at the end, what I'm trying to do is to generate the sketch of a spur gear (the existing spur gear feature generate the body) and doing it with constraints is much much easier.

    From your answer, does it means I case do an skSolve and project the point onto a new plane/sketch ?

    if so, how can I evaluate the coordinate of a point from it's pointId ?

    Doc: http://www.gearseds.com/files/Approx_method_draw_involute_tooth_rev2.pdf

  • lanalana Onshape Employees Posts: 552
    After skSolve is called there'll be a vertex corresponding to the sketch point. You can use 

    const pointQ = sketchEntityQuery(sketchId, EntityType.VERTEX, "A") query to identify it, and evVertexPoint(context, {'vertex' : pointQ}) to get its xyz location.

    A warning, though, unless you eliminate more degrees of freedom with additional constraints, you don't know which geometry will change when sketch is solved.

  • pierre_grpierre_gr Member Posts: 12
    Thank you very much.
    It can be marked as solved.
Sign In or Register to comment.