Page 1 of 1

Adjusting transformation type with scripting

Posted: Fri Mar 08, 2024 8:54 am
by StavrosP
Hello,

I cannot control the transformation type of an Elastic Timoshenko beam via Python.
So the following command highlighted in red doesn't return PDelta. Could you please guide me on how to get this?

xobj_el.getAttribute('transfType').String = 'PDelta'

Code: Select all

def beam_element(i_beam, beam_w):
    """
    Define the material per beam element.
    """
    meta_el = doc_pre.metaDataElementProperty(
        'beam_column_elements.ElasticTimoshenkoBeam')
    xobj_el = MpcXObject.createInstanceOf(meta_el)
    xobj_el.getAttribute('transfType').String = 'PDelta'
    xobj_el.getAttribute('-mass').boolean = True
    xobj_el.getAttribute('-cMass').boolean = True
    xobj_el.getAttribute('massDens').quantityScalar.value = beam_w
    # make the element
    prop_el = MpcElementProperty()
    prop_el.id = doc_pre.elementProperties.getlastkey(0) + 1
    prop_el.name = 'Beam_' + str(i_beam)
    prop_el.XObject = xobj_el
    # add it to the document
    doc_pre.addElementProperty(prop_el)
    doc_pre.commitChanges()
    doc_pre.dirty = True
    prop_el.commitXObjectChanges()
Stavros

Re: Adjusting transformation type with scripting

Posted: Fri Mar 15, 2024 1:47 pm
by STKO Team
in line:

Code: Select all

xobj_el.getAttribute('transfType').String = 'PDelta'
the .String property does not exits.
it is .string (without the capital S)

Re: Adjusting transformation type with scripting

Posted: Thu Mar 21, 2024 10:06 am
by StavrosP
Thanks! On top of that in the command reported above I had a typo in the transfType. That should be transType. So:

Code: Select all

xobj_el.getAttribute('transType').string = 'PDelta'

Re: Adjusting transformation type with scripting

Posted: Sat Mar 23, 2024 3:49 pm
by kesavapraba
Glad that you fixed the issue.