Code Red > AutoLISP (Vanilla / Visual)

Adding to this lisp?

<< < (2/5) > >>

vinnyg:
I have very limited options as to how I can save and send this dwg file.....I'm working in R14 and can only
save as bmp, dwf and dwg that this forum allows to post. So which one do I attach? Help!

vinnyg

Bob Wahr:
I'd go with the bmp so it can easily be seen.  Of course, everyone here should have the ability to handle dwg and dwf as well.

vinnyg:
OK, Here it is

Jeff_M:
OK, Vinny,
Here it is in a working order. Note that you have duplicated a number of actions, only a few of which I eliminated. Also, I changed the layer for the dimensions to "Dims" since you cannot (entmake) the Defpoints layer and the routine crashed if that layer didn't exist.

Agian, there is quite a bit of optimization you could do to this, but it works as a starting point.

--- Code: ---; CAPBARS.LSP A PROGRAM TO DRAW A PIER CAP
; WITH REINF. BARS


  (DEFUN DTR (A) (* PI (/ A 180.0)))
  (DEFUN RTD (A) (/ (* A 180.0) PI))
(DEFUN C:CAPBARS (/ ang bh bp1 bp10 bp11 bp12 bp13 bp14 bp15 bp16 bp17 bp18 bp19
    bp2 bp20 bp21 bp22 bp23 bp24 bp25 bp26 bp27 bp28 bp29 bp3 bp30
    bp31 bp32 bp33 bp4 bp5 bp6 bp7 bp8 bp9 bw h p1 p2 p3 p4 p5 p6 w
    z ss dist spacing)   
(SETVAR "CMDECHO" 0)
(SETQ Z (GETVAR "CLAYER")
      osmode (getvar "osmode")
      )
(GRAPHSCR)
(setvar "osmode" 0)
  (mapcar '(lambda (x)
     (if (not (tblsearch "layer" x))
       (entmake (list '(0 . "LAYER")
      '(100 . "AcDbSymbolTableRecord")
      '(100 . "AcDbLayerTableRecord")
      (cons 2 x)
      '(6 . "Continuous")
      '(62 . 7)
      '(70 . 0)
      )
)
       )
     )
  '("3" "Dims" "reinf" "text")
  )

(SETQ P1  (GETPOINT  "\nStart point for construction: "))

(setq w (getdist "\nPierCap width?:"))
(setq h (getdist "\nPierCap height?:"))
(setq ang 1.5708)

(setq p2 (polar p1 (-(dtr 90) ang) w)
      p3 (polar p2 (+(dtr 0) ang) h)
      p4 (polar p3 (+(dtr 90) ang) w)
)   

  (setvar "clayer" "3")
  (setvar "cecolor" "7")
  (command "line" p1 p2 p3 p4 "close")
  (redraw) ; end of drawing the outline

  (command "dimclrt" "1")
  (command "dimclre" "1")
  (command "dimscale" "12")
  (command "lunits" "4")
  (command "dimunit" "4")
  (command "dimtsz" "1/16")
  (command "dimtad" "1")
  (command "dimtih" "off")
  (command "dimjust" "0")
  (command "dimtad" "1")

  (setvar "cecolor" "1")
  (setvar "clayer" "Dims")
  (setq p5 (polar p1 (+(DTR 90) ANG) 14))
  (command "dim" "ver" p1 p4 p5 "")
  (setq p6 (polar p1 (+(dtr 180) ang) 14))
  (command "dim" "hor" p1 p2 p6 "")
  (command "exit" )
  (command "zoom" "e" )
  (command "zoom" "0.9x" )
  (redraw)


