4 Replies Latest reply on Feb 25, 2014 1:53 PM by Krishna Regmi

    Creating Concentric Relation using API Between a sketch point and edge of two different components

    Krishna Regmi

      Hi,

      I have two componenets in a assembly. I want to add concentric relation between a sketch point in body 1(Component 1) and a edge in body 2(component 2). Here is the code.

       

      isSketchSelected = eachpoint.Select4(False, selMgr.CreateSelectData) 'Select the Point from component 1. 

      swModDoc.EditSketch 'Makes the sketch active. We cannot add relations without having a active sketch.

                          

      isSketchSelected = locEdge.Select4(True, selMgr.CreateSelectData)'locedge is a safe entity. It selects the edge. Edge belongs to component 2

      swApp.RunCommand swCommands_e.swCommands_Add_Constraint_Concent, "title"

       

      When I run these lines of code, First the point is selected properly. Then the sketch enters in the edit sketch mode. This results in the second component to be (inactive?) grayed out..

       

      Next, When I run the command to select the locEdge, It returns False. Meaning, the edge is not selected, even if it is a safe entity, and the pointer is valid.

      This results in the command - add_constraint_concent to not run.

       

      Has any one run into this problem before? ANy suggestions as to how to work around this problem?

       

      Any help will be appreciated.

       

      -KR