3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Spaceclaim script fills RAM

TAGGED: 

    • Laurens
      Subscriber


      I have a Spaceclaim script that applies certain operations to a relative complex CAD model. We have to do perform the script 10000 times which go's through some for loops with different ranges to apply every time a different operation.

      We load the model and save it as an intermediate file to which we do the operations because we noticed that when the script increases one step and imports the base file, the performed previous operations are already in the file.

      Script roughly works as follows:

      1. We import the base file
      2. Save the file as an intermediatefile
      3. Do operations
      4. Save the properties in a textfiles of the modified model
      5. close the document
      6. delete file from disc
      7. Start from step 1, with the for loop 1 step further do create a slightly different operation setting.

      Problem: The RAM memory fills up and we can only do 100 to 200 runs, we have approximately 128GB memory in our machines.

      Code:

             importOptions = ImportOptions.Create()

                     DocumentOpen.Execute(dir + model_file + ".scdoc", importOptions)

                      # EndBlock


                     #Save model in intermediate file

                     options = ExportOptions.Create()

                     DocumentSave.Execute(dir + interm_model_file + str(count) + ".scdoc", options)


      !!! apply operations to model!!!!


                     # remove object

                     DocumentHelper.CloseDocument()


                     # EndBlock

                     os.remove(dir + interm_model_file + str(count) + ".scdoc")


                     gc.collect()

    • Aniket
      Forum Moderator
      So are you using this script only to create different SpaceClaim geometries only? I mean are you not proceeding further for mesh, solution or postprocessing?
      -Aniket
      How to access Ansys help links
      Guidelines for Posting on Ansys Learning Forum
    • Laurens
      Subscriber
      No only:
      cutting the geometry.
      Hide geometry which is above a certain z-coordinate
      Measure the volume and centre of volume.
      Writing those properties to a text file
Viewing 2 reply threads
  • The topic ‘Spaceclaim script fills RAM’ is closed to new replies.