Is it possible to change the custom properties of a part within an assembly? In my code below, I have to open the part which I am changing the custom properties, close it, then rebuild my assembly.
I tried thought this might work, but it doesnt.
retval = Part.AddCustomInfo3(EmptyStr, "Height@MASTER-EFEET-PARAMETRIC.SLDPRT", 30, Range("B" + "2"))
SolidworksApi macrosPrivate Sub CommandButton1_Click()
Dim swApp As Object
Dim Part As Object
Dim retval As Boolean
Dim EmptyStr As String
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
swApp.activatedoc2 "MASTER-EFEET-PARAMETRIC.SLDPRT", False, longstatus
Set Part = swApp.ActiveDoc
retval = Part.DeleteCustomInfo("Height")
retval = Part.AddCustomInfo3(EmptyStr, "Height", 30, Range("B" + "2"))
retval = Part.DeleteCustomInfo("CC-DIST")
retval = Part.AddCustomInfo3(EmptyStr, "CC-DIST", 30, Range("B" + "3"))
boolstatus = Part.forcerebuild3(True)
Part.ViewZoomtofit2
swApp.closedoc "MASTER-EFEET-PARAMETRIC.SLDPRT"
Set Part = swApp.ActiveDoc
boolstatus = Part.forcerebuild3(True)
Part.ViewZoomtofit2
End Sub