How to inspect properties of objects in AEDT modeler in a script

Ansys Staff
Ansys Staff Member, Employee Posts: 24
Ansys Employee Name Dropper First Comment Photogenic
✭✭✭✭

I would like to query properties of objects in a Ansys Electronic Desktop design with a script. Say I have created a new relative coordinate system, how can I query the values of e.g. the origin X, Y, and Z values?

enter image description here

Tagged:

Answers

  • Ansys Staff
    Ansys Staff Member Posts: 29
    10 Comments
    Answer ✓

    Inspecting properties with a script in AEDT is a beta option, so you have to enable it first. To do that go to Tools > Options > General Options. Then go to General > Desktop Configuration > Beta Options and tick the box next to "Object Oriented Property Scripting".

    enter image description here

    Now, start a new command line window with Tools > Open Command Window.

    >>> project = oDesktop.GetActiveProject()
    >>> design = project.GetActiveDesign()
    >>> editor = design.SetActiveEditor("3D Modeler")
    >>> editor.GetChildTypes()
    ['ModelParts', 'AllParts', 'NonModelParts', 'CoordinateSystems', 'Points', 'Planes', 'SubmodelDefinitions', 'Groups', 'Lists', 'UserDefinedModels']
    >>> editor.GetChildNames('CoordinateSystems')
    ['Global', 'RelativeCS1']
    >>> rel = editor.GetChildObject('RelativeCS1')
    >>> rel.GetPropNames()
    ['Type', 'Name', 'Reference CS', 'Reference CS/Choices', 'Mode', 'Mode/Choices', 'Origin', 'Origin/X', 'Origin/Y', 'Origin/Z', 'X Axis', 'X Axis/X', 'X Axis/Y', 'X Axis/Z', 'Y Point', 'Y Point/X', 'Y Point/Y', 'Y Point/Z']
    >>> rel.GetPropValue('Origin')
    ['X:=', '-0.6mm', 'Y:=', '-0.6mm', 'Z:=', '0mm']
    >>> rel.GetPropValue('Origin/x')
    '-0.6mm'