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.
Preprocessing

Preprocessing

Topics related to geometry, meshing, and CAD.

SPLINE or BSPLIN through more than six keypoints

TAGGED: , ,

    • sjorskremer
      Subscriber

      Hi,

      Does anybody know whether it is possible to create a spline or bsplin through more than 6 keypoints?

      Say i want to make a spline through 12 keypoints. I can make 2 splines, each through 6 keypoints. However, the 2 splines won't align that well at the intersection. In: SPLINE, P1, P2, P3, P4, P5, P6, XV1, YV1, ZV1, XV6, YV6, ZV6 you can define the slope vector, which theoretically means you could align the 2 splines by defining (aligning) the slope vectors. Does anybody know how to retreive the slope vectors from the endpoint of a spline? (I am using PyMAPDL)

      Many thanks!

    • mrife
      Ansys Employee

      Hi sjorskremer

      It's posible by picking the keypoints; the trick is that picking does not have to be an human + MAPDL UI interactive operation.  You can replicate picking by two commands, then issue the spline command with P51x as the first keypoint (indicating to take the last picking list).

      Manually creating a picking list requires the use of 2 APDL commands.  The first is FLST; see it's help here:

      https://ansyshelp.ansys.com/public/account/secured?returnurl=/Views/Secured/corp/v251/en/ans_cmd/Hlp_C_FLST.html

      The other is FITEM; you navigate to it from the help on FLST (the Notes discussion are the bottome of the help page has the link to the FITEM command).

      Then try the command style in MAPDL interactive and review the log file.  To get you started here are the commands to create a spline through 3 keypoints (KPs 1, 2, 3):

      FLST,2,3,3

      FITEM,2,1

      FITEM,2,2

      FITEM,2,3

      SPLINE,P51X

      Once you get the hang of this, then getting the list of KPs and looping through them to issue the fitem command in PyMAPDL is pretty straight forward.  You could wrap it in a function definition if you need to use the logic often.

      Mike 

    • sjorskremer
      Subscriber

      Much appreciated! I notice that this does not work for the BSPLIN command, is that right and is there a method for this command as well? 

    • mrife
      Ansys Employee

      What version are you using and what happens when you try the method with bsplin?

    • sjorskremer
      Subscriber

      ansys.mapdl.core version: 0.68.4

      MAPDL Version: 24.1

      I have the following code:

      mapdl.finish()
      mapdl.clear()
      mapdl.prep7()

      a = 6*np.pi
      n = 20
      x = np.linspace(0, a, n)
      z = np.sin(x)

      for i in range((n)):
          mapdl.k(i+1, x[i], 0, z[i])

      mapdl.flst(2, n, 3)
      for i in range(n):
          mapdl.fitem(2, i+1)

      mapdl.spline('P51X')
      # mapdl.bsplin('P51X')
          
      print(mapdl.llist())
      mapdl.lplot()

      the mapdl.spline command gives back 19 lines (which is expected)

      the mapdl.bspline command give back only 1 line, between keypoints 1 and 2

    • mrife
      Ansys Employee

      MAPDL quirk, the P51X goes in the second field in the bsplin command.  So try mapdl.bsplin(' ', 'P51X')

    • sjorskremer
      Subscriber

      This command terminates the entire mapdl connection, and gives the following new error :) 

       

    • mrife
      Ansys Employee

      Please follow the instructions in the error message and post this to the PyMAPDL GitHub Issues site here: 

      https://github.com/ansys/pymapdl/issues

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