3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

ANSYS SpaceClaim 2019 R2- Geometry scripting Using Python

    • Thamizh
      Subscriber

      Hi Team,


                 I was trying to automate the design by using the python scripting.I'm creating python script by recording the steps but it contains smart script variables. so that was not easy to use again.So I did like to create it using interface ICollection variables.How to generate the custom script by recording.Kindly help me.


      Regards,


      Thamizh

    • PratapBakke1984
      Subscriber

      Hi Thamizh,


      SpaceClaim(SC) scripting is based on IronPython. If you don't know IronPython, you can use smart variables in program. Using smart variables is also a best way at the moment. The only problem with smart variables is that, you need to use smart variables for all possible combination of input parameters. You need to run geometry again and again with already recorded SC script for all possible combination of input parameters one by one, and insert smart variables in script under that combination of input parameters (use if- else) by clicking on geometry(curve or face or solid). So, you will be creating script step by step considering all possible combination of input parameters. Start with selection of correct sketch plane by recording, and then go ahead with recording each geometry operation. Use 'if-else' for creating different possible combination of input parameters conditions. Use 'while' for loop operations.


      If you are interested in just automating SC geometry, then you only need to think about all possible combination of input parameters.


      If you are interested in SC geometry update and linking this updated geometry to Mechanical, then you also need to think about 'Named selections' creation for all possible combination of input parameters. Because your SC geometry is linked to Mechanical - contacts, mesh, loads etc by 'Named selections' only.


      You can download sample script from this link. In this script, they have used smart variables for automating geometry.


      You can also follow IronPython syntax given in this web page.


      I hope this will help you to start automating your model.


      Thanks & Regards,


      Pratap Bakke


       

Viewing 1 reply thread
  • The topic ‘ANSYS SpaceClaim 2019 R2- Geometry scripting Using Python’ is closed to new replies.