How to add a model in standalone Mechanical ?

Member, Moderator, Employee Posts: 311
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited January 12 in Structures

We want to add via script say a cdb file to a standalone mechanical (Mechanical 2024 R2)?

Best Answer

  • Member, Moderator, Employee Posts: 311
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited January 12 Answer ✓

    Below is an example on how it can be done via mechanical scripting in a new Mechanical standalone session (with the Start a New Mechanical Project option to get started).

    1. mimp=Model.GeometryImportGroup.AddModelImport()
    2. mimp.ModelImportSourceFilePath='D:\\DATA\\filecdb.cdb'
    3. mimp.Import()
    4.  

    And if needed in/for 2D analysis add the below before importing (mimp.Import()):

    1. mimp.AnalysisTypeDimensionSetting=AnalysisTypeDimensionEnum.TwoD
    2.  

    To control/define the imported cdb file units before importing (say for NMM consistent units):

    mimp.UnitSystemTypeForImport=ModelImportUnitSystemType.UnitSystemConsistentNMM

This discussion has been closed.