Import geometry in SpaceClaim from project schematic

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 810
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
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: 810
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    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)