lisp has stopped working

lisp has stopped working

Anonymous
Not applicable
1,430 Views
8 Replies
Message 1 of 9

lisp has stopped working

Anonymous
Not applicable

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

 

lisp1.png

 

;   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

0 Likes
Accepted solutions (2)
1,431 Views
8 Replies
Replies (8)
Message 2 of 9

Kent1Cooper
Consultant
Consultant

Are the things that look like Dimensions actually Blocks with an Attribute?  [You don't include the Insert part of the code, so we can't see whether there's an Attribute value being supplied.]  If so, could the Block definition have been changed to make that a constant Attribute, rather than one that gets its value during the Insert process?

Kent Cooper, AIA
0 Likes
Message 3 of 9

Anonymous
Not applicable

Yes they are Blocks with an Attributes

 

0 Likes
Message 4 of 9

SeeMSixty7
Advisor
Advisor

Maybe attach a drawing with the block inserted, so someone here can recreate the issue and then offer some assistance.

 

Good luck,

0 Likes
Message 5 of 9

Anonymous
Not applicable

Here are 3 of 4

0 Likes
Message 6 of 9

Anonymous
Not applicable

4 of 4

0 Likes
Message 7 of 9

SeeMSixty7
Advisor
Advisor
Accepted solution

That's a little more info, but the rest of the code would help move to the next step.

 

Short of that. Check ATTREQ see if it is set to 1 or 0. I fit is set to 0 set it to 1 and see if that helps.

 

Good luck,

Message 8 of 9

Anonymous
Not applicable

Oh my gosh that did it.

So simple. I was wordering why after years it didnt work.

I was crippled w/o it as I have sometime hundreds of drops.

 

Thank you!

Message 9 of 9

Anonymous
Not applicable
Accepted solution

thanks!