GDL
About building parametric objects with GDL.

How to assign default materials

Anonymous
Not applicable
Hi,

I'm trying to force objects to gain default materials every time I open it in either ArchiCAD 20, 22 or 24.
Every project in different ArchiCAD-version has their own unique ID for each material, because of different amount of materials. An ID-value of 135 in one project, is not the same in another.

Without assigning the unique ID for the material, then how could you use the string value instead of the ID-value, in XML?
<Material Name="materialAttribute_1">
	<Description><![CDATA["Cabinet colour"]]></Description>
	<Fix/>
	<Flags>
		<ParFlg_Child/>
	</Flags>
	<Value>135</Value>
</Material>
In this code above, is it possible to write the string value of the material name, somewhere?

I'm using the LP_XMLConverter.exe-program to convert gsm-files to xml, and back again to gsm, after some correction.
5 REPLIES 5
runxel
Legend
There is no other way than knowing the ID.

One workaround could be to set the material ID to "0" (zero), being the generic default material in GDL. Then in the 3D script checking if the current ID is still zero, and if so getting your default material you want by name, to show that instead.
Disclaimer: I have not tested it but I think it works.
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Thanks for the reply

So; if the current index number (ID) is still zero while debugging in 3D; where do you write the default material? In 3D, or Master script?

It's not just a single material I can choose from, but multiple materials or choices - see attachment, so I can' t just write one single material in the script.

All my choices are written as for ex. VALUES "materialAttribute_1". A white color should be the default choice for a kitchen when a user opens the object, in any occasion. This is my number one problem, and all Graphisoft-objects behave like I want mine to be...
Anonymous
Not applicable
I solved it.

The trick is to not have the material attribute as a Surface type, but a Text type "ABC" in the parameter list.
I thought I couldn't use the UI_INFIELD {4} command, without the the parameter not being a Surface type, but I was wrong. puh...
In that way the material is the same in every occasion, and is independent of the index number

The down side now is to change all my scripts, not just the subtype...
runxel
Legend
Ah! But then the material needs to be named the same in every template, no?
I didn't assumed that this would be the case, but glad you solved it!
Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»
Anonymous
Not applicable
Yes, it needs to. If you want a costum surface, the text parameter shifts to a surface parameter.
The default surface is with the text parameter, while others are with surface parameter.

I'm happy now

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!