Adjusting transformation type with scripting

Post Reply
StavrosP
Posts: 25
Joined: Sat Oct 22, 2022 2:48 pm

Adjusting transformation type with scripting

Post by StavrosP » Fri Mar 08, 2024 8:54 am

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

STKO Team
Posts: 3066
Joined: Tue Oct 29, 2019 8:45 am

Re: Adjusting transformation type with scripting

Post by STKO Team » Fri Mar 15, 2024 1:47 pm

in line:

Code: Select all

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

StavrosP
Posts: 25
Joined: Sat Oct 22, 2022 2:48 pm

Re: Adjusting transformation type with scripting

Post by StavrosP » Thu Mar 21, 2024 10:06 am

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'

kesavapraba
Posts: 468
Joined: Sat Mar 28, 2020 2:25 pm

Re: Adjusting transformation type with scripting

Post by kesavapraba » Sat Mar 23, 2024 3:49 pm

Glad that you fixed the issue.
:: With best wishes ::
Prabakaran Kesavan

Post Reply