ComputerMaster86 Posted October 7 Share Posted October 7 My window schedule has a custom object field that is linked to a column of the schedule. In the custom object field I have typed the following... %@rouSil[1][4,0,0]% My macro works and does what I intended it to do but, I am having trouble getting the macro to execute automatically for all items in schedule. I have to click on "Open Row Object" and then close out the dialogue box for the macro to execute. Then it will execute for just one window. I have to keep repeating the process of clicking on a line item, clicking on "Open Row Object" and then close out of dialogue a number of times equal to how many windows I have in my schedule. There must be something about how ruby works I am not understanding. How do I trigger the macro to run automatically for every window in the schedule? My knowledge of ruby is limited. Here is my macro... @sill = (owner.bottom_elevation - owner.rough_opening_clearance_gap_bottom).to_f.round(4) @rouSil = [ -> (thickA, thickB, height) {(owner.bottom_elevation - owner.rough_opening_clearance_gap_bottom).to_f.round(4)}, -> (thickA, thickB, height) {( owner.bottom_elevation - owner.rough_opening_clearance_gap_bottom).to_f.round(4) + thickA + thickB + height}, ] puts = @rouSil[1][4,0,0] Schedule Issue.zip Link to comment Share on other sites More sharing options...
Alaskan_Son Posted October 7 Share Posted October 7 A few quick pointers on the house: Its not breaking your current code, but there's no reason you need to be using instance variables for this. The @ symbol is simply unnecessary. Defining a "puts" variable at the end is also unnecessary and in this case is actually breaking your intended functionality. You're calling on the array and proc inside your macro (@rouSil[1][4,0,0]) and then you're attempting to repeat the process in your Object Information Field (%@rouSil[1][4,0,0]%). You only need one or the other, not both. Using the puts keyword as a variable name is also bad coding and entirely unnecessary. If you want to call on the array/proc inside your macro definition, just put @rouSil[1][4,0,0] as your last line and then put %winRoughSill% in your Object Information field. If on the other hand you want to use the array/proc directly in the Object Information Filed (which is probably the case), delete the last line in your macro and use %macros.winRoughSill[1][4,0,0]% in your Object Information field. If you want any guidance beyond that, consider emailing me at alaskansons@gmail.com for some professional consultation. I don't have a lot of time these days for even paid Chief consultation work, meaning I have even less time for unpaid consultation work . Link to comment Share on other sites More sharing options...
ComputerMaster86 Posted October 7 Author Share Posted October 7 Thank you so much for the tid-bits. Link to comment Share on other sites More sharing options...
Renerabbitt Posted October 8 Share Posted October 8 just seeing this post here so I'll paste my response from your other post: Quote When you post screenshots of TMM window, it would be great if you have the executable object selected so that we see that actual result vs the Eval Error. I know you are learning and so maybe you are using a script aide like chatgpt so I have some questions for you in case it helps me help you: puts is implicit in Chiefs ruby environment in most circumstances and can cause problems so remobv "puts" Is there a reason you are using instance variables? Is there a reason you are rounding the info being put into the variable sill? Is there a reason you aren't just passing sill into rousil? Is there a reason you have the indices call in your script instead of referencing a custom field? You are not taking advantage of the measurement class here, which is not necessarily a bad thing but it would offer more in the way of formatting with the number formatter. The context is owner object, so remove "owner." as the reference to the object I am still curious as to what the goal is here as the built in clearance gap designation would be a lot less work than this. what is the reason for the indexed approach? what are the multiple inputs for, why not one input? and then: Quote maybe this works for you..it checks to make sure custom fields can be converted to float and then adds 2 custom fields to your sill. (not required per se but just make sure someone doesnt put text in your custom field) Alternatively you could treat one custom field as an infinite hash lookup comma separat Link to comment Share on other sites More sharing options...
Renerabbitt Posted October 8 Share Posted October 8 9 hours ago, Alaskan_Son said: If on the other hand you want to use the array/proc directly in the Object Information Filed (which is probably the case), delete the last line in your macro and use %macros.winRoughSill[1][4,0,0]% in your Object Information field. is there a reason for the call "macros." here? Serious question...is that because its an array? because it contains a lambda? Link to comment Share on other sites More sharing options...
SHCanada2 Posted October 8 Share Posted October 8 i'm still waiting for an invite to the lambda delta lambda or lambda lambda lambda fraternity. Do I find one here in this forum? Link to comment Share on other sites More sharing options...
Alaskan_Son Posted October 8 Share Posted October 8 4 hours ago, Renerabbitt said: is there a reason for the call "macros." here? Serious question...is that because its an array? because it contains a lambda? Short version: You’re working with 2 different types of macros. %macros.name% is an accessible ruby object. %name% on the other hand is nothing but intra-Chief string substitution and the results cannot be accessed or parsed in any way. Link to comment Share on other sites More sharing options...
Renerabbitt Posted October 8 Share Posted October 8 2 hours ago, Alaskan_Son said: Short version: You’re working with 2 different types of macros. %macros.name% is an accessible ruby object. %name% on the other hand is nothing but intra-Chief string substitution and the results cannot be accessed or parsed in any way. makes sense, thank you 1 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