Michael_Gia Posted November 24, 2021 Share Posted November 24, 2021 What controls the "Use Default Formatting" in the Polyline DBX? When this is selected I get "sq ft" suffix that I would like to change to something else. Link to comment Share on other sites More sharing options...
Renerabbitt Posted November 24, 2021 Share Posted November 24, 2021 22 minutes ago, Michael_Gia said: "sq ft" I should not be responding to this but only a few of our macro gurus respond to stuff nowadays. Assume that I may be completely wrong, I am not familiar with using the correct terminology I believe in X-13 they built in a custom classification for anything that would be considered a dimension. Which means to use an area macro you may have to convert it to a float. by using .to_f Link to comment Share on other sites More sharing options...
Chopsaw Posted November 24, 2021 Share Posted November 24, 2021 51 minutes ago, Michael_Gia said: When this is selected I get "sq ft" suffix that I would like to change to something else. Something like this perhaps ? My French is a little rusty. Link to comment Share on other sites More sharing options...
Michael_Gia Posted November 24, 2021 Author Share Posted November 24, 2021 6 minutes ago, Chopsaw said: Something like this perhaps ? My French is a little rusty. Yes, that's what I was able to do as well except I loose the comma separator. If you uncheck "use default formatting" you lose the comma. ...and yes, I was trying to get sq.ft. in French, lol Link to comment Share on other sites More sharing options...
glennw Posted November 24, 2021 Share Posted November 24, 2021 Does this help any: Link to comment Share on other sites More sharing options...
Chopsaw Posted November 24, 2021 Share Posted November 24, 2021 It could be done a bit more elegantly with a user macro but try this until one of the guru's suggests something better. Link to comment Share on other sites More sharing options...
Michael_Gia Posted November 24, 2021 Author Share Posted November 24, 2021 20 minutes ago, Chopsaw said: It could be done a bit more elegantly with a user macro but try this until one of the guru's suggests something better. Thanks Chopsaw, I had a typo originally, but now it works great. Pretty neat stuff. Link to comment Share on other sites More sharing options...
Chopsaw Posted November 24, 2021 Share Posted November 24, 2021 2 minutes ago, Michael_Gia said: Thanks Chopsaw, but I wasn't able to get that to work. I must have a typo or something. Yes even spaces are critical but I deleted mine. Try it one more time and I will recreate if necessary. 1 Link to comment Share on other sites More sharing options...
Michael_Gia Posted November 24, 2021 Author Share Posted November 24, 2021 4 minutes ago, Chopsaw said: Yes even spaces are critical but I deleted mine. Try it one more time and I will recreate if necessary. It works, just need to round out the decimal places to 0. I thought by entering in, area.round(0) would give me no decimal places but it just adds .00 Link to comment Share on other sites More sharing options...
Joe_Carrick Posted November 24, 2021 Share Posted November 24, 2021 %area%, %width%, %height%, etc) return measurement values according to the current Plan (Imperial or Metric). To get the units to show you just need to convert the output to a "string" as follows: %area.round(2).to_s% -> 1419.25 sq ft %width.round(2).to_s% -> 62.5 in Note that it's possible to change the units using the "Formatter" class. 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted November 24, 2021 Share Posted November 24, 2021 9 minutes ago, Joe_Carrick said: Note that it's possible to change the units using the "Formatter" class. Can they be changed to French Joe ? Link to comment Share on other sites More sharing options...
Chopsaw Posted November 24, 2021 Share Posted November 24, 2021 23 minutes ago, Michael_Gia said: It works, just need to round out the decimal places to 0. Give this a test run: PARK 1 %((area.round(0))*10).to_f.round.to_s.insert(-5,",").chomp("0")% pi .ca Link to comment Share on other sites More sharing options...
Solution Chopsaw Posted November 24, 2021 Solution Share Posted November 24, 2021 5 minutes ago, Chopsaw said: Give this a test run: I may have made it more complicated than necessary... See if this causes any errors. PARK 1 %(area).to_f.round.to_s.insert(-4,",")% pi .ca 1 Link to comment Share on other sites More sharing options...
Michael_Gia Posted November 24, 2021 Author Share Posted November 24, 2021 16 minutes ago, Chopsaw said: I may have made it more complicated than necessary... See if this causes any errors. PARK 1 %(area).to_f.round.to_s.insert(-4,",")% pi .ca That did the trick. Thanks! ...again Link to comment Share on other sites More sharing options...
Chopsaw Posted November 25, 2021 Share Posted November 25, 2021 27 minutes ago, Michael_Gia said: That did the trick. Just don't go under 1,000 French sq ft with it or I will need to revise for you. 1 Link to comment Share on other sites More sharing options...
Joe_Carrick Posted November 25, 2021 Share Posted November 25, 2021 4 hours ago, Chopsaw said: Can they be changed to French Joe ? %area.round(2).to_s.gsub("sq ft","pi.ca")% -> 1419.25 pi.ca I don't think Chief will use French wording or abbreviations. So you need to make the "substitution" yourself. Link to comment Share on other sites More sharing options...
Chopsaw Posted November 25, 2021 Share Posted November 25, 2021 2 hours ago, Joe_Carrick said: %area.round(2).to_s.gsub("sq ft","pi.ca")% -> 1419.25 pi.ca I don't think Chief will use French wording or abbreviations. So you need to make the "substitution" yourself. They should maybe think of that since their marketing team is going international. 7 hours ago, Joe_Carrick said: To get the units to show you just need to convert the output to a "string" as follows: %area.round(2).to_s% -> 1419.25 sq ft It is interesting in your example above that it does not follow the same default formatting as you get when you select "Use Default Formatting" for a label display, as when you tell it to display as a string. That seems to be more than just a little bit inconsistent. That really should have the default thousand's separator, should it not ? That is why I dumped the formatting all together and put what was required back in manually even though it is not a clean as I would have liked. This may have been a little better but still fails under 1,000 %area.round.to_s.insert(-10,",").gsub("sq ft"," pi.ca")% Link to comment Share on other sites More sharing options...
Joe_Carrick Posted November 25, 2021 Share Posted November 25, 2021 I don't use any custom units since I am not doing projects that require it. However, it is possible to create unit conversions using the Preferences>General>Unit Conversions dialog. These named units can then be used in Dimension Defaults, as well as in various dialogs. It's possible to set these custom units up so that they are the "Default Formatting" with specific 1000ths separators and decimal separators and unit names. When used in dialogs, the input will recognize the custom unit. This is really a great way to customize Chief for other languages. Note that "Custom Units" will automatically display the units while the built-in units require the ".to_s" as I indicated previously. For those who want to use these features you should search Help for "Unit Conversions" and "Number Formatting Class". It's a little complicated but once done it will be available for all Plans. 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted November 25, 2021 Share Posted November 25, 2021 Thanks Joe, It has been a few years since I looked at that. Time to refresh. 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