Chopsaw Posted June 18, 2020 Share Posted June 18, 2020 On 6/8/2020 at 11:14 AM, Alaskan_Son said: On 6/7/2020 at 3:22 AM, Chopsaw said: That is a great question. Not sure if Chief thinks they are top secret or if they just figure they are too boring to publish but it would be a great starting point for someone learning ruby as it is written in chief's special version. Not sure what exactly you're referring to either Chop. There's nothing special about the version of Ruby Chief is using. They're currently using Ruby version 2.4.0. What is it that you would like them to publish? Sorry for the delay. I was really busy and not sure if you were being serious. There are plenty of examples of this in chief. Ruby seems to come naturally to you but not so for most of the rest of us. One of the first problems I had when I started using chief was a macro to display the date. The embedded system macros they provided were not suitable for me as I use to use a software program the would use both formats of a 6 digit date code and then randomly mix them when printing reports. So what you would get on a 60 page report would be 60 pages of wasted paper and lots of ink use up ! I don't use 6 digit date codes anymore. So as the new kid trying to get my first set of drawings produced on completely foreign software I am faced with the decision of using a date that I don't like the formatting of or typing it out multiple times and hope to not make an error somewhere, then do that on every set of drawings from then on or try my best to learn a new programming language and make my own date code macro. Well maybe it will only take and hour or two so I give it a try and google ruby stuff all night. Get no sleep and then make some other mistakes one the drawings because of lack of sleep and still have to type the dates in. Hopefully you get the idea and can remember some of your struggles starting off with the software ? The point being that it is much easier to modify existing ruby code than it is start from scratch if you don't know ruby. So if chief was to provide the ruby code for %date.long% and %date.short% I would have looked at those to see how they work and likely would have been able to modify the code to create my %International.date% without wasting so much valuable time. Just a few minutes for someone who is proficient but maybe a few hours or a few days for someone who is not. Or maybe even a few days without results. Link to comment Share on other sites More sharing options...
Alaskan_Son Posted June 19, 2020 Share Posted June 19, 2020 @Chopsaw, what makes you think those built in macros are using Ruby at all? I’ve tried many times in the past to explain this here on the forum, but I feel like it’s not getting through to it’s intended audience. You have Chief Architect, you have Text Macros in Chief Architect, and you have Ruby that can OPTIONALLY be used for Text Macros in Chief Architect. Ruby is nothing more than an optional tool. Anything between % signs is processed solely by Chief. Only if the macro is set to be evaluated is the text passed through to Ruby and executed as code. On a side note... Chief did change how this works to a certain extent starting in X12 and actually seems to pass any VALID code placed between % signs through to Ruby, but this is a new development and doesn’t change my statements above. Just because we have a macro for something like %scale% doesn’t mean Chief is using Ruby to produce the results. Link to comment Share on other sites More sharing options...
Chopsaw Posted June 19, 2020 Share Posted June 19, 2020 11 minutes ago, Alaskan_Son said: @Chopsaw, what makes you think those built in macros are using Ruby at all? I’ve tried many times in the past to explain this here on the forum, but I feel like it’s not getting through to it’s intended audience. Sorry I am not sure I have read any of those threads and without that your comments are really confusing. I was not referring to a Text Macro in my example and I am not sure how chief could possibly know what the date is, some external source would be required. It would make more sense that chief would internally know what the %scale% would be but having difficulty wrapping my head around the concept. I thought ruby was required to calculate or retrieve data from the program. Is there somewhere that Chief Architect explains it that I missed ? Link to comment Share on other sites More sharing options...
Alaskan_Son Posted June 19, 2020 Share Posted June 19, 2020 21 minutes ago, Chopsaw said: Is there somewhere that Chief Architect explains it that I missed ? Not sure, but in general, I think it's just a faulty presupposition. Regarding the date specifically, I can't say for certain, but I can pretty much guarantee you that Chief is just pulling that straight from the operating system and that there is no Ruby involvement at all. Having said that, you can skip Chief's global macros and do that with pure Ruby as well using the Time class in a custom text macro... Time.now.strftime("%B %d, %Y") Where Time.now retrieves the current time from the operating system, where %B displays the full month name, where %d displays the day of the month, where the comma is displayed as a literal comma, and where %Y displays the year. 1 Link to comment Share on other sites More sharing options...
Alaskan_Son Posted June 19, 2020 Share Posted June 19, 2020 49 minutes ago, Chopsaw said: Sorry I am not sure I have read any of those threads and without that your comments are really confusing. Link to comment Share on other sites More sharing options...
glennw Posted June 19, 2020 Share Posted June 19, 2020 Chop, As Michael says, Chief gets it's time and date info from the operating system. Macs have a System Preference where you can assign any custom date/time format to the various date/time types. Here, I have customised the Short Date format so that it reads as you want. So that when %date.short% is used in Chief, this is how it displays: I don't know if windoze has a similar preference setting. 1 Link to comment Share on other sites More sharing options...
glennw Posted June 19, 2020 Share Posted June 19, 2020 Chop, I just had a look and it appears that you may be able to do something similar in windows. But, not having windows, I don't know for sure. Have a look here: https://www.faqforge.com/windows/change-date-time-formats-windows-10/ Go down to the bit where it says that you can customise the date/time setting by going to Control Panel>Region>Formats>Additional Settings 1 Link to comment Share on other sites More sharing options...
Alaskan_Son Posted June 19, 2020 Share Posted June 19, 2020 6 hours ago, glennw said: Chop, I just had a look and it appears that you may be able to do something similar in windows. But, not having windows, I don't know for sure. Have a look here: https://www.faqforge.com/windows/change-date-time-formats-windows-10/ Go down to the bit where it says that you can customise the date/time setting by going to Control Panel>Region>Formats>Additional Settings You are correct. Totally customizable in Windows as well. Not nearly as complicated as that article makes it seem though... 1 Link to comment Share on other sites More sharing options...
Chopsaw Posted June 19, 2020 Share Posted June 19, 2020 Thanks guys for the help and clarifications. It seems I still have a lot to learn. Nice to see that Microsoft is stuck in a 2017 time warp. 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