Editing Macros in Layout Box Specification > Labels


1q2w3e
 Share

Recommended Posts

I'm trying to figure out a way to customize the macro label on the Layout page. Right now, CA default for  the box scale macro reads as "1/4 in = 1 ft". See attached.

What I'd like to have is for that to be displayed in capital letters' as is all of my text on my plans. I.E. "1/4 IN = 1 FT",  or , even better, 1/4" = 1'-0".

 Most of the videos I've seen relate to plans and not layout pages, and couldn't find anything in the forums.

 

Can anyone point me in a direction here or help me with this? 

Thanks, 

Mark5997528c844aa_extgmacroonlayoutpage.thumb.GIF.4e19fb189d0f96ba59d651fc4ed5bb14.GIF

Link to comment
Share on other sites

Hey Mark,

 

Here's a custom macro that should do what you're after.  Its just a really simple one that will only work properly if you're using a standard x = 1'-0" scale, but I'm guessing that's all you probably need this for.  It could be modified as necessary for other more complex scales for an additional fee but this one is on the house...

 

Mark's box scale.json

 

Just download the .JSON file, import into your layout file using Text Macro Management, and then place the %Mark's box scale% macro into your layout box label and you should be good to go. 

 

Maybe just consider pasting paypal.me/alaskansons into your web browser and sending a small donation my way if it seems valuable enough to you.  Its all good either way though.  Hopefully it helps you out : )

 

P.S.  For the uppercase letters all you have to do is change the text style for your "Layout Box Labels" layer to uppercase...

Uppercase.thumb.png.47470a86ca0befd44097280968caaa07.png

...easy as that.

Link to comment
Share on other sites

1 hour ago, solver said:

Here is another idea. Works with odd scaling.

 

 

 

v=box_scale.split(" = ")

f=v[1].split(" ")

if f[2]=="ft" 

    x=f[1].split("/")

    i=(((x[0].to_f/x[1].to_f)*12).to_i).to_s

else

    i="0"

end

v[0].sub( / in/,"\"") + " = "+ f[0] + "'-" + i + "\""
 

ct1.jpg

 

Nice Eric.  I didn't feel like thinking about it that much or like working that hard.  I might as well delete mine now...yours seems like it's probably much better : )

Link to comment
Share on other sites

  • 5 years later...

I have a quick question.  I dabble in the macros every now and then when a client of mine wants specific outputs.  This thread has the info I was looking for...thanks Eric.  What was interesting however, was that the layout file I was using did NOT offer a User Defined option as the .plan file did.  It only presented "Global" and "Object Specific".  ONLY AFTER I imported Mike's .json macro did the User Defined option show itself and then I was able to edit the name and paste in Eric's code.

 

How might I be able to access that in the future manually...without having to import one??....As in, I just want to create one.

 

Comments welcome.

 

 

Link to comment
Share on other sites

Indeed much has changed with X14 on the labels and callouts!  I have another perhaps impossible label I want to explore.  It is on the roof label.  I want to add a "smart" arrow that will extend as far as need to match additional text in the label.  Sometimes I simply want the slope (ie default) but on renovation projects I want to add a couple characters to the slope nomenclature plus EX. V.I.F.  Currently the text overwrites the arrow and I'm adding a line to run the text over the default arrow and then adding a manual arrow.

 

I've attached an image to what I'm trying to build automatically.

 

 

roofLabel.jpg

Link to comment
Share on other sites

And another question for the ruby code gurus...

 

On the Callout, for example I sending a view to layout called Site Plan View.  The automatic label will send exactly that text and if I add the box scale I get the "Scale" now with the noted scaling values.  I would like to do the following with the text.

 

Add a space between each character and delete "View"....so I would like to see "S I T E  P L A N" and "S C A L E".   I recognize I can simply change the default callout and scale fonts to all CAPS...but the spacing I'm trying to figure out to do automatically...and remove the "View" from the %automatic_label% without having to change the name of the Saved Plan Views.

 

Comments welcome.

 

Thx.  

Link to comment
Share on other sites

2 hours ago, Alaskan_Son said:

For anyone reading along, please note that this thread is from 5 years ago and several version back. A good handful of things have changed since then.


 

1 hour ago, IvanCyr said:

Indeed much has changed with X14 on the labels and callouts! 

 

Yup, not only are there entirely different ways to label layout boxes and additional/different information that we have access to using those new label capabilities, but there have also been changes to macro naming requirements as well as the addition of NumberFormatter and Measurement Classes.  Oh, and the added ability to insert code directly into text fields…just to name a few notable changes off the top that could affect the conversation.

Link to comment
Share on other sites

This code produces the same thing...it only eliminates the "V" in "VIEW".

 

