AnsweredAssumed Answered

get area of offset surface

Question asked by Eric Bunn on Nov 4, 2015
Latest reply on Nov 4, 2015 by Claudius Claudius

I found this little piece of code in the forum posted by Keith Rice for getting the area of a face.  It works very well.  I want to get the area of an offset surface and the code will not work on the offset surface.  Can anyone tell me how to reconfigure it to do an offset surface?

 

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swSelMgr As SldWorks.SelectionMgr

Dim swFace As SldWorks.Face2

Dim swFaceArea As Double

 

Sub main()

 

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

 

    Set swFace = swSelMgr.GetSelectedObject6(1, -1) 'Gets Selected Face

    swFaceArea = Round(swFace.GetArea * 1550, 3) 'Prints Area of Selected Face

    Debug.Print swFaceArea & " in^2"

   

End Sub

Outcomes