Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Easy way to “reverse” midsurface and convert surface with thickness to solid.

    • mscal
      Subscriber

      Suppose I have a planar surface body with a thickness assigned to it.  Is there an easy way to convert it to a solid with the same thickness?  I know I can do a double-sided pull, but that must be done manually as I understand it.  My surface body is the result of a midsurface opertation on a thin solid body, but the solid which is suppressed from the Midsurface operation has been deleted and cannot be retrieved. Thank you.

    • peteroznewman
      Subscriber

      You know you can manually do a double-sided Pull to get the solid back.  What is the problem with doing that?

      • mscal
        Subscriber

        I have several hundred such surfaces in my model.  Surely you can understand why pulling each and every one of them is undesireable. And since midsurface can batch transform solids to surfaces, it stands to reason that there might be a tool for doing the opposite when a surface has a shell thickness assinged.  Right?

    • NickFL
      Subscriber

      Yes, as you say, you can do a double-sided pull. If you had lots of these and were trying to find and pull them all, you could write a Python script to automate the process. You could even extend the script so that it could be activated with a mouse click. However, without knowing your model, it is difficult to say what is best. A sample script is something like:

      # Python Script, API Version = V23
      thickness = 1.0 # in mm

      bodies = GetRootPart().GetAllBodies() # Gets all the bodies
      for body in bodies:
      if body.Shape.Volume == 0.0: # if volume is 0 then surface body
      selection = FaceSelection.Create(body.Faces[0])
      options = ThickenFaceOptions()
      options.PullSymmetric = True
      result = ThickenFaces.Execute(selection, Direction.DirZ, MM(thickness), options)

       

      • mscal
        Subscriber

        Wow, thank you!  After I posted my question last week, I messed around for a few hours trying to figure out a way to implement via scripting, but was not able to make much headway.  However your example above gave me enough to bring it the rest of the way home.

        # First loop to delete interior edges/partitions, remnant from shared top, so every body is one face
        bodies = GetRootPart().GetAllBodies()
        for body in bodies:
            if body.Shape.Volume == 0.0:
                if len(body.Faces) > 1:
                    for edge in body.Edges:
                        try:
                            edge.Delete()
                        except:
                            pass
        # Loop again to execute the pull
        bodies = GetRootPart().GetAllBodies()
        for body in bodies:
            if body.Shape.Volume == 0.0:
                for face in body.Faces:
                    midsurf = body.GetMidSurfaceAspect()
                    # Must divide by 2 bc scripting doesn't account for the double sided pull
                    # How is GetThickness() different from TryGetFaceThickness() ??
                    thick = (midsurf.GetThickness()) / 2
                    selection = FaceSelection.Create(face)
                    options = ThickenFaceOptions()
                    options.PullSymmetric = True
                    options.KeepLayoutSurfaces = True
                    options.ExtrudeType = ExtrudeType.ForceIndependent # No merge
                    result = ThickenFaces.Execute(selection, Direction.DirZ, M(thick), options)

         

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]