can we set a global macro from another macros reported value.


Renerabbitt
 Share

Recommended Posts

Lets say I have a macro that reports line weight for instance. can I have a global macro such that $p(n) where n equals the line weight that is being reported?
I tried a bunch of different ways but just failed repeatedly. 
Alternatively can we have a owner macro store that value  such that example=$p(n)?
An example use case..inputting a line weight on an object to set the global variable for that object...as a for instance

Link to comment
Share on other sites

Rene,

 

$Global variables can be assigned values from an object - but they are not attached to the object.

OTOH, you can assign any value (including a $Global) to any field in an object's OIP.  Just be aware that if the $Global"s value is change then that OIP field will also change.

 

I have some macros that rely on the current view Layerset name.  Unfortunately that is assigned to the object when it's created so it's not going to be available for the object.  My solution is to place an invisible text in each view with a macro to assign the Layerset name to a $Global.  That $Global will always be the name of the current view Layerset as long as the Layerset of the view isn't changed.

 

I had requested years ago that Chief add a $Global for the current Layerset but they simply added the NVP for each objects layerset. 

 

To store a value in an object use an OIP field.  

To assign a value to a $Global use an objects NVP or any other value you want.

 

BTW, a $Global can be an array if you want to store a lot of different values.  $p[n] where n is specific to the object.

A Hash could also be used, depending on how you want to be able to identify the values for retrieval.

 

  • Upvote 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share