Search code examples
pythonuser-interfaceabaqus

How create Abaqus RSG gui builder that shows material property


I want to create a RSG gui builder that can show the material property. The following code can do such a thing.

from odbAccess import openOdb
odb_file_path=r'your_path\file.odb'
odb = openOdb(odb_file_path)
instance = odb.rootAssembly.instances['PART-1-1']
material_name = instance.elements[0].sectionCategory.name[8:-2]
density=odb.materials[material_name].density.table[0][0]) #density
odb.materials[material_name].userMaterial  #user material parameters

I'd like to create a plug-in for this code as I need to use it a lot. But I have difficulty figuring out the meanings of boxes in 'Combo Box'. enter image description here

I was wondering what is the difference between these two 'Keyword', and how should I achieve my goal (show material property with really simple GUI)?

#################### update

I use a simple function to test the 'Combo Box'. I am not expecting this function to show the material property, but hope to see no errors...

def show_material(material):
    print material 

Solution

  • Your issue is just a basic misunderstanding of python syntax.

    Here is example of your case: enter image description here

    The Kernel is defined like this: enter image description here

    if in you highlight title in the GUI tree you can select Show dialog in test mode. Then when you click OK on your plugin you see this message:

    enter image description here

    this is important as it shows what keywords have to be accepted in your function! You see that I have already defined my kernel function to accept materials and keys, therefore, no further steps are necessary and i can test my plugin by disabling Show dialog in test mode.

    enter image description here

    as you can see from the figure above the plugin works.

    Things to note:

    • your function has to accept all the keyword you are passing to it

    • your function name should not be the same as any of your keywords

    • your module name should be unique and never used in other kernels