AnsweredAssumed Answered

Direct way to add sketch relation in context to other part in assembly using API?

Question asked by Adam Stephens on Feb 12, 2020
Latest reply on Feb 12, 2020 by Rob Edwards

Is there a direct way, or indirect way, to add a sketch in one part in context to a feature in a separate part inside of an assembly to make an external reference?

 

Manual method:

Assembly is open containing Part1 and Part2 -> Edit component, Part2 -> Sketch -> Select face to sketch on Part2 -> Circle -> Sketch circle, either by snapping directly to center of cut feature in Part1  OR  place circle arbitrarily and then drag center point to center of cut feature in Part1 to make Coincident.

Two parts in assembly with one part that has a hole cut thru. Shows existing relations as "Coincident0->" to siginify an external refence.

 

In my code I am able to edit Part2 inside the assembly and insert the sketch, so just having difficulty find the best way to add that coincident relation. I attempted SelectByID2 to select the center point of the sketch that makes the cut in Part1 but that kept returning False.

 

I found this post that makes it appear that this is possible but wasn't really understanding what was done there, plus an edge was being used rather than a center point of a hole:

https://forum.solidworks.com/message/411540?q=Direct%20way%20to%20add%20relation%20in%20context%20to%20other%20part%20in…

Outcomes