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.

# How can I find the intersection points from 2 circles in 2 sketches (w scripting)

hervé_pipon
Member Posts:

**60**✭✭
Hello

I want to find the intersection points of 2 circles

I tried :

It prints

How can I get the actual points from this query ?

I want to find the intersection points of 2 circles

I tried :

var i = 1; var j = 2; // sketches Id var test_i = id + ("sketch_" ~ i); var test_j = id + ("sketch_" ~ j); // circles Id var circle_i = "circle_" ~ i; var circle_j = "circle_" ~ j; // circle edges var edges_i = sketchEntityQuery(test_i, EntityType.EDGE, circle_i); var edges_j = sketchEntityQuery(test_j, EntityType.EDGE, circle_j); const curves_i = evaluateQuery(context, edges_i); const curves_j = evaluateQuery(context, edges_j); println(curves_i); println(curves_j); // var intersectionPointsQuery = qIntersection(edges_i, edges_j); for (var intersectionPoints in intersectionPointsQuery ) { println("intersectionPoints = " ~ intersectionPoints); }

It prints

[ { queryType : TRANSIENT , transientId : JMB } ] [ { queryType : TRANSIENT , transientId : JRB } ] intersectionPoints = { "key" : "queryType" , "value" : QueryType : "INTERSECTION" } intersectionPoints = { "key" : "subqueries" , "value" : [ Query : { "entityType" : EntityType : "EDGE" , "historyType" : "CREATION" , "operationId" : Id : [ "FovTflfcvumxF3Q_0" , "sketch_1" ] , "queryType" : "SKETCH_ENTITY" , "sketchEntityId" : "circle_1" } , Query : { "entityType" : EntityType : "EDGE" , "historyType" : "CREATION" , "operationId" : Id : [ "FovTflfcvumxF3Q_0" , "sketch_2" ] , "queryType" : "SKETCH_ENTITY" , "sketchEntityId" : "circle_2" } ] }

How can I get the actual points from this query ?

0

## Comments

395evDistance is the typical way to do this.

60✭✭evDistanceto find the intersection of my two circles,but it works.@_anton Thanks a lot for your help. I would never have found it alone.

29If you'd like an api that finds all curve intersections, please make an improvement request on the forum.

395A query is like a street address - you never know if it's unique, where it is, nor whether the place even exists, until you look it up or go there in person. You can imagine a query like "every address along road X", then taking its set intersection with "every address along road Y" to get the set of houses at the intersection of both roads. But you're still just looking at letters on paper until you find out which houses/restaurants/parking lots/whatever satisfy that query.

60✭✭I rejoiced too quickly: I actually find the point that interests me, but as the circles intersect at 2 points,I don't have the second one.Even if it doesn't interest me, there is an element of chance that is not fine....

I will have a look to

opExtractWiresandopTrimCurve.60✭✭Hi , I didn't find the

opTrimCurveoperation. I saw thetrimToolfunction, is it related ?5,6475,64729