AnsweredAssumed Answered

How to get an Evaluated Value instead of Text Expression ?

Question asked by Andre Gallant on Aug 23, 2019
Latest reply on Aug 26, 2019 by Simon Turner

Hey all, I've been trying to create a macro for quite a while now and I can't seem to figure out how to get a Evaluated Value instead of the Value / Text Expression. FYI, I know next to nothing about programming. I've looked up a lot of forums, but I get lost in the codes.

I have a property in custom properties that is linked to a global variable. The global variable is "Process1" which is defined as = IIF ( "Number of Bend" = 0 , 5 , 54 ). I will include an image to clarify.

So far this is what I have for the macro:

Dim swApp As SldWorks.SldWorks

Dim swModel As ModelDoc2

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

'Check and Add/Update Color Property

If Right(swModel.GetTitle, 4) = "YARD" Then

swModel.CustomInfo("Color") = Right(swModel.GetTitle, 7)

Else

swModel.CustomInfo("Color") = Right(swModel.GetTitle, 2)

End If

'Process Property

swModel.CustomInfo("G") = swModel.CustomInfo("ProcessID")

End Sub

 

The macro is 2 parts.

First part checks the name and modifies a custom property.

Second part is supposed to check if the part has a bend. If yes then G=5-4, if no leave blank.

The first part of the macro works fine up until the 'Process Property section.

When I run the macro it sets the custom property "G" = "Process1@AA00-A0-K0-1LBP-BL-YARD.SLDPRT"

Ultimately I would like to be "G" = 54. So is there a way to make swModel.CustomInfo("ProcessID") as the evaluated value instead of ""Process1@AA00-A0-K0-1LBP-BL-YARD.SLDPRT".

Thanks,

Attachments

Outcomes