3D Design

3D Design

Topics related to Ansys Discovery and Ansys SpaceClaim.

Skripting: Sweeping with 2 Guidecurves

    • Lukas Bülow
      Subscriber

      Hello everyone,

      I have already created a post in this forum where the topic was addressed. Unfortunately, the post is categorized under "3D-Modelling" and not scripting, so I'm hoping to get an answer to my question here. You can find the link to the old post here:

      https://discoveryforum.ansys.com/t/p8hvzkv

      In short, my problem is to pull a profile along two guide curves that both run parallel. This is not a problem in 3D modeling, but I can't find a command for a second guide curve in scripting. I have also written to support and combed through the SpaceClaim documentation, but unfortunately, I couldn't find anything. Sadly, you also can't capture this command using the "Record" function.

      I hope you can help me! Thank you and best regards.

      Lukas

    • Charudatta Bandgar
      Forum Moderator

      Hello Lukas,

      Let me get back to you.

    • Lukas Bülow
      Subscriber

      I think I’m slowly going crazy…
      I can select different things like connected lines, or multiple faces to pull, but parallel lines or generally two lines that aren’t connected can’t be selected via code.

      selection = FaceSelection.Create([GetRootPart().Bodies[1].Faces[0],
                                                             GetRootPart().Bodies[0].Faces[0]]) 
      trajectories = Selection.Create(GetRootPart().Curves[0],
                                                       GetRootPart().Curves[2])

    • Lukas Bülow
      Subscriber

      After a long time, I have found a solution to this problem myself; the magic word is "Loft". In my case, there is the option to redraw the profile at the location where the endpoint of the body needs to be (which is known), and then use the Loft command to connect the two surfaces with the help of a guide line. The corresponding code then looks as follows:

      selection = FaceSelection.Create([GetRootPart().Faces[0],GetRootPart().Faces[1]])
      
      secondarySelection = Selection.Create(GetRootPart().Curves[0])
      
      options = LoftOptions()
      
      options.GeometryCommandOptions = GeometryCommandOptions()
      
      result = Loft.CreateCenterLine(selection, secondarySelection, options)
Viewing 3 reply threads
  • The topic ‘Skripting: Sweeping with 2 Guidecurves’ is closed to new replies.