We're running SW2020 SP3, Vault 2020.. Recently upgraded.
I'm trying to make a macro that solves an issue we have when using weldment gusset features where the gussets don't have the dimensional properties we need to populate our cutlist table on the weldment drawing.
So far, I have a macro that creates the bounding box for the gusset and sets the three properties I need. In the properties I'm using SW-Length, SW-Thickness, and SW-Width which appear to be linked to the bounding box (when manually creating a bounding box, I found that these keywords appeared in the properties). Here is a sample custom property setting snippet:
bRet = swCustPropMgr.Add3("LENGTH", swCustomInfoType_e.swCustomInfoText, """SW-Length""", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
That line gives the cutlist folder a LENGTH property with the value "SW-Length" (including the quotes).
The issue I'm seeing is that I have one part where the quoted keyword evaluates straight to a number, in that case, 3. ie.,
"SW-Length" (EVALUATES TO) 3
but I have another part where that same thing evaluates to a number in quotes, in that case, "8.75" (including quotes) ie.,
"SW-Length" (EVALUATES TO) "8.75"
If I remove the quotes from the former, I just end up with the literal string SW-Length.
Pictures of the Cut-List Properties window for the gusset cutlist folders on the two parts:
Is there some way to predict how this gets evaluated? Do I have to maybe add something to my macro where it tries writing it one way, checks the eval, and writes it the other way if it's wrong? Any ideas to explain this seemingly arbitrary behavior?
Further note, I've tried using Chr(34) and I get the same result.
EDIT: For now, I'm fixing it with the following code that detects if a quotation mark has ended up in the evaluated text and writes it the other way if it has:
bRet = swCustPropMgr.Add3("SIZE", swCustomInfoType_e.swCustomInfoText, Chr(34) & "SW-Thickness" & Chr(34) & " x ""SW-Width""", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
swCustPropMgr.Get2 "SIZE", textexp, evalval
If InStr(1, evalval, Chr(34)) Then
bRet = swCustPropMgr.Add3("SIZE", swCustomInfoType_e.swCustomInfoText, "SW-Thickness x SW-Width", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)