%automatic_label.delete('V')%

%automatic_label.delete('VIEW')%

 

How might I get "VIEW" to be truncated from the %automatic_label%?

 

Any takers?  Thx in advance.

Link to comment
Share on other sites

 

Well, in case anyone is interested in the thread and a possible solution, I was able to code this to function well to truncate "VIEW".  Now to work on adding a space after each character!

%automatic_label[/[^V()]+/]%

 

Link to comment
Share on other sites

5 hours ago, IvanCyr said:

I have another perhaps impossible label I want to explore.  It is on the roof label.  I want to add a "smart" arrow that will extend as far as need to match additional text in the label.  Sometimes I simply want the slope (ie default) but on renovation projects I want to add a couple characters to the slope nomenclature plus EX. V.I.F.  Currently the text overwrites the arrow and I'm adding a line to run the text over the default arrow and then adding a manual arrow.

 

Those roof labels are a little quirky with limited options.  Usually the best you can do is add some spaces and use a transparent text style and text above and below won't center so best to keep it all above or below unfortunately. ;)

Link to comment
Share on other sites

Thanks Michael.

 

On another note.  I've found a solution for the problems above because I could NOT get spaces in the initial format shown as %automatic_label[/[^V()]+/]%.

 

My solution was to nest the code.  I first tested the view name to truncate " View" as Ruby didn't seem to want to accept the .delete_suffix command.

 

The code was as follows:

 

string = owner.automatic_label

if string.match(/View$/)

string[0..-5]

else

string

end

 

I then created a second macro and formatted it as follows:

 

macros.remove_View.chars.join(" ").upcase()

 

Effectively, the macros takes the string, splits it into an array of characters, and I join it back again adding a space with each character and ensure it all comes back together as uppercase.

 

Perhaps this will be useful to others.

 

FWIW

 

Ivan

 

Link to comment
Share on other sites

@IvanCyr,  A few quick tips/critiques:

 

22 hours ago, IvanCyr said:

remove the "View" from the %automatic_label% without having to change the name of the Saved Plan Views.

 

I would start by asking myself some more specific questions such as:

  • What if the word doesn't start with an uppercase letter?  What if the word is all uppercase?  Don't forget that when it comes to coding these things, it's important that you consider letter case.
  • Do I only want to remove the word (substring) if it is at the end of the string or do I also want to remove the word if it exists in the middle of the string?
  • Do I want to only remove that specific substring or do I want to remove everything after it as well?
  • What do I do if my string starts with the substring?

 

19 hours ago, IvanCyr said:

 

%automatic_label.delete('VIEW')%

 

The #String delete() method doesn't look for specific words.  It looks for the characters you have listed.  What you're telling Ruby is that you want to remove every instance of the capital letter V, every instance of the capital letter I, every instance of the capital letter E, and every instance of the capital letter W.  This would change "West Wing Electrical Plan View" to "est ing lectrical Plan iew".  Not really what you want.

 

 

19 hours ago, IvanCyr said:

%automatic_label[/[^V()]+/]%

 

This one on the other hand is using a regular expression to keep everything except for the capital letter V and everything that comes after it.  This means something like "Vaulted Entry Reflected Ceiling Plan View" would return completely blank, something like "Kitchen Version 1" would simply return "Kitchen", something like "Electrical plan view" would return unchanged, and that "Framing Plan View 1st Floor" and Framing Plan View 2nd Floor" would both simply return "Framing Plan ".

 

This approach might get you what you want most of the time, but I personally think the code is pretty vague and not nearly specific enough to avoid undesirable results (that will show up when you're least expecting them of course).

 

17 hours ago, IvanCyr said:

Ruby didn't seem to want to accept the .delete_suffix command

 

The .delete_suffix method wasn't added to Ruby until Ruby version 2.5.  Currently Chief uses Ruby version 2.4.

 

You can however use the .chomp method to delete a suffix like so:  %automatic_label.chomp(" View")%which will specifically remove the word "View" when preceded by a single space but only if the string ends with that exact word (substring).

 

Anyway, like I said, I would start by asking myself how I might deal with at least the various scenarios I mentioned above (that is IF they could possibly ever arise) and then write my code a bit more explicitly.  If you're not pretty deliberate and purposeful with your coding you'll almost certainly end up with an unpleasant surprise at some point. 

Link to comment
Share on other sites

So I'm still on the saga of writing code for a template.  I've found good solutions to the above although, my wonderful operating 3 line roof label was scrapped by the client...admittedly, I wasn't able to find a control which would automatically point my arrow in the downward slope, I ended up using a layer control for that which was far from ideal. (Perhaps someone knows how to get a symbol arrow head and a continuous line character that populates into a variable length arrow [the ASCII code doesn't have the options].  Also a manner in which to be able to formulate the direction of the arrow. A review of the properties list on %object_properties% for a roof plane didn't give me any math upon which to create any logic.)  

 

