General Mechanical

General Mechanical

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

Change Inflation Mesh via PyMechanical

    • Tobias Zeller

      Hey everyone,

      I am trying to control the inflation layer on a mesh via a python script and got two problems.
      My current code looks like this:

      Rotor_Inflation = mesh.AddInflation()
      Rotor_Inflation.ScopingMethod = GeometryDefineByType.Component
      Rotor_Inflation.NamedSelection = ExtAPI.DataModel.GetObjectsByName("Rotor_Face")[0]
      Rotor_Inflation.InflationOption = 1
      Rotor_Inflation.FirstLayerHeight = Quantity(0.4, "mm")
      Rotor_Inflation.MaximumLayers = 15
      Rotor_Inflation.NamedSelection = ExtAPI.DataModel.GetObjectsByName("Rotor_Aussenkante")[0]
      Rotor_Inflation.Name = r"""Rotor_Inflation"""

      I try to address everything via NameSelection, since I have already defined them in advance.
      Now I have the first issue that in the second line "Rotor_Inflation.ScopingMethod = GeometryDefineByType.Component" I get the following output:
      "Typenkonflikt. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"
      I would like to know if "Component" is wrong here or what else I should use?

      My second question is, how do I change the "Boundary Scoping Method" as right now I'm using two times the same code (Line 3 and 7) and this is not working as well?

      Hope someone can help me out.
      Best regards.


    • Nilay Pedram

      PyAnsys is currently a set of open-source projects . Questions on PyAnsys should go through the Developer Forum.  Bug reports can be made by creating 'Issues' in GitHub.

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