Assigning matterials from AfterAssignMaterial

Moderator: GiD Team

Post Reply
barnacle
Posts: 12
Joined: Sat Feb 28, 2015 1:51 pm

Assigning matterials from AfterAssignMaterial

Post by barnacle »

Hello there,

I tried to use the AfterAssignMaterial function to create a new material entry and assign it then. This might sound a little strange, but I would like to give the user the ability to define a material having some basic properties and leave some properties "variable". With "variable" it is ment, that the user can change the propertie befor assigning the material, save the changed material under its old name and assign the material. The AfterAssignMaterial routine should then create a new material incorporating the "variable" propertie in the materials name (the new material is in a book hidden from the user) and assign the new material to the volume. The reason for that is, that the propertie is changed very often and always creating a new material manually is time consuming and there will be just to many materials. Unfortunately it seams impossible to use the "GiD_Process Mescape Data Materials AssignMaterial..." from within AfterAssignMaterial. Of course using it this way can lead into an infinity loop, but this should be managable. Is it possible to somehow enable the usage of AssignMaterial inside AfterAssignMaterial? Otherwise I think working with conditions might be best?

Thanks for your reply,

barnacle
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Assigning matterials from AfterAssignMaterial

Post by escolano »

Entities point to a single material entity, if do you change some field of a material and save it with the same name then all entities pointing it will change its value!!

As you pointed the behavior that do you want is just a 'GiD condition' not a 'GiD material'.
(it is not compulsory to use 'GiD material' for your material, it is relatively common to represent it with a 'GiD condition'

You can also use a mixed approach: the 'basic' material properties can be stored in a 'GiD material' and your condition could have a special 'Question' field #MAT#(bookname) to select this 'base material' (a combo box will show the user the current material names of this book)
and the 'extra changing properties' could be stored in other questions of the condition.
Note: the separation by books is optional

e.g.
*.cnd

Code: Select all

CONDITION: Surface_shell
CONDTYPE: over surfaces
CONDMESHTYPE: over body elements
QUESTION: base_material#MAT#(base_materials)
VALUE: Concrete_HA25
QUESTION: thickness
VALUE: 1.0
END CONDITION

*.mat

Code: Select all

BOOK: base_materials

MATERIAL: Concrete_HA25
QUESTION: compressive_strength
VALUE: 25.0

MATERIAL: Concrete_HA30
QUESTION: compressive_strength
VALUE: 30.0
END MATERIAL
...
Post Reply