How to run already exesisting SpaceClaim script using PyGeometry
Hi,
I have developed a script in SpaceClaim to clean the imported CAD and create additional bodies based on inputs.
Now I want to perform the same using PyGeometry, can I directly pass the SpaceClaim script from PyAnsys to Spaceclaim somthing like below (used to do it for Ansys ACT)
geometry1.RunScript(ScriptFile = SCScript, GeometryContainer = "Geometry",useAsMacro = "false")
Just for undaerstanding can you help me in executing following SC script using PyGeometry
#Creating a cylinder def create_cyl(z1,h,d): r = d/2 result = CylinderBody.Create(Point.Create(0, 0, z1), Point.Create(0, 0, h+z1), Point.Create(r, 0, h+z1), ExtrudeType.ForceIndependent) return cyl1 = create_cyl(10,5,5)
Regards,
Suneel
Answers
-
Hi,
I found out the way to run exesisting SC sript via PyAnsys, following is the codefrom ansys.geometry.core import launch_modeler modeler = launch_modeler("spaceclaim") output = modeler.run_discovery_script_file(path = ".py file location")
The above code is working fine but I have some additional question on the approach
1. What is the best way to run (run the exesisting SC script from file like above). I feel error handling will be defficult
2. Is it good to create/generage/modify the geometry using PyAnsysRegards,
Suneel0