Solidworks, macro that points to a property

Hello

In solidworks, I got a macro to control the scale of a view in the drawing.

Only the macro points to a value (here *2) and I would like it to point to a property of the document (varaiable)

If anyone has the trick?

Thank you!

1 Like

Hello

What is the name of the variable?

Hello.PL

For my variable it's SCALE

A property created and controlled in an excel part family $PROPRIETE@ECHELLE

 Can you put your macro in a text file please?

You will need to use this instruction:

SCALE = swRefDoc.GetCustomInfoValue("", "SCALE")

Before the amended line:

swView.scaledecimal = SCALE

swRefDoc is your 3D document in your view (see if you called it the same by searching for swView.ReferencedDocument)

2 Likes

Here's the macro,

If you can improve it for me with your education:)

Because I entered it before the line (as shown)

But I have an error message on this same statement: "Object required"

Probably related to the swRefDoc but I don't see too much...


echelle.txt

Try this.


echelle_v2.txt
1 Like

Perfect!

Thank you very much!

1 Like

The macro only handles integer values... problematic to make 1:2 scales.

In addition, the macro will point to the scale property in the part file property (normal) but in the customize tab.

I'd like to be able to point it to a text type and not a number to connect to my SCALE property. thus

Maybe modify at the macro level?

 swView.ScaleText (does not work)

If we can point to Configuration Specific and not to Customize , it's a win:)

There will always be the question of integers

That's 2 more questions! :-p

Ask a new question on the forum as this one is on sale!

1 Like