Reload the Work Tree items

Post Reply
cjh971111
Posts: 2
Joined: Fri Jun 28, 2024 1:12 am

Reload the Work Tree items

Post by cjh971111 » Thu Jul 11, 2024 7:12 am

Dear STKO Support Team,

I would like to ask about how to reload the work tree items.

For example, if I create Analysis Steps using PyMpc as follows:

# Main Analysis
meta = doc.metaDataAnalysisStep('Analyses.AnalysesCommand')
xobj = MpcXObject.createInstanceOf(meta)
xobj.getAttribute('analysisType').string = 'Transient'
xobj.getAttribute('constraints').string = 'Transformation Method'
xobj.getAttribute('algorithm').string = 'Krylov-Newton'
xobj.getAttribute('transientIntegrators').string = 'TRBDF2'
xobj.getAttribute('numIncr').integer = 1000
xobj.getAttribute('duration/transient').real = 1
anly = MpcAnalysisStep()
anly.id = 41
anly.name = 'Main analysis'
anly.XObject = xobj
doc.addAnalysisStep(anly)

I already have set the 'analysisType' as 'Transient', but in STKO there are still 'staticIntegrators (load control)' activated.
So, when I run the analysis it doesn't run as transientIntegrator "TRBDF2".

And I found that I need to manually set the 'analysisType' from 'static' to 'transient' again for the 'staticIntegrators' to disappear and the 'transientIntegrators' to appear.

Is there any way to handle this problem?

Thank you,
CJH

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

Re: Reload the Work Tree items

Post by STKO Team » Wed Jul 17, 2024 8:29 am

Once you modify the Xobject and set it to the AnalsyisStep (or any other object, like Physical Property, Conditions, etc..), call the commitXObjectChanges method:

Code: Select all

anly.XObject = xobj
anly.commitXObjectChanges()
It performs some operation in the background, as hiding/showing some attributes based on other attribute values

Post Reply