divide by 0 error is (drum roll) because you divide by zero!
adding a little surveillance cam like this- (MAPCAR '/ (setq tmp1 (APPLY 'MAPCAR (CONS '- (REVERSE pl)))) (setq tmp2 (APPLY 'MAPCAR (CONS '- (REVERSE (_TEXTBOX tx nil))))) )
which after crash help me retrieve tmp1 and tmp2. Here's what is in them
Command: !tmp1
(0.0 0.0 0.0)
Command: !tmp2
(0.729203 0.242907 0.0)
the mapcar divide the 1rst element of tmp1 by the 1rst element of tmp2 (0.0 / 0.729203)
the mapcar then divide the 2nd element of tmp1 by the 2nd element of tmp2 (0.0 / 0.242907)
the mapcar then divide the 3rd element of tmp1 by the 3rd element of tmp2 (0.0 / 0.0). (bombs here...)
I always had that same values in tmp1/tmp2 no matter the position of of the text. After digging out to understand the code, here'S what I found out. The problem is the boundary command. If if fails to create a boundary, entlast will retrieve something else (in my case the text). a pline will have only 2 sets of coords in assoc 10, so tmp1 has 2 elements, so the 3rd element of tmp2, which is 0 is ignored.
ie: (mapcar '/ '(10 10)'(2 2 0)) returns (5 5)
When boundary fails to be created, in my case the text was selected, which has a set of x y z coords. When it happens, here' what is in PL just before you try to mapcar the division
((226.922 97.1085 0.0) (226.922 97.1085 0.0))
What you could do, get/store the entlast before boundary. After boundary, if the "new" entlast is different the one that you stored, proceed, else you know the boundary creation failed, and could prompt a message before quitting. |