How to run Space Claim script by pyMechanical

Options
wanghao
wanghao Member Posts: 23
First Comment Name Dropper

Hi,

I've record some script by Space Claim for creating an easy model.
The script is like below

# Python Script, API Version = V22

# Sketch Circle
plane = Plane.PlaneZX
result = ViewHelper.SetSketchPlane(plane)
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(25))

baseSel = SelectionPoint.Create(CurvePoint1)
targetSel = SelectionPoint.Create(DatumPoint1)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Solidify Sketch
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info1)
# EndBlock

# Extrude 1 Face
selection = Face1
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, MM(200), options, Info2)
# EndBlock

Is there any way that could run the script by using pyMechanical?

mechanical = pymechanical.launch_mechanical
mechanical.run_python_script(xxxxxx)

Can I fulfill mechanical.run_python_script with the space claim script content?
My Ansys running environment is in Linux and version 2023 R1.

Comments

  • Aria
    Aria Member, Employee Posts: 65
    First Anniversary Ansys Employee First Answer Name Dropper
    Options

    hello @wanghao

    spaceclaim/discovery are not natively supported in linux, only windows. your best bet would be to investigate pyGeometry which can run headless on Linux. however, it still requires a license to run discovery/spaceclaim.
    https://geometry.docs.pyansys.com/version/stable/getting_started/faq.html
    moreover, i believe the lowest version which pyGeomtry supports is 2023 r2.

  • wanghao
    wanghao Member Posts: 23
    First Comment Name Dropper
    Options

    Hi @Aria
    Thanks for those information! I will check the pyGeometry then.