Author Topic: Spiraling out of control. Help needed.take a look  (Read 2277 times)

0 Members and 1 Guest are viewing this topic.

Zahex

  • Guest
Spiraling out of control. Help needed.take a look
« on: May 09, 2005, 01:39:25 PM »
Helo:

I would really appreciate someone's help on this,here it goes:
Do you know if it's possible to draw a solid in autocad such as a pyramid/cone only the
object doesn't end in a vertex as usual,the top radius is not zero but can be defined by
the user creating something like a distort prismatic solid.There's a command in autocad
called solids in the draw bar.
After the user defines the top and base radius ,
the height of the "pyramid" and the number of segments that define both bases(top and base)
i would like the user to be able to create a spiral revolving arround the solid.
the idea is to attach this code to the solid that the user would define first.
Then the user could define how many spirals and how many turns they would give arround the solid.
What do you think?

Thank you for your help


here's the code:
 
Code: [Select]

(alert "to initiate type spiral")
(defun C:spiral()
(command "erase" "all" "")


(command "osnap" "off")
(command "ortho" "off")
(command "ucsicon" "off")


  (setq
    segs (getreal "Number of segments: ")
    spin -1
    ri (getreal "Base radius: ")
    rf (getreal "Top radius: ")
    rt (getreal "Extrusion radius: "));setq
  (setq h (getreal "Elevation: "))
  (setq ns (getreal "Number of spirals: "))
  (setq
    tu (getreal "Turns: ")
    old (getvar "osmode")
    fi1 (/ (* 2 PI) segs)
    i 0
    points (fix (* tu segs))
    h1 (/ h points)
    r1 (/ (- rf ri) points)
    s (getpoint "Center of base: ")
    end (list (car s) (cadr s) (+ h (caddr s))));setq


  (setvar "osmode" 0 )
(command "line" s end "")
(command "chprop" "l" "" "c" 1 "")
(command "3dpoly")
  (setq i 0)
  (repeat (1+ points)
    (setq
      fi (* i fi1)
      h (* i h1)
      r (+ ri (* i r1))
      x (* r (cos fi))
      y (* spin r (sin fi)));setq
(command (list (+ (car s) x) (+ (cadr s) y) (+ (caddr s) h)))
    (setq i (1+ i)));repeat
(command "")
  (setvar "osmode" old)
  (setq spiral (entlast))
(command "ucs" "n" "za" (polar s 0 ri)
    (list
      (+(car s) (* ri (cos fi1)))
      (+(cadr s) (* spin ri (sin fi1)))h1))
 
 
(command "circle" "0,0,0" rt)
(command "extrude" (entlast) "" "p" spiral)
  (setvar "osmode" old)  
(command "ucs" "p")
 

(command "array" (entlast) "" "p" s ns 360 "y")
(command "view" "swiso")
(command "_zoom" "e")
(command "shademode" "g")
); defun

daron

  • Guest
Spiraling out of control. Help needed.take a look
« Reply #1 on: May 09, 2005, 03:19:44 PM »
Welcome Zahex. I altered the title of this thread. You wouldn't believe how many threads would start as Help needed... if we didn't monitor that. Would get hard real quick to do a search or remember which thread any user has a particular intrest in to help. Also, when creating a thread or post, you'll notice the little buttons with words like quote or code in them. It is a great help to everybody else if you'd use them. I edited that for you too. Hope to see your continued threads here. As far as offering help on this thread, I haven't had a chance to look at it much. I'm sure there are others here who could offer a hand though.

Zahex

  • Guest
Spiraling out of control. Help needed.take a look
« Reply #2 on: May 09, 2005, 04:28:32 PM »
thanks for your help

CADaver

  • Guest
Spiraling out of control. Help needed.take a look
« Reply #3 on: May 09, 2005, 05:27:06 PM »
true spirals have long been sought after in autocad.  much to my dismay, through r2002, true spirals are not possible.  There are however several excellent spiral lisp routines available that can provide a facsimile or approximation of a spiral.

There's one HERE and another HERE

And CAB's fine offering HERE

CADaver

  • Guest
Spiraling out of control. Help needed.take a look
« Reply #4 on: May 10, 2005, 11:47:46 AM »
And then there's THIS.  I forgot all about this one, until Daron posted the link in the other thread.