The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Everything about GDL - Doors/Windows/Objects/Stairs etc. (Example: I created an object that prints an error message in 3D all the time, please help!)

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy, Gergely Feher

By Luiscardoso
#281846
Hi,

Sometimes i do objects by coding but some objects are just easier to draw w fills and then 'save selection as object.'

Currently I am doing it for 1 object with many variants of it (w different sizes or shapes)

My questions are the following :

FIRST

Because am combining in one object many versions the sizes of A and B are always of the first option even if the second option has different sizes.

I went around this by inserting the code in the 'Parameter' tab:

IF optx='135x220' THEN

PARAMETERS A=0.220, B=0.135

ENDIF

IF optx='135x240' THEN

PARAMETERS A=0.240, B=0.135

ENDIF


But i have to do this for every single option. Is there a code i can use for archicad to take A and B automatically from the limts of the object?

SECOND

I plan on using this object in different projects (saving it in a container file) and keep adding versions with (with on off buttons or values) of it as time go on (updating the container file everytime) . Do you see any problem with this method? will my previous placed objects be fine or will they change?


I hope the text is clear.

Thanks in advance

Luis
By Dave Seabury
#281848
Luis

You need to split the 135x220 in to useable parameters. The easiest way to see this is to
look at the scripting (master script) of the DET_Stud object in the standard library. It is
a little tricky to figure out at first, but it will get you what you are after.

David
By Lingwisyer
#281861
the scripting (master script) of the DET_Stud object in the standard library.
Which library is this in? I cannot find it in the AC21 AUS default library.


Ling.
User avatar
By Barry Kelly
#281864
You will want to do something like this in the master or parameter script.
Code: Select alln=SPLIT(optx, "%nx%n", width, string, height) A = width/1000 B = height/1000 PARAMETERS A = A PARAMETERS B = B
It is best to set the value of your parameter as well as set the actual parameter.
i.e.
A = width/1000
PARAMETERS A = A

Barry.
User avatar
By Barry Kelly
#281866
I plan on using this object in different projects (saving it in a container file) and keep adding versions with (with on off buttons or values) of it as time go on (updating the container file every time) . Do you see any problem with this method? will my previous placed objects be fine or will they change?
It depends on what you are changing as it can affect already placed objects if you change the way the existing scripts work.
But if you are just adding new features and keeping the existing ones as they are, generally you should be fine.
Just make sure you 'Save' replacing the original object and do not 'Save As' with the same name as this will create a new object with a new GUID.
Existing objects will not be updated if you 'Save As'.

You may find if you are always updating the object that a container file can be a bit of a pain to extract and create all of the time.
The objects do not need to be in an LCF.

Barry.
By Lingwisyer
#281867
Found this thread which seems to talk about the same thing. Breaking a string into parts to use as dimensions.


Ling.

ps. Woo! 50 line reduction!