AnsweredAssumed Answered

Macro to show mass in my properties

Question asked by Amanda Armudi on Nov 13, 2018
Latest reply on Nov 14, 2018 by Deepak Gupta

I am trying to write a macro to show the mass of a part in the properties... However as you guys can see in the pic it is not working, because my macro is not getting the right value. I think I need the right path to copy the mass from the solidworks, I don´t really know. If someone could help me, it would be great.. THANK YOUUU

 

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

End Sub

 

Dim MyMassProp As Double

 

retval(35) = swModel.DeleteCustomInfo2(property, "mass")

retval(35) = swModel.AddCustomInfo3(property, "mass", swCustomInfoText, MyMassProp) 2018-11-13_12h05_21.png

Outcomes