Renerabbitt Posted July 7, 2023 Share Posted July 7, 2023 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 More sharing options...
SHCanada2 Posted July 7, 2023 Share Posted July 7, 2023 hmm I'm not understanding the use case. one can assign the line weight of an object to a global variable and then assign that to a macro and then show it: assignment on the left, showing on the right Link to comment Share on other sites More sharing options...
Joe_Carrick Posted July 7, 2023 Share Posted July 7, 2023 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now