×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Reading 'evaluated value' from custom properties

Reading 'evaluated value' from custom properties

Reading 'evaluated value' from custom properties

(OP)
I am trying to read the Evaluated Value from my property table but I keep getting text expression.  eg. "sw-Material@part.sldprt" rather than Stainless steel.  

RE: Reading 'evaluated value' from custom properties

Do you use CustomPropertyManager::Get3 method?

The fourth out parameter of this method "ResolvedValOut" should return evaluated value.
 

Artem Taturevich
CSWP

RE: Reading 'evaluated value' from custom properties

(OP)
After a quick search it looks like I've become obsolete.  I'm using ModelDoc2.CustomInfo2, so I need to update to the CustomPropertyManager method.

I've not used this before so if anyone has a few lines of sample code that would be nice.

RE: Reading 'evaluated value' from custom properties

Please take a look at the following macro:

evalValOut is the evaluated value.

Note this macro gets the general custom property named "TestField". To get configuration specific custom property specify the configuration name while retrieving the pointer to Custom Property Manager (Set swCustPropMgr = swModel.Extension.CustomPropertyManager("ConfName"))

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swCustPropMgr As SldWorks.CustomPropertyManager

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")

Dim valOut As String
Dim evalValOut As String
swCustPropMgr.Get3 "TestField", False, valOut, evalValOut

End Sub

Artem Taturevich
CSWP

RE: Reading 'evaluated value' from custom properties

(OP)
Thanks ArtemTat

I couldn't get your code to work. I Adjusted it to this:

swCustPropMgr.Get2 "Material", valOut, evalValOut

...and it worked for me  

Is the get3 something special? My autocomplete in the compiler doesn't offer it.

RE: Reading 'evaluated value' from custom properties

This method is available starting from SolidWorks 2008 SP4.

Do you have an earlier version of SolidWorks?

Artem Taturevich
CSWP

RE: Reading 'evaluated value' from custom properties

(OP)
2007 SP5 here so that explains it.

 

RE: Reading 'evaluated value' from custom properties

It's ok to use CustomPropertyManager::Get2. It will work as expected as well.

Artem Taturevich
CSWP

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources