I am trying to use a macro to measure the perimeter of a face created by a section view in an assembly using Solidworks 2016.
The Measure interface works as expected when measuring a "real" face, but it crashes when measuring a face created by a section view.
Here is example code:
Dim result As Boolean
Dim swMeasure As SldWorks.Measure
Set swMeasure = Application.SldWorks.ActiveDoc.Extension.CreateMeasure
result = swMeasure.Calculate(Nothing)
If result Then
Debug.Print "Perimeter: " & swMeasure.Perimeter
If you run this script while a "real" face is selected, it will print out the Perimeter correctly. If you run this script while a "section" face is selected, it will crash. However, if you open the "Measure" tool using the user interface while the "section" face is selected, it won't crash and will accurately display the Area and Perimeter for that face.
Is this a known issue? Is there any other way to get the perimeter of a section face using a macro?