Renerabbitt

Macro Question-Consolidating macros

Recommended Posts

I have a bunch of simple string macros as well as some integer macros in my template plan. I would love to be able to consolidate them into one macro as global variables. Is this possible? 
Currently I have a jobInfo macro where I type in all of the details of a job such as

$wallInsulation = "R-19 Batt Fill"

$wallFraming = 24 (then a separate macro that translates this to a string)

Etc.

Each of these then has a corresponding macro filling up my macro management.

Things that are visually "busy" tend to be hard for me to process. I would love to limit the number of macros by consolidating. 
Thanks in advance

Share this post


Link to post
Share on other sites

In X12, there is no reason for the corresponding macros.  Simply enter %$wallFraming%  wherever you want to use the variable.

Share this post


Link to post
Share on other sites

So if I understand the request you would have one json file for constants like this:

# my job constants

 

$wallInsulation = "R-19 Batt Fill"

 

$wallFraming = 24

 

and so on

 

And include the macros like this?

    "UserDefinedMacro": {
        "Name": "Railing Exterior",
        "Value": "42\" Guard Rail",
        "ShouldEval": false,
        "Context": "none",
        "RubyAPIVersion": 1
    },

I know I do not have the syntax correct but I have seen all macros in one json file.

 

Perhaps I miss understood the request.

Share this post


Link to post
Share on other sites

It is more about how are you use these macros....

 

I had a similar dilemma and realized it is easy to simple define the spec macros [non-Ruby] and only import from the file system what I need. In a folder I have 4 or 5 different definitions of: A_SPEC_FNDWALL_TALL9 (8" or 10"), only one json with 8" for ex will be imported. You can multi-select and import as many macros as you want at one time. If you have macros that do analysis: once they generated the results (I pasted them into a text) they are no longer needed. Personally I used SPEC macros and couple label (custom labels) and that was it.

 

The minor / short strings can go into keynotes or just a small text

 

Macros.thumb.PNG.0ba367bc5292a0cc927fac0ec8c480a1.PNG

All visible text here generated by %A_SPEC_XXX% macros

 

Share this post


Link to post
Share on other sites

What I believe Rene is talking about is using one single macro to set all sorts of global "Job Information" variables such as 

$My_name = "Michael"

$Wall_framing = 24

$Project_zip_code = "98765"

$Setback = 40.ft

...and so on

 

...and then defining another macro for each and every one of those variables so he can use the values elsewhere...

356941834_pic1.thumb.jpg.d89134acad694c7f5dba5029a7a9d14d.jpg

 

What I was trying to point out is that all those secondary macros are no longer necessary in X12.  You can delete all except the job_info macro and simply place your global variable name directly into a text box, callout, or wherever you want to use it...

pic2.thumb.jpg.bf5dd2b37665e54d229dfa94824766f6.jpg

 

In fact, you don't even need the job_info macro either.  Those global variables can even be defined in a text box.  In X12, I believe I could literally delete all my macros if I wanted to and just use single line code typed directly into text boxes.  Not that I would want to do that, but I could. The only thing I'm really not sure of is how many commands Ruby will allow to be entered in a single line of code.

 

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Alaskan_Son said:

 In X12, I believe I could literally delete all my macros if I wanted to and just use single line code typed directly into text boxes. 

Interesting, could you think of a use case?
I had responded earlier and deleted my response realizing that I was missing the $ sign to call out a global from the jobinfo macro. You summed it up nicely and am in the process of deleting a ton of macros...so THANK YOU!
I still have questions about the measurement/float changes that I may post about if I don't manage to figure it out myself.

Share this post


Link to post
Share on other sites
Just now, Renerabbitt said:

Interesting, could you think of a use case?

 

There are a ton of things I use this behavior for all the time.  It's a lot quicker and easier to create, edit, copy and paste a text box than it is to create, edit, copy, and paste macros for specific purposes and commonly its a lot more convenient to write a quick one-time-use macro in place than it is to create a custom macro for the purpose. 

 

 

Share this post


Link to post
Share on other sites

Just to be clear, using the "job_info" macro with all the global variables, do you need to execute it somehow?

Or just having the macro in the macro list is enough to initialize the values?

 

Share this post


Link to post
Share on other sites
6 minutes ago, ACADuser said:

Just to be clear, using the "job_info" macro with all the global variables, do you need to execute it somehow?

Or just having the macro in the macro list is enough to initialize the values?

 


It needs to be executed.

 

I personally just usually put it somewhere where it’s displayed all the time but not visible (either off screen or set to display an empty string).  

Share this post


Link to post
Share on other sites
9 minutes ago, Alaskan_Son said:


It needs to be executed.

 

I personally just usually put it somewhere where it’s displayed all the time but not visible (either off screen or set to display an empty string).  

I tried $test = "testing this out" in a text box and then placed %$test% in a text box and it did not work, what am I missing?


PS I know it's probably annoying educating someone that doesn't know the basics or even classifications but it is how I learn, single case uses at a time :)

Share this post


Link to post
Share on other sites

Here’s a quick starter kit I set up a little while back for use in X12 that requires no custom macros in TMM whatsoever.  Just copy and paste the following text into your plan and/or layout...

 

Project Information

Designer:

$Designer_Company = %$Designer_Company = "ASC"%

$Designer_Name = %$Designer_Name = "MC"%

$Designer_Phone = %$Designer_Phone = "(888) 123-4567"%

 

Client:

$Client_Name = %$Client_Name = "Mr. and Mrs. Jones"%

$Client_Phone = %$Client_Phone = "(888) 123-4567"%

 

Builder:

$Builder_Company = %$Builder_Company = "Super Duper Builders"%

$Builder_Supervisor = %$Builder_Supervisor = "Mike Smith"%

$Builder_Phone = %$Builder_Phone = "(888) 888-8888"%

 

Other:

$Project_Name = %$Project_Name = "Smith Residence"%

$Zoning = %$Zoning = "R-2"%

$Setback_Side = %$Setback_Side = 10.ft%

$Setback_Front = %Setback_Front = 25.ft%

 

$Property_Address = 

%$Property_Address = "1234 Main St.\nAnchorage, AK 99515"%
 

Just use this as a template and add your own project information variables.  Those variables can then be typed into any valid data entry field using the %$Variable_name% format.  You just need to make sure the text box is displayed in any and all views that use the information.  Just drag it off to the side.  
 

Anyway, feel free to use my “starter kit“ to your hearts content but consider contacting me directly with any questions or if you want to dig deeper and really learn more of the basics. 

  • Upvote 1

Share this post


Link to post
Share on other sites
5 minutes ago, Renerabbitt said:

$test = "testing this out"


My free lessons for the day are probably gonna have to stop here but you’re missing the % signs.  It should be...


%$test = "testing this out"%

 

Share this post


Link to post
Share on other sites
3 minutes ago, Alaskan_Son said:


My free lessons for the day are probably gonna have to stop here but you’re missing the % signs.  It should be...


%$test = "testing this out"%

 

you're the man..like seriously, what a time saver

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Member Statistics

    28439
    Total Members
    9156
    Most Online
    JennieT
    Newest Member
    JennieT
    Joined