Developer forum
Showing results for 
Search instead for 
Did you mean: 

How to assign default materials

Not applicable

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>
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.

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.
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

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...

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...

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!
AC 24 [ger] | Win 10 | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

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

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!