• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. AWR Design Environment
  3. Python/COM API: how to set per-shape mesh properties (Shape...

Stats

  • State Not Answered
  • Replies 1
  • Subscribers 19
  • Views 318
  • Members are here 0

Python/COM API: how to set per-shape mesh properties (Shape Properties > Mesh) on EM structure shapes?

PV202506039514
PV202506039514 9 days ago

Environment: AWR Design Environment 25.1 (19.06 19490 Rev1 (3aeb16807023df9f129c5ecef6cf132c7bd192ac)), AXIEM simulator, pyawr 24.1.1, Python 3.12, Windows 11.

Goal. From a Python script (pyawr/COM), clear "Use doc default" and set a lower mesh density on a few specific shapes of an EM structure — what the GUI does in Shape Properties > Mesh. We do this on large ground-flood polygons so they do not dominate the AXIEM mesh, and we would like it fully scripted (no GUI automation).

What we tried (minimal runnable script attached, shape_mesh_api_minimal_example.py; it creates and removes its own throwaway EM structure):

  • Enumerating DrawingObject.Attributes on a freshly drawn shape: only the 11 generic attributes (LineType, LayerName, ...) are present — no Mesh_* entries.

  • Attributes.Item() keyed by the documented mwShapeMeshOptionAttributes enum values (mwMOA_MeshUseDefault = 0, mwMOA_MeshDensity = 3): the lookup is positional, index 0 raises "Index too small" and index 3 returns LayerMapping.

  • Attributes.Item('Mesh_UseDefault') / ('Mesh_MeshDensity') by name: "Index too large" (key not found).

  • Attributes exposes no Add method (confirmed via IDispatch::GetIDsOfNames).

  • Update(), selecting the shape, opening a layout window, and CreateMesh() do not make the attributes appear.

  • ExportEmInputDataXML shows per-shape MeshIndex entries, but ImportEmInputData discards edits to MESH_OPTIONS/MeshIndex.

  • Copying a shape that already has a mesh override into another structure (DrawingObjects.AddShape, clipboard paste) loses the override.

Observation. Once the Shape Properties > Mesh dialog has been OK'd once in the GUI, the very same Attributes collection exposes Mesh_UseDefault, Mesh_MeshDensity, etc. as ordinary read/write attributes — so the API can edit the per-shape mesh record, but we found no API call that creates it. The mwShapeMeshOptionAttributes enum is documented in the API reference, but no calling function is listed for it.

Workaround we currently use (works, but clearly unsupported): EMStructure.Export() the document to a .eml file, splice the per-polygon K_EM_MeshOpt sub-record into the binary file, and EMStructures.Import() it back. After that the Mesh_* attributes exist and behave normally over COM. We would prefer not to depend on an undocumented file format.

Questions:

  1. Is there a supported COM/Python API way to create/set the per-shape mesh options (equivalent to Shape Properties > Mesh with "Use doc default" cleared) in AWR DE 19.x?

  2. If not, has this been added in a newer release?

Happy to provide more detail; the attached script reproduces everything above against an empty project.

Disclosure: the API testing and this post were co-implemented with Claude Fable (Anthropic's AI coding assistant); all results were verified against a live AWR session.


shape_mesh_api_minimal_example.zip

  • Cancel
  • Sign in to reply
Parents
  • OscPn
    0 OscPn 4 days ago
    As far as the documented AWRDE COM/Python APIs show, there is no supported API to create a per-shape mesh override.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • OscPn
    0 OscPn 4 days ago
    As far as the documented AWRDE COM/Python APIs show, there is no supported API to create a per-shape mesh override.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information