On another note, I'm setting up some callouts on the layout for views sent to layout.  For some unique labels, client want "Attic"  to be an option.  However, on a 2 level house with a basement, the Attic in Chief is actually Floor 3 if you pick off the %referenced_view_floor_number%.  I haven't noticed a global variable to compare to in order to overwrite my attic floor 3 integer to an Attic "string".

 

Any help from the gurus?

 

Thx in advance.

Link to comment
Share on other sites

1 hour ago, IvanCyr said:

On another note, I'm setting up some callouts on the layout for views sent to layout.  For some unique labels, client want "Attic"  to be an option.  However, on a 2 level house with a basement, the Attic in Chief is actually Floor 3 if you pick off the %referenced_view_floor_number%.  I haven't noticed a global variable to compare to in order to overwrite my attic floor 3 integer to an Attic "string".

 

Sorry but what is it that you need to compare ?  Or is it just floor 3 needs to be labeled as "Attic" and you don't regularly build 4 level homes or full 3 level homes.

 

"So I'm still on the saga of writing code for a template.  I've found good solutions to the above although, my wonderful operating 3 line roof label was scrapped by the client...admittedly, I wasn't able to find a control which would automatically point my arrow in the downward slope, I ended up using a layer control for that which was far from ideal. (Perhaps someone knows how to get a symbol arrow head and a continuous line character that populates into a variable length arrow [the ASCII code doesn't have the options].  Also a manner in which to be able to formulate the direction of the arrow. A review of the properties list on %object_properties% for a roof plane didn't give me any math upon which to create any logic.)"

 

You could use a Unicode arrow but no way that I see to automate the direction to show down slope.

 

See this thread: 

 

Link to comment
Share on other sites

Thx for the question and the opportunity for me to clarify.  When the %referenced_view_floor_number% returns ANY number that equates to the Attic floor, I want to know.  In effect, I'm looking for a global value, or some referenced value I can glean within Ruby to make that evaluation (referenced floor = Attic floor) in order to trigger specific actions within Ruby.

 

Thx.

Link to comment
Share on other sites

6 minutes ago, IvanCyr said:

Thx for the question and the opportunity for me to clarify.  When the %referenced_view_floor_number% returns ANY number that equates to the Attic floor, I want to know.  In effect, I'm looking for a global value, or some referenced value I can glean within Ruby to make that evaluation (referenced floor = Attic floor) in order to trigger specific actions within Ruby.

 

No I don't believe so.  That would be a feature request at this point.  However if you were to decide that level 3 is to be referred to as Attic that would be fairly simple.  Unless there was a way to reference the room label or some part of the room definition but that would be a little more complicated.

Link to comment
Share on other sites

Yeah, that was what I was afraid of...so interesting to know that the info is tucked away in Chief somewhere but we have no means to access it through the Text Macro Mgmt....but I suppose I'd mess something up major if they let me play unsupervised in a bigger digital sandbox!  I'll have to practice my sad puppy dog face when I inform the client of the limitation.

 

Michael, Joe, and Chopsaw, thanks for your time...appreciate it immensely.  I'm slowly getting more capable in these matters.

Link to comment
Share on other sites

16 hours ago, Chopsaw said:

Unless there was a way to reference the room label or some part of the room definition but that would be a little more complicated.

I believe you could implicitly figure out level 3 is the attic by using a room label macro, and then publish that to a global variable. But as the OP desires this on layout, the plan would have to be open as well to run the room label macro (or start reading and writing files). Me thinks it would be a lot of work ensuring the value was for the specific plan

Link to comment
Share on other sites

  • 2 weeks later...

So I've been thinking....the smoke has cleared a bit...

 

Is there a way to "find" a global variable where Chief assigns "Attic" to %referenced_view_floor_number% because clearly, in Chief, above your highest floor, the floor above is deemed "A" for Attic?

 

Second, on the layout, I've set up a template feature where I use the # for page sequencing using the Label selection on the Layout Page Specification, and to be able to automatically create duplicate pages for Titles for Floor 1, Floor 2 etc.  Is there a way to "capture" that # value as it starts with 1 then sequentially moves up one as an integer.  On any particular page, can I "read" within Ruby code on any given layout page what that # is currently showcasing?  This would be helpful but I can't seem to glean that info from anywhere.

 

Thanks.

 

Waiting to be WXOF....(an aviation term to be weather of zero visibility in FOG)

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