I can't seem, to add a custom property using the Add3() function if the type is number and the number has a decimal in it. The following code works if the number is "123" but does not work if the number is "123.456". As a work around, it does seem to work if I add it as an integer "0" and then use the set2() function to modify it.
Dim swModel As ModelDoc2
Dim cusPropMgr As CustomPropertyManager
Dim ModelExt As ModelDocExtension
Dim lRetVal As Integer
Public Sub main()
swModel = swApp.ActiveDoc
ModelExt = swModel.Extension
cusPropMgr = ModelExt.CustomPropertyManager("") '
' This fails with swCustomInfoAddResult_GenericFail
lRetVal = cusPropMgr.Add3("ANUMBER", swCustomInfoType_e.swCustomInfoNumber, "123.456", swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd)
' This seems to work if I use "0" as the value above first
' lRetVal = cusPropMgr.Set2("ANUMBER", "123.100000")
End Sub
Am I doing something wrong here?
SolidworksApi macros