
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need help with this.
I have used this routine for years and now it doesnt completly work.
It puts a electrical symbol with dims from the four corner chosen.
But now the dims only read 10'-0" which it the default for the supporting four files.
I have never wrote a routine and am very dumb to how they work
ACAD 2016 on a PC
; Get the four corners of the booth.
(defun booth ()
(setvar "attdia" 0)
(setq pt1 (getpoint "\nBottom left corner of booth: "))
(setq pt2 (getpoint "\nBottom right corner of booth: "))
(setq pt3 (getpoint "\nUpper right corner of booth: "))
(setq pt4 (getpoint "\nUpper left corner of booth: "))
(setvar "lunits" 4) ; set linear units to feet-inches
(setvar "luprec" 0) ; set units precision to nearest inch
)
; Get the insertion point of the electric and convert to feet-inches
(defun place ()
(setq ip (getpoint "Where do you want place electric ? "))
(setq up (- (car pt1) (car ip))) ; subtract x value of insertion point from x value of pt1
(setq down (- (car pt2) (car ip))) ; subtract x value of insertion point from x value of pt2
(setq in (- (cadr pt1) (cadr ip))) ; subtract y value of insertion point from y value of pt1
(setq over (- (cadr pt4) (cadr ip))) ; subtract y value of insertion point from y value of pt4
(setq c (abs up)) ; get absolute value of "up" variable
(setq d (abs down)) ; get absolute value of "down" variable
(setq a (abs in)) ; get absolute value of "in" variable
(setq b (abs over)) ; get absolute value of "over" variable
(setq y (rtos (min a b))) ; get the minimum y value from the insertion pt
(setq x (rtos (min c d))) ; get the minimum x value from the insertion pt
(setq val1 (+ a c)) ; get the sum of a + c
(setq val2 (+ a d)) ; get the sum of a + d
(setq val3 (+ b c)) ; get the sum of b + c
(setq val4 (+ b d)) ; get the sum of b + d
(setq quad (min val1 val2 val3 val4)) ; find out which sum is the least
) ; so you can determine which block to insert
; Determine which quadrant of the drawing you are working in
(defun symbol ()
(if (= quad val1) (progn
(setq bn "quad1") ;if value 1 is the least use block "quad1"
)
)
(if (= quad val2) (progn
(setq bn "quad2") ;if value 1 is the least use block "quad2"
)
)
(if (= quad val3) (progn
(setq bn "quad3") ;if value 1 is the least use block "quad3"
)
)
(if (= quad val4) (progn
(setq bn "quad4") ;if value 1 is the least use block "quad4"
)
)
)
; Insert the block and ask for the next insertion point
Solved! Go to Solution.