General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Ansys Motion – Imported Python Expression Not Defined

    • 21642478
      Subscriber

      Hi,

      I have been using custom imported python functions in the Ansys Motion Preprocessor, but I started getting problems with the software 'forgetting' that it knew the function from the python script that I imported after having used it previously in that simulation. The function used to work fine, then eventually is started giving the error: "* EXPRESSION :: Smooth_Ramp => SmoothRamp06.RampSmooth(TIME, 1.0, 31.0, 0.0, 19) name 'SmoothRamp06' is not defined" when changing the input parameters or when writing a new function expression in Motion. Previously I fixed this by changing the path to the imported python script to the copy of the script created in the subsystem file root folder and then it worked again, but now that fix does not work anymore. The most confusing part is that 

      Is there something I'm missing as to how to prevent this?

      I will include a picture of the error window and the ouputted error message:

      Kind regards,

      HC Janse van Vuuren

    • Ankush Choudhary
      Ansys Employee

      Hi Hendrik,

      Which Ansys version are you using?

    • 21642478
      Subscriber

      Hi,

      2024R1

    • Vishnu
      Ansys Employee

      When you have referred a python file path in your python code object ,the python file is copied to your working directory like below

      image

      One test  is check if the python file exist in the working directory

       

      and check if the solver file refers the path right like below:

      Export XML file (DFSXML) and 

      image

      check for the python code path in the file

      image

      My suspicion is there could be some copy rights violations going on and its not able to find that python file from path.

      Also check if path is something abnormal (Too long, or some special charecters and so on)

Viewing 3 reply threads
  • The topic ‘Ansys Motion – Imported Python Expression Not Defined’ is closed to new replies.