Macro Coding Template


Joe_Carrick
 Share

Recommended Posts

Here's the Template I use for all my macros.  It provides for error trapping and an explanation of the code.

I hate to have a macro fail with #evaluation error# so I trap errors and return an explanation of the error.

I also liberally place comments in the script so I know what each section is supposed to do.

 

#############################################
# YODA'S MACROS - X15 CERTIFIED ON
11-25-2022
#  Copywrite By Joseph P. Carrick
#############################################
# Macro Name & Description
#  <Name>
#  <Description>
#############################################

# Set Context and initialize result.
# Make valid for Referenced or Owner Object
#############################################

referenced ? obj= referenced : obj=owner
result = ""

#############################################
# Trap errors and provide an explanation
#   begin 
rescue end    &   if / elsif / else / end
# sequences can be nested any number of 
# levels as needed.
#############################################

begin
  # Conditional processing where an error
  # might occur.  This code must define the 
  # value for result.

  result = <ruby code using object NVPs>
rescue
  # explanation of error
  result = <Error occured because .....>

    -or-

  result = default value (what you want to use as a default)
end

#############################################
# Display result
#############################################

result

 

Here's the Notepad++ "rb" file for editing with Ruby Language formatting.

MacroTemplate.rb

  • Like 5
  • Upvote 2
Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...

Joe,

 

I've tried to DM you a few times about purchasing some macros if you still have them available for sale. One specifically would be a macro for room floor elevation in feet for plan view (not inches as Chief provides it). I suck at ruby scripting so I would be interested in what else you have available for macros for sale.

 

Thanks.

Link to comment
Share on other sites

4 hours ago, Seacoast said:

Joe,

 

I've tried to DM you a few times about purchasing some macros if you still have them available for sale. One specifically would be a macro for room floor elevation in feet for plan view (not inches as Chief provides it). I suck at ruby scripting so I would be interested in what else you have available for macros for sale.

 

Thanks.

Hi Ron,

I've been very busy and apologize for not answering PM's.

Do you want it for actual elevation?  ie: Sea Level or just relative to Floor 1

I have macros that work in decimal feet as well as in ft_in.  

-Joe

Link to comment
Share on other sites

Hi Joe,

 

Thank you for your response. No worries, I can relate to being very busy. I was looking for relative to floor 1 in feet and inches.

 

Do you have a list of macros available with prices? You can send me a PM if you would like. Thank you

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