Hello guys,
can you please help me with this, I need macro to assign weight and area to the part custom properties. What I have is below,
If swModel.CustomInfo2("", "Weight") = "" Then
retval = swModel.AddCustomInfo3("", "Weight", swCustomInfoText, "=")
End If
If swModel.CustomInfo2("", "Area") = "" Then
retval = swModel.AddCustomInfo3("", "Area", swCustomInfoText, "=")
End If
' weight Is there an easier way to assign : SW-Mass???
Dim Density As Double
swModel.CustomInfo("Weight") = swModel.GetMassProperties(HOWTOGETDENSITY) * 2.20462262
swModel.CustomInfo("Area") = swModel..... Not even sure how to get area "SW-SurfaceArea"
I tried the following as well
Dim nStatus As Long
Dim swModelExt As SldWorks.ModelDocExtension
Set swModelExt = swModel.Extension
VmassProp = swModelExt.GetMassProperties(1, nStatus)
' weight
swModel.CustomInfo("Weight") = VmassProp(5)
' Area
swModel.CustomInfo("Area") = VmassProp(4)
If I do this the numbers doesnt make any sense..
Any help appreciated.
Thank you.
SolidworksApi macros