I have used the following example:
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Dim vSelPt As Variant
vSelPt = swSelMgr.GetSelectionPoint2(1, -1)
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.
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.
Application Engineer at Intercad
Tel: +61 2 9454 4444
In first question:
3DSketch is close (not in edit mode)
The second question
when draw a line in 3DSketch how can I get coordinate XYZ to display (sketchsegment still attach with pencil icon)
Have you correct result if your model is in Top or Front etc. view orientation or is it allways wrong?
I changed the view but it also return the start point
I think maybe the problem is that when closed 3DSketch line was click solidwork will assumed that you click "line" then the result of using GetSelectionPoint() will return the Line coordinate (** not happen in curve )
have anyone use DMouseEvents_MouseSelectNotifyEventHandler before?
I want XYZ from this event but...
if I click the face or feature it will return exact and correct XYZ point but
when I try on closed 3Dsketch it will return not related to model of XYZ point (wrong point)