We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Spaceclaim API C# – Generate Midsurface

TAGGED: ,

    • Udeep Shah
      Subscriber

      Hi there,

      I am trying to generate the mid surface for a selected body using API.

      But after browsing the library it seems like there is no functionality for that, there is only functionality to get the mid surface of a body that has already been generated (body.GetMidSurfaceAspect()). Am I wrong about this or is there another method to get the midsurface through the API? 

    • Devendra Badgujar
      Forum Moderator

      Hello Udeep, 

      Let me check and get back to you on this. 

      Regards,

      Devendra 

    • Devendra Badgujar
      Forum Moderator

      Hello Udeep, 

      This is only exposed in the scripting API. If you would like this in C#, you will have to rework the logic of this. This might be possible to record using Script recorder in SpaceClaim as shown below:

      options = MidsurfaceOptions()
      options.Group = False

      command = Midsurface(options)
      command.AddMatchingFacePairs(FaceSelection.Create(Face1, Face2))
      result = command.Execute()

      or based on an ionterval

      command.AddFacePairsByRange(Body1, MM(0.91), MM(1.6)

      Regards, 

      Devendra 

    • Udeep Shah
      Subscriber

      Hello Devendra,

      Thanks for the help, I was able to get the mid surface from C# code working. The only issue is that it sometimes generates a different midsurface for certain solids even though the min and max thickness ranges are the same. Is there a way to set the thickness tolerance for the API?

Viewing 3 reply threads
  • The topic ‘Spaceclaim API C# – Generate Midsurface’ is closed to new replies.