Lisp works in one drawing but not in other - what gives?!

Lisp works in one drawing but not in other - what gives?!

Buzz0m
Collaborator Collaborator
562 Views
6 Replies
Message 1 of 7

Lisp works in one drawing but not in other - what gives?!

Buzz0m
Collaborator
Collaborator

So I found a lisp that controls the decimal places of numeric values that are given as text objects.

 

The lisp works in certain drawings but not all. The "problematic" drawings show the objects as "text" -objects and the lisp runs smoothly until end without errors.

 

Does anybody know if there is something in the code that is version specific or something that could explain the seemingly unreliable behavior.

(defun c:R2D2 (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "TEXT"))))
   ((lambda (i / e l)
      (while (setq e (ssname ss (setq i (1+ i))))
        (setq l (entget e))
        (entmod (subst (cons 1 (rtos (atof (cdr (assoc 1 l))) (getvar 'lunits) 2)) (assoc 1 l) l))
      )
    )
     -1
   )
 )
 (princ)
)

 

https://www.cadtutor.net/forum/topic/23234-lisp-routine-that-will-round-decimal-places/

0 Likes
Accepted solutions (2)
563 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant
Accepted solution

Hi,

you forgot to say or show what doesn't work,
what happens instead and also an example file is not attached.

 

Lunits setting is part of a DWG file, the same with dimzin (relevant for RTOS)

 

A sample file (DWG) would have answered all questions.

Checkout and compare the Lunits and Dimzin settings, or share a sample DWG.

Sebastian

0 Likes
Message 3 of 7

ronjonp
Mentor
Mentor
Accepted solution

Make sure DIMZIN is set to 0.

0 Likes
Message 4 of 7

Buzz0m
Collaborator
Collaborator

Changing the Dimzin value did the trick! I guess I'll add a line or two to temporarily switch the dimzin value for the duration of the lisp!

Thanks @cadffm  and @ronjonp  for your shared knowledge! This is definitely something I would not have figured out by myself!

 

PS: my apologies for not sharing a dwg. I was banking on somebody seeing the problem/solution right away even though I subconsciously knew that a dwg would have made it easier.

0 Likes
Message 5 of 7

Buzz0m
Collaborator
Collaborator

http://www.lee-mac.com/consistentrtos.html
And here is Lee-Mac's explanation about it in case somebody stumbles upon this issue and needs more clarification.

0 Likes
Message 6 of 7

ronjonp
Mentor
Mentor

@Buzz0m wrote:

http://www.lee-mac.com/consistentrtos.html
And here is Lee-Mac's explanation about it in case somebody stumbles upon this issue and needs more clarification.


That's the same link I pointed to in my reply 😎

Message 7 of 7

Buzz0m
Collaborator
Collaborator

Oh sorry I didn't even understand it was a link!

 

0 Likes