+ Reply to Thread
Results 1 to 5 of 5

Thread: Curved Cone

  1. #1
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,543

    Default Curved Cone

    Registered forum members do not see this ad.



    I vas unable to make it perfect; there are small geometrical errors at the joint of the different segments. Save your work before to start this routine, especially if you asked for a very smooth solid!
    On computers with limited resources, you may (try) to increase the speed:
    - set the SHADEMODE to 2D wireframe
    - use the PLAN command before you start
    - don't zoom/pan during the lisp works
    Code:
    ; Draw a solid curved cone
    ; mfuccaro@hotmail.com
    ; _____________ Apr. 2004 ____
    ;
    (defun c:CUCONE(/ arc arc_cen arc_rad arc_ang1 arc_ang2 ang0
             r1 r2 r0 r rr ; radiuses for the cross_section
             ct pts a b o_snap solid
             p p1 p2
             xmin xmax ymin ymax zmin zmax ;bounding box
             k i j) ;Used as index
      
      (setvar "cmdecho" 0)
      (command "undo" "begin")
      (setq arc (entget (car (entsel "\nselect arc  ")))
        arc_cen (cdr (assoc 10 arc))
        arc_rad (cdr (assoc 40 arc))
        arc_ang1 (cdr (assoc 50 arc))
        arc_ang2 (cdr (assoc 51 arc))
        ang0 (/ (- arc_ang2 arc_ang1) (getvar "surftab1"))
        r1 (getdist "  end radius ")
        r2 (getdist "  start radius ")
        r0 (/ (- r2 r1) (* 1.0 (getvar "surftab1"))))
      (if (<= (* r1 r2) 0) (progn
                 (alert "radius must be positive, non zero!")
                 (quit)))
      (setq ct (cons (+ arc_rad (car arc_cen)) (cdr arc_cen))
        pts nil
        r (- r1 r0)
        a (- arc_ang1 ang0)
        b (/ (* 2 pi) (getvar "surftab2"))
        o_snap (getvar "osmode")
        solid (ssadd))
      
      (repeat (1+ (getvar "surftab1"))
        (setq i 0
          r (+ r r0)
          a (+ a ang0))
        
        (repeat (1+ (getvar "surftab2"))
          (setq p (polar ct (- (/ PI 2) (* (setq i (1+ i)) b)) r)
            p1 (list (car p) (cadr ct) (+ (caddr ct) (- (cadr p) (cadr ct))))
            rr (- (car p1) (car arc_cen))
            p2 (list (+ (car arc_cen) (* rr (cos a)))
                 (+ (cadr arc_cen) (* rr (sin a)))
                 (caddr p1))
            pts (cons p2 pts)))
        (setq pts (cons (polar arc_cen a arc_rad) pts))
        )
      (setq xmin (apply 'min (mapcar 'car pts))
        xmax (apply 'max (mapcar 'car pts))
        ymin (apply 'min (mapcar 'cadr pts))
        ymax (apply 'max (mapcar 'cadr pts))
        zmin (apply 'min (mapcar 'caddr pts))
        zmax (apply 'max (mapcar 'caddr pts)))
      (command "zoom" "w" (list xmin ymin) (list xmax ymax))
      (setq i 0)
      (repeat (getvar "surftab1")
        (setq j (+ i 2 (getvar "surftab2")) k 1)
        (command "box" (list xmin ymin zmin) (list xmax ymax zmax))
        (command "slice" "l" "" arc_cen (nth (1+ i) pts) (nth (+ i 2) pts) (nth j pts))
        (command "slice" "l" "" arc_cen (nth (1+ j) pts) (nth (+ j 2) pts) (nth i pts))
        (repeat (getvar "surftab2")
          (if (< k (/ (getvar "surftab2") 2))
        (progn
          (command "slice" "l" "" (nth (+ i k) pts) (nth (+ j k) pts) (nth (+ j k 1) pts) (nth j pts))
          (command "slice" "l" "" (nth (+ j k 1) pts) (nth (+ i k 1) pts) (nth (+ i k) pts) (nth i pts))
          )
        (progn
          (command "slice" "l" "" (nth (+ i k) pts) (nth (+ j k) pts) (nth (+ i k 1) pts) (nth j pts))
          (command "slice" "l" "" (nth (+ j k 1) pts) (nth (+ i k 1) pts) (nth (+ j k) pts) (nth i pts))
          ))
          (setq k (1+ k))
          (ssadd (entlast) solid)
          )
        (setq i j))
      (command "union" solid "")
      (command "zoom" "P")
      (setvar "osmode" o_snap)
      (princ "\nTo change the smotness: delete the cone, adjust SURFTAB1 and/or SURFTAB2, than run again")
      (command "undo" "end")
      (princ)
      )
    (progn
      (princ "Program loaded. Type \"CUCONE\" at the command prompt")
      (princ)
      )
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  2. #2
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,057

    Default

    fuccaro,

    That looks pretty cool! I'm not much of solids kinda guy. I prefer 3dmeshes ( even with all of their short comings. )

    I think that there is a command that will adjust the smothness after the solid is made. I saw it on one the NGs I read.

    -David

    The lisp routine is about 20KB and does some pretty wierd stuff. I've worked on it for 7 or 8 years now.

    http://www.cadtutor.net/forum/postimages/tubepoly.lsp

    R12 DWG File
    http://www.cadtutor.net/forum/postimages/tubepoly.dwg

    R12 (Dos) - A2K

  3. #3
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,543

    Default

    Here is an image I tried to upload yesterday, but at that time CADTutor was working on the site.



    Code:
    I'm not much of solids kinda guy. I prefer 3dmeshes
    Solids are easy to manipulate. Can you make a hole in your 3D Mesh?
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  4. #4
    Peter31712
    Guest

    Default

    How about if the extrude path is a 3DPoly line instead of arc segment ???

  5. #5
    Forum Deity David Bethel's Avatar
    Discipline
    Multi-disciplinary
    David Bethel's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Commercial Food Service
    Using
    AutoCAD pre 2000
    Join Date
    Dec 2003
    Location
    Newport News, Virginia
    Posts
    2,057

    Default

    Registered forum members do not see this ad.

    Code:
    Can you make a hole in your 3D Mesh?
    You can but it is a royal pain!....

    Code:
    How about if the extrude path is a 3DPoly line instead of arc segment ???
    I don't think ACAD's EXTRUDE can handle it. -David
    R12 (Dos) - A2K

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts