4 Replies Latest reply on Dec 13, 2012 8:48 AM by Cloud Strife Pom Cloud Strife Pom

    Get selection point in sketch segment

    Cloud Strife Pom Cloud Strife Pom

      I want to get the XYZ coordinate point in sketch segment (a 3DSketch Line)
      but when i'm using GetSelectionPoint() it will always return the start point in the sketch segment (no matter part of the line, except end point)

      how can I solve this problem?


      and another question is


      I want to use CreateBodyFromCyl() while I draw a 3DSketch Line.


      it will display cylinder body with direction and distance snap with the line (after draw start point (first time)) and delete the cylinder after finish drawing a line (work as a preview).


      can anyone give me an idea?


      thanks you.



        • Re: Get selection point in sketch segment
          Artem Taturevych

          I have used the following example:


          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swSelMgr As SldWorks.SelectionMgr


          Sub main()


              Set swApp = Application.SldWorks


              Set swModel = swApp.ActiveDoc


              Set swSelMgr = swModel.SelectionManager


              Dim vSelPt As Variant

              vSelPt = swSelMgr.GetSelectionPoint2(1, -1)


          End Sub




          3D Sketch is opened

          Sketch line is selected as first object


          I have correct result and the vSelPt array contains the coordinates of selection (pick point) but not end points.


          Second question.


          You have chosen the correct method. This method will create a temporary body for you. Use Body2::Display3 to display/preview this body and just set the pointer to null to remove the preview because the temporary bodies are living until the pointer is not destroyed.




          Artem Taturevych

          Application Engineer at Intercad


          Tel: +61 2 9454 4444