How to run Space Claim script by pyMechanical

wanghao
wanghao Member Posts: 27
10 Comments 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