We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Error running a DesignModeler script (*.js)?

    • e.bakhtyary
      Subscriber

      Hi,
      I'm a newbie to DM scripting. I'm doing an optimization project over a blade and need to update the computational domain in a specified interval. Only one single curve (the blade profile) must be re-imported from a new coordinate file.
      As far as I know, I only need to put this line in a free *.js file:

      agb.Regen();

      However, when I ran the file, I got this error:

      What should I do?

      Any ideas would be greatly appreciated.

      (Note: SpaceClaim is not gonna work for me, because I'm meshing in 2D, and SpaceClaim doesn't preserve the blade curve when it sends the geometry to the Ansys Meshing, so the mesh cannot capture the curvature appropriately)

    • Gary Stofan
      Ansys Employee

      It looks as if the .js file was not editied in an ASCII Text editor. 
      Try creating a new .js file using Notepad.

    • e.bakhtyary
      Subscriber

      Thanks, it worked!

      But I have another question. I would greatly appreciate it if you help me.

      During my optimization, a 3D curve must be updated, and then, the whole geometry must be regenerated. 

      I mean, how could I turn "Refresh" into "Yes" in js file:

      All the best

    • Gary Stofan
      Ansys Employee
       
      You have to select the node first. The following example is an Import feature, but may work for Curve
       
      Jscript:
       
       
      var NodeName = "Import1"; // Name of the import feature
       
      // Loop through the existing features and select the required one
      var count = ag.fm.FeatureCount;
      for (var i =0; i < count; i++) {
       
          var current = ag.fm.feature(i);
          var Name = current.Name;
       
          if (Name.toLowerCase() == NodeName.toLowerCase()) { // found the match
      current.Refresh = 1; // Refresh the Geometry
      break;
          }
      }
      agb.regen();
       

       

    • e.bakhtyary
      Subscriber

      Thank you so much for your time.

      All the best.

Viewing 4 reply threads
  • The topic ‘Error running a DesignModeler script (*.js)?’ is closed to new replies.