Import geometry in SpaceClaim from project schematic

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited November 2023 in Structures

What is the script to run at the project page level that will create a Static Structural component system, and then open SpaceClaim to import a geometry file?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    The following code can be used:

    myTemplate = GetTemplate(TemplateName="Static Structural",Solver="ANSYS")
    mySystem = myTemplate.CreateSystem()
    
    CADfile = r"C:\Users\dummyFolder\dummyGeomFile.igs"
    geometry1 = mySystem.GetContainer(ComponentName="Geometry")
    geometry1.Edit(IsSpaceClaimGeometry=True)
    
    def importFile(fileName):
        myCommand="""DocumentInsert.Execute(r""" + """ + fileName + """ +""")"""
        return myCommand
    
    cmd = importFile(CADfile)
    
    geometry1.SendCommand(Language="Python", Command=cmd)