shawn76o
Nuclear
- Nov 14, 2006
- 31
I seem to have found a Solidworks API oddity or bug...
When I use the following code (below) to add a custom property Name "Volume" with a Value of
[ignore]"SW-Mass@P-24-3-6.SLDPRT"[/ignore], it almost works as expected. The value is added correctly, exactly as it should be.
However, when I check the results of the macro by opening the part and looking at the custom properties, the evaluated value is not "evaluated" properly. It is still displayed as [ignore]"SW-Mass@P-24-3-6.SLDPRT"[/ignore]. But if I click the drop-down list and select the "Volume" property, the Evaluated Value changes to an actual number, (0.06) as it should, although the value [ignore]"SW-Mass@P-24-3-6.SLDPRT[/ignore]" doesn't change at all, not one character.
Is this a bug, or am I missing something?
When I use the following code (below) to add a custom property Name "Volume" with a Value of
[ignore]"SW-Mass@P-24-3-6.SLDPRT"[/ignore], it almost works as expected. The value is added correctly, exactly as it should be.
However, when I check the results of the macro by opening the part and looking at the custom properties, the evaluated value is not "evaluated" properly. It is still displayed as [ignore]"SW-Mass@P-24-3-6.SLDPRT"[/ignore]. But if I click the drop-down list and select the "Volume" property, the Evaluated Value changes to an actual number, (0.06) as it should, although the value [ignore]"SW-Mass@P-24-3-6.SLDPRT[/ignore]" doesn't change at all, not one character.
Is this a bug, or am I missing something?
Code:
[green]'Check for missing props and add as needed[/green]
If ThkDef = False Then Part.AddCustomInfo3 "", "Thickness", swCustomInfoText, Chr(34) & "Thickness@" & CStr(ShortName) & Right(swChildComp3.GetPathName, 7) & Chr(34)
If VolDef = False Then Part.AddCustomInfo3 "", "Volume", swCustomInfoText, Chr(34) & "SW-Mass@" & CStr(ShortName) & Right(swChildComp3.GetPathName, 7) & Chr(34)
[/code}
Shawn Oelschlager
Production Control Ass't
Transco Products Inc.
[URL unfurl="true"]http://www.transcoproducts.com[/URL]
SolidWorks Office Premium 2006 - SP4.1
Pentium 4 (2.8 GHz) - 2GB RAM