Author Topic: Rectangle, extrude in one step.....help?  (Read 5322 times)

0 Members and 1 Guest are viewing this topic.

t-bear

  • Guest
Rectangle, extrude in one step.....help?
« on: September 21, 2004, 02:34:19 PM »
I've "acquired" this snippet from a larger routine and I'm trying to make it extrude along a path.
Code: [Select]
^C^C(progn (command ".rectang" pause pause) (command ".extrude" "L" "" pause "" 0))
It creates the rectangle and will extrude a given distance, but trying to extrude along a path crashes the durned thing.  Any ideas?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Rectangle, extrude in one step.....help?
« Reply #1 on: September 21, 2004, 03:00:46 PM »
Maybe?
Code: [Select]
^C^C(progn (command ".rectang" pause pause) (command ".extrude" "L" "" "_P" pause))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Columbia

  • Guest
Rectangle, extrude in one step.....help?
« Reply #2 on: September 21, 2004, 04:01:54 PM »
Try this on for size.  I know it's a little more complicated, but it works well for me at the command line.
Code: [Select]

(defun c:ext_rect (/ ent corner1 corner2)
  (if (setq corner1 (getpoint "\nPick first corner of Rectangle..."))
    (if (setq corner2 (getcorner corner1 "\nPick Second Corner of Rectangle..."))
      (if (setq ent (entsel "\nPick entity to extrude along..."))
        (progn
          (command "._pline" "_non" corner1 "w" 0 0
                          "_non" (list (car corner1) (cadr corner2))
                          "_non" corner2
                          "_non" (list (car corner2) (cadr corner1))
                          "C"
          )
          (command "._extrude" (entlast) "" "_P" (car ent))
        )
        (princ "\nNo Entity Path Picked...")
      )
      (princ "\nNo second corner picked...")
    )
    (princ "\nNo point picked...")
  )
  (princ)
)


I hope this helps, if not then you can ignore if you so choose.

t-bear

  • Guest
Rectangle, extrude in one step.....help?
« Reply #3 on: September 21, 2004, 04:35:54 PM »
CAB.... Works a treat, kiddo!  Thanks.
Columbia.... that works too.  I was trying to do this as a script in a tool button like CABs, but this works too.  Just have the button call the lisp.
Now....I'm gonna *TRY* to make these two work with a circle....wish me luck, I'm so dense, I'll need all I can get. LOLOL

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Rectangle, extrude in one step.....help?
« Reply #4 on: September 21, 2004, 05:56:37 PM »
Hollar ifin you don't get it. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Columbia

  • Guest
Rectangle, extrude in one step.....help?
« Reply #5 on: September 22, 2004, 07:30:25 AM »
T-Bear,

If you get stuck doing it yourself, have a look at this little routine.  Again, I love to use this thing, but that doesn't mean you will.
Code: [Select]

(vl-load-com)
(defun c:tube (/ end1 end2 dia ent pt ptlist dist stpt zcoord ucsorig midpt)
  (vl-cmdf "._undo" "_begin") ;; set undo marker
  (setq $_soild_dia_$ (if $_soild_dia_$ $_soild_dia_$ 6.0) ;; initialize global
        dia (getreal
               (strcat "\nEnter Tube Diameter <"
                 (vl-princ-to-string $_soild_dia_$) ">: "
               )
             )
  )
  (if (/= dia nil) (setq $_soild_dia_$ dia)) ;; use global if "ENTER" button is hit.
  (while (setq ent (entsel "\nSelect Line to Build Tube around: "))
    (if
      (and
        (setq pt  (osnap (cadr ent) "nea"))
        (setq ent (car ent))
      )
      (progn
        (cond
          ( (= (cdr (assoc 0 (entget ent))) "LINE")
            (setq
              end1 (cdr (assoc 10 (entget ent))) ;; find endpoint 1
              end2 (cdr (assoc 11 (entget ent))) ;; find endpoint 2
              dist (distance end1 end2)
            )
            (vl-cmdf "._ucs" "_zaxis" "_non" end1 "_non" end2)
            (vl-cmdf "._cylinder" "_non" (trans end1 0 1) "_d" $_soild_dia_$ dist)
            (vl-cmdf "._ucs" "_p")
          )
        )
      )
    )
  )
  (vl-cmdf "._undo" "_end")
  (princ)
)

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Rectangle, extrude in one step.....help?
« Reply #6 on: September 22, 2004, 08:25:19 AM »
Code: [Select]
(vl-cmdf "._undo" "_begin") ;; set undo marker
excellent!!  :D
TheSwamp.org  (serving the CAD community since 2003)

SMadsen

  • Guest
Rectangle, extrude in one step.....help?
« Reply #7 on: September 22, 2004, 08:40:35 AM »
Columbia, just simple curiousity to see if there's a lesson in this. Is there a reason that the EXT_RECT doesn't use the BOX command when TUBE use the CYLINDER command?

t-bear

  • Guest
Rectangle, extrude in one step.....help?
« Reply #8 on: September 22, 2004, 09:38:49 AM »
OK...Ihave this
Code: [Select]
^C^C(progn (command ".circle" pause pause) (command ".extrude" "L" "" "_P" pause)) and it works...but....I need it to default to diameter.  I know I need a "d" in there *somewhere* but wherever I put it, it crashes.  Like I said, I'm NO lisper! Sorry to be so dense...... I realize this is basics.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Rectangle, extrude in one step.....help?
« Reply #9 on: September 22, 2004, 09:44:58 AM »
Code: [Select]
^C^C(progn (command ".circle" pause "D" pause) (command ".extrude" "L" "" "_P" pause))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

t-bear

  • Guest
Rectangle, extrude in one step.....help?
« Reply #10 on: September 22, 2004, 10:06:00 AM »
THAT's where it goes!!  I had the durned thang ev'r whar BUT!  With and without the ""....DUH!
Thanks a ton CAB, works sweeeeet!

Columbia

  • Guest
Rectangle, extrude in one step.....help?
« Reply #11 on: September 22, 2004, 10:17:55 AM »
Stig,
no real lesson.  T-bear just wanted to extrude along a path.  If you're just using a single segement for the path, then BOX will work great.  But if you've got multiple segments (i.e. a 3DPOLY entity) then you need to use extrude along a path.  The TUBE command does NOT take into account a multisegmented entity.  In fact it only uses LINES.

I only posted it as a sort of guide, or here's what else you could do, type of thing.

SMadsen

  • Guest
Rectangle, extrude in one step.....help?
« Reply #12 on: September 22, 2004, 01:03:39 PM »
Quote from: Columbia
T-bear just wanted to extrude along a path.
Ah of course. I missed that part. Umm .. it was only part of the topic title  :roll:

Thanks Columbia

AVCAD

  • Guest
Rectangle, extrude in one step.....help?
« Reply #13 on: September 27, 2004, 10:22:41 AM »
just use the cube.....BOX....command.

SpeedCAD

  • Guest
Re: Rectangle, extrude in one step.....help?
« Reply #14 on: September 27, 2004, 12:32:53 PM »
Quote from: t-bear
I've "acquired" this snippet from a larger routine and I'm trying to make it extrude along a path.
Code: [Select]
^C^C(progn (command ".rectang" pause pause) (command ".extrude" "L" "" pause "" 0))
It creates the rectangle and will extrude a given distance, but trying to extrude along a path crashes the durned thing.  Any ideas?


Hi...

You test this:
Code: [Select]
^C^C_.rectangle;\\_.extrude;_l;;_p;\