Superelement - combine .dmig files and create /import condensed part

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 741
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

Using scripting, how can I combine .dmig files and use the combined file to create a condensed part?

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 741
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    The below code can be used. Note that CombineTextFiles() method appends the second file to the first file.

    import os
    folder = r"D:\Data_CMS"
    path1 = os.path.join(folder,'NastranKMs3.dmig')
    path2 = os.path.join(folder,'NastranMs3.dmig')
    ExtAPI.DataModel.Project.CombineTextFiles(path1, path2)
     
    condensedGeom = ExtAPI.DataModel.Project.Model.CondensedGeometry
    importCondensedGeom = condensedGeom.AddImportedCondensedPart()
    importCondensedGeom.ImportFileFormat=CondensedPartFileFormat.SuperElement_MATRIX
    importCondensedGeom.CondensedPartFileName = path1
    condensedGeom.GenerateCondensedParts()
    
  • Alan_H_Escamilla
    Alan_H_Escamilla Member Posts: 1
    First Comment

    Does this work if my dmig files are .asm and .pch?

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 741
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member

    @Alan_H_Escamilla I'm not sure what these .asm and .pch format stand for. What we are doing here is basically appending a text file to another text file. If you files are text format I think this should work. The best way to know is for you to try it out. If it doesn't work you can also try to modify the extension of your files to .dmig.