Page 1 of 1

If a custom property has associative dimension, how would I get the value and not the dimension name

Posted: Thu Aug 19, 2021 8:48 am
by ResidentAtLarge
I am looking to link basic length and width as a custom property. So, the dimension that determines those two values are linked in the custom property which would look something like this: "Length@Sketch1@Part1" and "Width@Sketch1@Part1".

So, when writing my code it doesn't copy the Evaluated value of the custom property, it copies the "Value/Text Expression".
Is there a way to grab the Evaluated value instead of the text expression in the custom property?

The current code I'm using is :

Code: Select all

swCustProp.Get4("Width", False, val, valout)
I am using this macro to copy data into an excel database that I've created and based on a few custom properties that are concatenated, it returns data back into solidworks. A lot of the solidworks designers here like to link dimensions to their properties to use in their BOM and I'd like to keep it that way.

Re: If a custom property has associative dimension, how would I get the value and not the dimension name

Posted: Thu Aug 19, 2021 9:01 am
by Eddy Alleman
Hi,

the valout schould give you the value
val gives what is filled in and that can be an equation in your case.

from the docs:
Parameters
FieldName
Name of the custom property
UseCached
True if the configuration has been activated, false if not (see Remarks)
ValOut
Value of the custom property
ResolvedValOut
Evaluated value of the custom property

The terminology is a little confusing...

Eddy

Re: If a custom property has associative dimension, how would I get the value and not the dimension name

Posted: Thu Aug 19, 2021 9:21 am
by ResidentAtLarge
I've always been using val in my macro. I just did not realize that valout was giving the evaluated value which I should probably be using from now on.

Thank you for clarifying that for me!

Re: If a custom property has associative dimension, how would I get the value and not the dimension name

Posted: Thu Aug 19, 2021 9:53 am
by Eddy Alleman
you're welcome

We all made that mistake once, but when stepping up we use other "values" than numbers.

Happy coding