@ OBI WAN
Yes, with the measurement tool I can visually retrieve the lengths, distances, coordinates I want on the screen. But I want to do some calculations behind it to distribute points on the trajectory evenly and all this automatically. So I need the vba/vbnet functions to do it
@ .PL
I solved the problem with the functions found in the solidworks API help (first link I gave for the vbnet and the one you indicated for the vba). To be able to measure the entities I had to get out of the sketch with the command:
swDoc.SketchManager.Insert3DSketch(True)
For the rest I selected the right entity and used the functions/commands found in the API help:
Example for the measurement of a line, spline and then the two entities:
' Measure line length
boolstatus = swDoc.Extension.SelectByID2("Line1@Esquisse3D1", "EXTSKETCHSEGMENT", 0.0, 0.0, 0.0, False, 0, Nothing, 0)
swMeasure = swDoc.Extension.CreateMeasure
swMeasure.ArcOption = 0
boolstatus = swMeasure.Calculate(Nothing)
Ll = swMeasure.Length
Debug.Print("line length=" & ll * 1000 & " mm")
swDoc.SketchManager.Insert3DSketch(True)
swDoc.ClearSelection2(True)
' Measurement length spline 1
boolstatus = swDoc.Extension.SelectByID2("Spline1@Esquisse3D1", "EXTSKETCHSEGMENT", 0.0, 0.0, 0.0, False, 0, Nothing, 0)
swMeasure = swDoc.Extension.CreateMeasure
swMeasure.ArcOption = 0
boolstatus = swMeasure.Calculate(Nothing)
LS1 = swMeasure.ArcLength
Debug.Print("spline length1=" & LS1 * 1000 & " mm")
swDoc.SketchManager.Insert3DSketch(True)
swDoc.ClearSelection2(True)
• Measurement of the total length of the neutral mesh fiber
boolstatus = swDoc.Extension.SelectByID2("Line1@Esquisse3D1", "EXTSKETCHSEGMENT", 0.0, 0.0, 0.0, False, 0, Nothing, 0)
boolstatus = swDoc.Extension.SelectByID2("Spline1@Esquisse3D1", "EXTSKETCHSEGMENT", 0.0, 0.0, 0.0, True, 0, Nothing, 0)
swMeasure = swDoc.Extension.CreateMeasure
swMeasure.ArcOption = 0
boolstatus = swMeasure.Calculate(Nothing)
Lt = swMeasure.TotalLength
Debug.Print("Length Lt=" & Lt * 1000 & " mm")
Thank you for your help