We’re updating our badges platform. Badge issuance is temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Select faces that aren’t touching anything with Script Editor?

    • angmyto
      Subscriber

      My geometry has four layers and i only want to select the outer, exposed faces of one layer and apply a thermal condition to it. The area is wouldn't be a consistent value so I want it to be able to choose all faces of this layer that is exposed, but I wasn't sure how to do that. Right now I have all the faces of that specific component selected as an IFaceSelection

    • NickFL
      Subscriber

      It sounds like you already have these in a selection (I have assumed this selection is called sel). From there you could do something like this:

      span = [] # Creates empty List
      for face in sel.Faces:
         # finds the outer diameter of each face and adds to span
         span.append(face.Shape.BoxUV.RangeU.Span)

      # Use zip to combine together into one
      zippy = zip(sel.Faces, span)
      # Reorders based on size of D (largest first)
      sorted(zippy, key=lambda x: x[1])

      # Now go thru zippy
      for i in range(len(zippy)):
         face = FaceSelection.Create(zippy[i][0])
         # Create a Named Selection based on the face
         NamedSelection.Create(face, Selection.Empty())
         NamedSelection.Rename(“Gruppe1”, “ring_{0}”.format(i))

      • angmyto
        Subscriber

        When I try this it'll create multiple named selections and doesn't group them by similar faces. Possibly because there are different shapes and some faces are also curved? 

        • NickFL
          Subscriber

          This script takes the selection, assumed to be the four circle/annular faces you have in the picture. It then puts each of them in a named selection with ring_0 being the outermost one, ring_1 being the one with the second largest diameter, etc.

          I guess I am confused by what you mean by similar faces. How do you want them grouped if not by diameter? (You said the outer one, so ring_0).

          Note I am using the German version, so on the last line Gruppe1 might be Group1 in the English version. Other languages would also likely be different.

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