(setq bp1 p1);(getpoint "\nStart point for reinf at lower left corner of piercap: "))


  (setq BW w);(getdist "\nPierCap width?:"))
  (setq BH h);(getdist "\nPierCap Height?:"))
  ;(setq ang 1.5708)
  (setq bp2 (polar bp1 (-(dtr 90) ang) bw)
      bp3 (polar bp2 (+(dtr 0) ang) bh)
      bp4 (polar bp3 (+(dtr 90) ang) bw)
  )   

  (setq bp5 (polar bp1 (-(dtr 90) ang) 3.5))
  (setq bp9 (polar bp5 (+(dtr 0) ang) 3))
  (setq bp10 (polar bp2 (+(dtr 90) ang) 15))
  (setq bp11 (polar bp10 (+(dtr 0) ang) 3))
  (setq bp7 (polar bp3 (+(dtr 90) ang) 15))
  (setq bp12 (polar bp7 (+(dtr 180) ang) 2))
  (setq bp8 (polar bp4 (+(dtr 180) ang) 3))
  (setq bp13 (polar bp8 (-(dtr 90) ang) 3.5))
  (setq bp6 (polar bp4 (-(dtr 90) ang) 3.5))
  (setq bp13 (polar bp6 (+(dtr 180) ang) 2))
 

 
  (setvar "cecolor" "8")
  (setvar "clayer" "reinf")
  (command "ortho" "on" )
  (command "pline" bp11 bp9 bp13 bp12 "")
  (command "fillet" "r" 1 "fillet" "polyline" "L")
  (setvar "cecolor" "7")
  (redraw)


  (setq bp14 (polar bp1 (-(dtr 90) ang) 15))
  (setq bp15 (polar bp14 (+(dtr 0) ang) 4))
  (setq bp16 (polar bp2 (+(dtr 90) ang) 3.5))
  (setq bp17 (polar bp16 (+(dtr 0) ang) 4))
  (setq bp18 (polar bp3 (+(dtr 90) ang) 3.5))
  (setq bp19 (polar bp18 (+(dtr 180) ang) 3))
  (setq bp20 (polar bp4 (-(dtr 90) ang) 15))
  (setq bp21 (polar bp20 (+(dtr 180) ang) 3))
 
 

 
  (setvar "cecolor" "8")
  (setvar "clayer" "reinf")
  (command "ortho" "on" )
  (command "pline" bp15 bp17 bp19 bp21 "")
  (command "fillet" "r" 1 "fillet" "polyline" "L")
  (setq bp22 (polar bp4 (+(dtr 180) ang) 4))
  (setq bp23 (polar bp3 (+(dtr 180) ang) 4))
  (setq bp24 (polar bp22 (-(dtr 90) ang) 3))
;;;  (setq bp25 (polar bp23 (+(dtr 90) ang) 3))
;;;  (command "pline" bp24 bp25 "")
  (setq ss (ssadd))
  (setq bp26 (polar bp1 (+(dtr 0) ang) 5))
  (setq bp27 (polar bp2 (+(dtr 0) ang) 5))
  (setq bp28 (polar bp26 (-(dtr 90) ang) 3))
  (setq bp29 (polar bp27 (+(dtr 90) ang) 3))
  (command "pline" bp28 bp29 "")
  (ssadd (entlast) ss)
  (setq bp30 (polar bp28 (+(dtr 90) ang) 0.25))
  (command "circle" bp30 "D" 0.50)
  (ssadd (entlast) ss)
  (setq bp31 (polar bp29 (-(dtr 90) ang) 0.25))
  (command "circle" bp31 "D" 0.50)
  (ssadd (entlast) ss)
  (setq dist (distance bp28 bp24))
  (setq spacing (/ dist 3))
  (command "_.array" ss "" "r" 4 1 spacing)
;;;  (setq bp32 (polar bp24 (+(dtr 90) ang) 0.25))
;;;  (command "circle" bp32 "D" 0.50)
;;;  (setq bp33 (polar bp25 (-(dtr 90) ang) 0.25))
;;;  (command "circle" bp33 "D" 0.50)
  (setvar "cecolor" "7")
  (setvar "clayer" "text")
  (redraw)
  (princ)
) ; end of defun

--- End code ---

vinnyg:
SUPER! IT WORKS! THANKS JEFF M.

How did you do that?  And so fast!

Thanks Again,

vinny

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version