General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

How prevent script abortion

    • Hans Rudolf Lusti
      Subscriber

      Hi there

      I have a bunch of APDL scripts in my Workbench model in the Solution folder that are writing coordinates and stresses to a file for various named selections.

      In the scripts I have the following line:

      cmsel,s,selection_name                  ! Select nodes which are defined in Named Selection

      The problem is that the postprocessing will stop if a selection_name is not found. As a consequence all subsequent postprocessing scripts won't run through either.

      I would like to have it this way. If a selection_name can't be found the corresponding script shall be aborted but the following scripts shall be executed. How can I solve this?

      KR, Hans

    • Chandra Sekaran
      Ansys Employee

      You can use *GET command to get a list of component names and then compare against that list. Something along this line.

      *get,ncomp,comp,,ncomp  ! get number of components in your model

      *dim,names,string,80,ncomp   ! create a string array that can have up to 80 characters

      *do,i,1,ncomp,1

      *get,names(1,i),comp,i,name

      *enddo

      Then in a loop check your component name against this list?

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.