3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Getting Mesh Faces With Specified Normal Via SpaceClaim Scripting (V241)

    • jacob.lurvey
      Subscriber

      Hi All,

      I'm struggling with performing what I think should be a relatively simple task. I have an .STL geometry that I import into SpaceClaim as facets, and I want to keep it that way for eventual import into Fluent Mesher as an .scdoc. It is imported already clipped at both ends, so I know the location of the inlet and outlet. I've attached a picture of the geometry.

      What I want to do is to get all the faces on the inlet and outlet (shown highlighted in orange here) and put them in a named selection. Ideally, I would select all faces with the correct normal vector, but any method that will allow me to automate named selections for the inlet and outlet will work.

       The reason I need to automate this is because I want to process a whole load of similar geometries, all of which have known normals for the inlet and outlet facets. However, since I have to call GetRootPart.Meshes[0] instead of GetRootPart.Bodies[0], lots of the methods in the documentation don't seem to work. Is there any way to do this in SpaceClaim scripting?

       

      Thanks for any help you can provide

    • Atharv Joshi
      Forum Moderator
      Hi Jacob, 
       
      Thanks for sharing the details about your problem. 
      Let me check this and get back to you. 
       
      Regards
      Atharv
    • jacob.lurvey
      Subscriber

      I managed to solve the problem using the following code:

      inlet_selection = Selection.Create(
          RayFire.Fire(
              inlet_rayfire_origin,
              inlet_rayfire_direction,
              pixel_size,
              hit_radius
          )[1].GetConnection(0))

      inlet = NamedSelection.Create(inlet_selection, empty_selection, "mass-flow-inlet")

      where inlet_rayfire_origin and inlet_rayfire_direction are a Point and Direction, respectively. Not sure why I have to call RayFire.Fire()[1] instead of [0], but it throws an error otherwise. Any ideas on why? It would be interesting to know. The call to .GetConnection(0) allows me to select all the coplanar facets.

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