DrawingABlank Posted February 18, 2023 Share Posted February 18, 2023 Good day, After searching over countless Macro topics, going thru 2 Ruby tutorials and many macro versions its time to give up digging / 'learning' for the moment and just post the question. How can a "floor_finish_name" macro that returns "Concrete" when no flooring is present be written? (extra credit would be if it also returns "Sub-floor" in case of being on floor system) This macro IF argument is needed cases such as defaults like Mechanical room and in rooms with default floor removed. The biggest challenge for me seems to be the syntax when wanting to call on Chief's string values from the plan. Any help in this regard is appreciated. Link to comment Share on other sites More sharing options...
tundra_dweller Posted February 18, 2023 Share Posted February 18, 2023 I put a 0" thickness concrete material for the floor finish of those rooms. Room Spec-->Structure-->Floor Finish-->Edit 1 Link to comment Share on other sites More sharing options...
Joe_Carrick Posted February 18, 2023 Share Posted February 18, 2023 x = "Concrete" if floor_finish_name.length > 0 x = floor_finish_name end 1 Link to comment Share on other sites More sharing options...
Alaskan_Son Posted February 18, 2023 Share Posted February 18, 2023 On 2/17/2023 at 3:10 PM, DrawingABlank said: How can a "floor_finish_name" macro that returns "Concrete" when no flooring is present be written? (extra credit would be if it also returns "Sub-floor" in case of being on floor system) I think you're presenting an XY Problem here. You're attempting to use the floor_finish_name to report information for what's underneath--something that it cannot possibly do. A crawlspace with no slab for example would still report a "concrete" floor. Even if we were to expand the idea and also check for an underlying floor structure, we would still have problems. A deck or patio with planks and decking for example would report as having "Sub-floor". In addition, an Open Below room would report its own floor data even though it has no floor and a Floor Supplied by Foundation Room Below would have similar problems. What you really need is to write a macro that checks for the room settings and then returns information about the actual model data based on that. I offer this and other Chief related consultation and support services and would be happy to help you set something up if you'd like, but here are a couple macro examples on the house just to give you a taste and get you started: Let's start with one that works exactly like your basic request: if floor_finish_name.empty? "Concrete" else floor_finish_name end We test to see if the floor_finish_name is an empty string. If it is, we replace it with the word "Concrete". Otherwise we use the actual floor_finish_name. And one that deals with your extra credit (but more properly): if floor_finish_name.empty? and floor_platform_layers.any? floor_platform_layers[0].material_data.description else floor_finish_name end Again, we test to see if the floor_finish_name is an empty string but this time we also check to make sure whether or not there are any underlying floor_platform_layers. If the name string is empty and there are any floor platform layers, then we simply report the actual floor platform material data (whether "Concrete", "OSB", "Trex Decking", or anything else). Otherwise we simply report the empty floor_finish_name string since there is neither a floor finish nor a floor platform. Again, there may be more things to consider as well, but that should get your started. If you'd like anything beyond that, shoot me over an email or send me a PM and we can take it from there. 2 Link to comment Share on other sites More sharing options...
DrawingABlank Posted February 20, 2023 Author Share Posted February 20, 2023 I appreciate all three ways suggested. Thank you all. Having multiple suggestions not only builds my understanding of the specific task and macro use overall. Link to comment Share on other sites More sharing options...
Alaskan_Son Posted February 22, 2023 Share Posted February 22, 2023 On 2/20/2023 at 8:45 AM, DrawingABlank said: I appreciate all three ways suggested. Thank you all. Having multiple suggestions not only builds my understanding of the specific task and macro use overall. I assume it was an accident, but you really shouldn't mark your own post as a solution. If you were provided with an answer that effectively solved your problem then you should select that post as the solution. 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