Using a global variable from .plan in .layout


Recommended Posts

We are attempting to populate a title block in the .layout file with a global defined variable of %room.elevation.ceiling% but with no success. I guess my first question is can this be done in Chief Architect? 

If so can someone help with this one simple action.

 

We have tried a simple $FH = %room.elevation.ceiling% to assign the "frame height" as we describe it here and then attempted to use this global value in a textbox field in the .layout but struggling to get any information from the plan that has been imported.

 

Thanks

Link to post
Share on other sites

Yes I think there is an issue with doing that sort of thing between files.   Is there some reason why that can not be in a text box in your plan file and sent to layout ?

Link to post
Share on other sites

There shouldn't be a problem as long as both files are open at the same time.  You will have to display the plan (view with the macro that assigns the value to the global variable) first.  Then  display the Layout page that retrieves the value.

 

I do this sometimes but I agree with Chopsaw - it's easier if it's done in a text box within the plan file itself.

Link to post
Share on other sites

Purely for handling reasons. The title block and the entire purpose of .layout is to take your 3d model with notes and place it in the title block.

 

It seems onerous to have to complete steps multiple times when you have all the information at your fingertips in the .plan file.

Frame height, roof pitch, wall type information which populates the title block for individual layout sheets. 

 

As an illustration this is one of the layout sheets, we populate manually the schedule of materials on every job where in the .plan we can setup wall types that can pass us the Ext. Cladding. We can get the frame height from the global variable I listed above. Just seems like a clumsy way of taking a 3d drawing into 2d layouts with zero information being passed between the two

 

image.thumb.png.86f503b6b4b3e3f185ff955082bc1034.png

Link to post
Share on other sites
49 minutes ago, BruceLove said:

$FH = %room.elevation.ceiling%

 

We need more info.

 

Where are you assigning $FH?

 

In a user defined macro, try $fh = ceiling_elevation

Link to post
Share on other sites
1 minute ago, solver said:

Everyone here appreciates it when new members complete their signature with some basic info. Makes it easy to locate and always available.

 

Your version of Chief key, and is especially important when dealing with Ruby.

 

You can add that info, Windows or Mac computer etc to your signature by clicking on your user name at the top right of the page, click Account Settings, then Signature on the left.

 

Thanks

 

We have CA X9 - CA X12. All versions of the HD suite as well since I am in charge of a organization that uses these packages around the country

 

My current question relates to X12. 

 

I have already setup a user defined macro to assign the $fh a value but can't do anything outside that user defined macro to call the information. Is there a means of calling the information via an objects ID?

 

 

Link to post
Share on other sites

Based on the layout sheet you posted it looks like your are relying heavily on macro's.  There are a few users that send their entire title block for page 0 from the plan file but it looks like maybe your are even a step beyond that and you have a custom title block for each page that relies on plan macro's so you may not even have a use for page 0 and would benefit from sending all your pages directly from the plan file.

Link to post
Share on other sites

One possibility is to add editable text files with the data pre-assigned.  You can have macros that read those files and assign the data to global variables or just dispaly the data without using global variables at all.  You can even have a single character text box to link to those text files for editing.

 

I use that system to access the same sort of information Chief provides for Designer and Client info.  

  • Structural Engineer
  • Surveryor
  • Energy (T-24)
  • Builder
  • etc.

I also use it to load various tables of data for structural calculations as well as some code requirements.  Most of it is loaded directly when the Layout is opened via a Label of a Layout Box on Page 0 of my Layout Template.  That Layout box has to be linked to a view in the plan from which it gets the location of the Plan.

 

Ruby can be very versatile if you know what you are doing.

Link to post
Share on other sites

I'll just toss this out there...but you could set up all your info without using the layout at all. You can place a title block on you plan file and use the PRINT PREVIEW to align everything. 

image.thumb.png.394f31fda23d04316f098ae9aa977559.png

 

image.thumb.png.664a94dabcbf114ddd227b811ad4fb3c.png

 

This method may work better for you rather than using the layout file. SImply print everything from the plan file.

 

Link to post
Share on other sites

Thank you all for your replies. 

Eric, your video actually clarified my initial question. Generating a global variable in the plan and being able to display its results in Layout. 

 

I guess where the question is lost is simply the way we handle files verses the method described above by Joey. I have thought it would be a much cleaner solution to simply avoid layout all together but since it is there I would like to make use of it.

 

For now I will need to experiment and will show you the results as a means to finishing this question up for others that wish to use it in a similar fashion.

 

Thanks again.

Link to post
Share on other sites
On 5/7/2021 at 4:40 PM, Chopsaw said:

Based on the layout sheet you posted it looks like your are relying heavily on macro's.  There are a few users that send their entire title block for page 0 from the plan file but it looks like maybe your are even a step beyond that and you have a custom title block for each page that relies on plan macro's so you may not even have a use for page 0 and would benefit from sending all your pages directly from the plan file.

 

The problem as I see it is the reverse of this.

We have a title block on page 0 which is the one along the lower edge of the layout sheet I posted above. This is the same on all sheets and the index table is populated via the pages in the layout file. 

The schedules are different up the left hand side of the title block which are project specific and the team is editing every field for every job on a case by case basis. The issue that comes from this is since we have large turnover it is the simple mistakes like describing the frame height that can be overlooked because the last 4 were 2410 but this one wasn't meant to be.

 

So I am plotting which elements can be done via macros in the way that Joe has shown in the video so that when we have a plan sent from plan to layout the majority of the project specific information is auto populated.

 

I hope this is all making sense as I have not long been involved with Chief Architect and have a way I would like to see things done based on my other design roles using other packages.

 

 

Link to post
Share on other sites
1 hour ago, BruceLove said:

I guess where the question is lost is simply the way we handle files verses the method described above by Joey. I have thought it would be a much cleaner solution to simply avoid layout all together but since it is there I would like to make use of it.

 

Joey and I are basically suggesting the same solution.  You can still take advantage of all of the benefits the layout file provides by placing your title block and index table. But you may still want to consider sending your schedule from plan to layout to avoid complication and possibly other info as well since you can draw on the plan Client Info if you send from plan so as to avoid duplication all that information in the layout Client Info.

 

Michael who is another macro expert gave the same advice for another user in a similar situation today.

 

 

Also it was Eric that posted the global macro video for you above. 

Link to post
Share on other sites

Life would be simpler f we could just reference by plan and named object like you can with excel macros. ie..

myarea = plan("jason.plan").plan.floor[1].standard_area

 

then CA would look at any plan in the layout until it found jason.plan

and then get the attribute

 

and then on layout load, you could hit a refresh and it repopulates, or it would autorefresh

Link to post
Share on other sites

Sorry to be a hassle, but is it possible to write a .txt file with a bunch of defined variables and have them set when the macro is run. What I have so far.

 

image.thumb.png.51badde9ac70871e0ac55c9b88dadc0c.png

 

So it reads the file and evaluates it with the information but it doesnt define the global variables from there. I guess there is a step after reading the file that runs it as a macro? Or a ruby code to run it rather than read it?

Link to post
Share on other sites

 

Contents of t.txt

 

    $z='123456'

 

Ruby to read and execute the contents

 

    file=File.open("d:\\t.txt","r")

    x=file.read

    file.close

    eval (x)

  • Upvote 1
Link to post
Share on other sites

Is it possible to post just the code that referred to the eval part. I believe this is the solution I am looking for just the resolution of that file is not good enough to see the code.

Again appreciate your guidance.

 

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

    29809
    Total Members
    9156
    Most Online
    WHDesigns
    Newest Member
    WHDesigns
    Joined