We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-09-25 02:48 PM - last edited on 2024-09-26 01:49 PM by Doreena Deng
Hi,
which one is better
- 1 object with 10 subroutines x 500 lines of code or
- 1 object + 10 macros x 500 lines of code
?
I'm working on an object that will have a dropdown list of several choices - let's say 10 types of chairs, so you place the object chair.gsm and then choose type 1, type 2 ... No 3d script- it will only be 2d shapes.
Now I can store each respective 2d script as sub's and get a very long 2d script for the object or I can have macro calls and have each respective 2d script as a separate macro.
Wonder if anyone knows how it would be better from a resource managemet perspective - thinking that this object will be placed on multiple instances with different types, I would try to avoid weighing down the file if possible.
The 500 lines of code per type is a bit of exaggeration, but is one of the choices better than the other in this case?
Solved! Go to Solution.
2023-09-26 12:35 AM
The majority of the standard archicad libraries that have varying options utilise macros, but I suspect this is primarily from a code and version management point of view.
Realistically it’s the same amount of code in both situations. So the size of the macro option would only be a smidgen larger than a single object. The only factor I could see that would make the macros option drastically larger is if you had a huge amount of params for the object, you would ideally need to have all the same params in each macro too.
A single object may be easier to maintain though, but less scalable to future option additions.
Archicad is also quite efficient at dealing with multiple instances of the same library part. Just make sure your 2D representation is super efficient. Do not use Project2 and see if you can avoid Fragment2 and code the 2D in native GDL
If the size of the library does get big, I’m talking in the 100’s MB, packaging the library into an lcf has huge performance improvements over loading from a folder.
2023-09-26 04:46 AM
Sub-routines or macros probably don't make a big difference either way.
The advantage of macros are you can call them into multiple objects that need to do the same thing.
Change/update the macro if necessary and all objects that call it will update - saves having to change the sub-routine in multiple objects.
But if you want it unique for just that one master object, then sub-routines are fine.
Barry.
2023-09-26 12:35 AM
The majority of the standard archicad libraries that have varying options utilise macros, but I suspect this is primarily from a code and version management point of view.
Realistically it’s the same amount of code in both situations. So the size of the macro option would only be a smidgen larger than a single object. The only factor I could see that would make the macros option drastically larger is if you had a huge amount of params for the object, you would ideally need to have all the same params in each macro too.
A single object may be easier to maintain though, but less scalable to future option additions.
Archicad is also quite efficient at dealing with multiple instances of the same library part. Just make sure your 2D representation is super efficient. Do not use Project2 and see if you can avoid Fragment2 and code the 2D in native GDL
If the size of the library does get big, I’m talking in the 100’s MB, packaging the library into an lcf has huge performance improvements over loading from a folder.
2023-09-26 04:46 AM
Sub-routines or macros probably don't make a big difference either way.
The advantage of macros are you can call them into multiple objects that need to do the same thing.
Change/update the macro if necessary and all objects that call it will update - saves having to change the sub-routine in multiple objects.
But if you want it unique for just that one master object, then sub-routines are fine.
Barry.
2023-09-26 09:20 AM
thank you for the answers.
That's what I suspected as well, checking AC library parts with multiple option functionality I saw the same- the gsm is nearly empty with a macro call, sometimes even that macro is nearly empty with another macro call, and the last macro has all the code with subroutines and everything.
I understood that's bc. they are reusing the same macro to several objects so it's an advantage in that case , not in mine, but still it's good to check beforehand.
@scottjm- interesting about Fragment2 - I knew about Project2, but didn't think Fragment2 can add to complexity in a noticeable way