Author Topic: Draw pline with width and depth  (Read 2132 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Draw pline with width and depth
« on: September 19, 2007, 12:14:16 PM »
How would I add to the code below, a set width 8" and a set depth 48", so that I get a closed polyline
rectangle 8" by 48" with filleted corners? I'm having a brain fart.

Code: [Select]
(defun c:test (/ scf rad ptb1 ptb2 ptb3 ptb4) 
  (setq scf (getvar "dimscale")) 
  (setq rad (* 0.125 (getvar "dimscale")))
  (setvar "PLINEWID" (* (getvar "dimscale") 0.0125)) 
  (setvar "osmode" 0)
  (setq ptb1 (getpoint "\n* Pick upper left hand corner point *"))
  (setq ptb3 (getcorner "\n* Pick opposite corner point *" ptb1))
  (setq ptb2 (list (car ptb1) (cadr ptb3)))
  (setq ptb4 (list (car ptb3) (cadr ptb1)))
  (command "pline" ptb1 ptb2 ptb3 ptb4 "c") 
  (command "fillet" "r" rad "")
  (command "fillet" "p" "l")
  (command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "") 
  (command "fillet" "r" "0")
  (princ))

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

b.benn

  • Mosquito
  • Posts: 12
Re: Draw pline with width and depth
« Reply #1 on: September 19, 2007, 12:21:53 PM »
Gary,

Here is a quick way to do it using the rectangle command:

Code: [Select]
(defun c:test (/ scf rad ptb1 ptb2 ptb3 ptb4)
(setq scf (getvar "dimscale"))
(setq rad (* 0.125 (getvar "dimscale")))
(setvar "PLINEWID" (* (getvar "dimscale") 0.0125))
(setvar "osmode" 0)
(setq ptb1 (getpoint "\n* Pick lower left hand corner point *"))
(command "rectang" ptb1 "@48,8")
(command "fillet" "r" rad "")
(command "fillet" "p" "l")
(command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "")
(command "fillet" "r" "0")
(princ))

GDF

  • Water Moccasin
  • Posts: 2081
Re: Draw pline with width and depth
« Reply #2 on: September 19, 2007, 12:40:30 PM »
Gary,

Here is a quick way to do it using the rectangle command:

Code: [Select]
(defun c:test (/ scf rad ptb1 ptb2 ptb3 ptb4)
(setq scf (getvar "dimscale"))
(setq rad (* 0.125 (getvar "dimscale")))
(setvar "PLINEWID" (* (getvar "dimscale") 0.0125))
(setvar "osmode" 0)
(setq ptb1 (getpoint "\n* Pick lower left hand corner point *"))
(command "rectang" ptb1 "@48,8")
(command "fillet" "r" rad "")
(command "fillet" "p" "l")
(command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "")
(command "fillet" "r" "0")
(princ))

Thanks Bruce

Here is what I got to work, using your modifed code:

Code: [Select]
(defun c:test (/ scf rad ptb1 ptb2 ptb3 ptb4)
(setq scf (getvar "dimscale"))
(setq rad (* 0.0125 scf))
(setvar "osmode" 0)
(setq ptb1 (getpoint "\n* Pick lower left hand corner point *"))
(command "rectang" "w" (* scf 0.0125) ptb1 "@48,8")
(command "fillet" "r" rad "")
(command "fillet" "p" "l")
(command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "")
(command "fillet" "r" "0")
(princ))

Thanks again

Gary



Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Draw pline with width and depth
« Reply #3 on: September 19, 2007, 12:46:01 PM »
Gary,
If it were me I would reset the rectangle width back to zero when done.
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.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Draw pline with width and depth
« Reply #4 on: September 19, 2007, 02:15:58 PM »
Gary,
If it were me I would reset the rectangle width back to zero when done.


Alan

oops, thanks

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Draw pline with width and depth
« Reply #5 on: September 19, 2007, 02:33:16 PM »
Here is the revised code:

Code: [Select]
(defun METERBANKPN-IT (/ scf rad pt)
  (setq scf (getvar "dimscale"))
  (setq rad (* 0.0125 scf))
  (setvar "osmode" 0)
  (setq pt (getpoint "\n* Pick lower left hand corner point *"))
  (command "rectang" "w" (* scf 0.0125) "f" rad pt "@8,48") 
  (command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "")
  (command "rectang" "w" "0" "f" "0" ^c)
  (prompt "\n* Meter Bank in plan completed *")
  (princ))
(defun METERBANKEL-IT (/ scf rad pt)
  (setq scf (getvar "dimscale"))
  (setq rad (* 0.0125 scf))
  (setvar "osmode" 0)
  (setq pt (getpoint "\n* Pick lower left hand corner point *"))
  (command "rectang" "w" (* scf 0.0125) "f" rad pt "@72,48")   
  (command "change" "last" "" "properties" "lt" "HIDDEN" "c" "1" "")
  (command "rectang" "w" "0" "f" "0" ^c)
  (prompt "\n* Meter Bank in elevation completed *")
  (princ))
(defun C:METER (/ tmp)
  ;(ARCH:F_S-VAR)
  (setvar "cmdecho" 0)
  ;(ARCH:CUSTOM_LAYERS-E-POWR)
  (initget "E P")
  (setq tmp
(getkword
   "\n* Symbol Mode:  <E>levation   <P>lan *"
)
  )
  (initget 7)
  ;;disallow null,zero & negative
  (cond
    ((= tmp "P")
     (METERBANKPN-IT)
    )
    ((or (= tmp "E") (= tmp nil))
     (METERBANKEL-IT)
    )
  )
  ;(ARCH:F_R-VAR)
  (princ)
)

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64