Author Topic: align a profile from one end of a spline to the other?  (Read 1800 times)

0 Members and 1 Guest are viewing this topic.

Bob Q

  • Guest
align a profile from one end of a spline to the other?
« on: January 03, 2012, 03:49:45 PM »
I have been working with trying to create solids by sweeping a profile along lines, arcs, splines etc.
The standard sweep command works o.k. once you get past the new format in AC2012, canceling the align option etc.
But then on Splines of order 4 non rational, non-planer, non-periodic the sweep command no longer works.
But I have found that the Loft command will work, but then you need a copy of the profile on the opposite end of the spline aligned perpendiculat to the spline.

This is not easy to do so far as I can tell.
Does anyone have a way to do this programatically by any chance?
I attached a screen shot and dwg of what I need to be able to do.
Thanks!

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Re: align a profile from one end of a spline to the other?
« Reply #1 on: January 04, 2012, 07:08:31 AM »
try this

Code: [Select]
(defun c:test (/ os obj guide L_guide p1 p2 p3 p3a p4)
    (setq os (getvar "osmode"))
    (setq obj (car (entsel "\nSelect object to mirror ")))
    (setq guide (car (entsel "\nSelect guide profile")))
    (setq L_guide (vlax-curve-getDistAtParam guide (vlax-curve-getEndParam guide)))  
    (setq p1 (trans (vlax-curve-getStartPoint guide) 0 1)
          p2 (trans (vlax-curve-getEndPoint guide) 0 1)
          p3 (trans (vlax-curve-getPointAtDist guide (/ L_guide 2)) 0 1)
  p3a (trans p3 1 0)
    )
    (setvar "osmode" 0)
    (command "_UCS" "3" p1 p2 p3)
    (setq p3a (trans p3a 0 1)
  p4 (list (car p3a) (+ (cadr p3a) 1.0))
    )
    (command "_mirror" obj "" p3a p4 "_N")
    (command "_UCS" "_P")
    (setvar "osmode" os)
)

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: align a profile from one end of a spline to the other?
« Reply #2 on: January 04, 2012, 03:13:25 PM »
Welcome to the forum GP, nice to see you here  :-)

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Re: align a profile from one end of a spline to the other?
« Reply #3 on: January 04, 2012, 04:04:47 PM »
Thanks Lee, I try to follow the forum where there are "monsters" of talent like you.

There is always something to learn. :-)

Bob Q

  • Guest
Re: align a profile from one end of a spline to the other?
« Reply #4 on: January 04, 2012, 04:19:15 PM »
Thanks GP!

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: align a profile from one end of a spline to the other?
« Reply #5 on: January 04, 2012, 04:23:59 PM »
Thanks Lee, I try to follow the forum where there are "monsters" of talent like you.

Thanks, I'm flattered - there are indeed some very clever folks here, I still learn a great deal myself   :-)