Can't Reenter Lisp. Invalid Point.

Can't Reenter Lisp. Invalid Point.

Anonymous
Not applicable
934 Views
1 Reply
Message 1 of 2

Can't Reenter Lisp. Invalid Point.

Anonymous
Not applicable

Having trouble with this LISP routine (full script below).  Between these 2 lines...

	(safeOpen importfile)
	(setq p1 (getpoint) )

...if I enter them independently and select the ACAD window between them, it works fine. If I enter them in a block (with the rest of the script), or if I enter them independently without activating the ACAD window between, I get the "Can't Reenter LISP. Invalid Point." error. What do I need to be doing between these 2 commands?

 

Full Script:

(setvar "SDI" 1)
(setvar "LISPINIT" 0)
(setvar "FILEDIA" 0)
(setvar "TEXTEVAL" 1)

(setq importpath "C:/Users/Jared/Desktop/TESTING/AutoLISP/output")
(setq xrefs (vl-directory-files importpath "*.dwg" 1))
(setq x (nth 0 xrefs))

(defun safeOpen (importfile)
(command "qsave" "" "open" importfile ) ) (defun setScale (p1 p2 d1) (setq d2 (- (nth 0 p2) (nth 0 p1) ) ) ; reference length=p2[0]-p1[0] (command ; scale FROM 2 major column lines TO <input> "scale" All "" ; scale All p1 ; FROM base point "r" ; BY reference d2 ; reference length d1 ; scale TO ) ) (defun setBasePoint (p1) (command "move" All "" ; load selection set p1 ; get FROM point "0,0" ; TO origin (for easy xref insertion) ) ) ;(foreach x xrefs (setq importfile (strcat importpath "/" x) ) (safeOpen importfile) (setq p1 (getpoint) ) (setq p2 (getpoint) ) (setq d1 (getdist) ) (setScale p1 p2 d1) (setBasePoint p1) ;)
0 Likes
935 Views
1 Reply
Reply (1)
Message 2 of 2

Sea-Haven
Mentor
Mentor

Once you hit this

"open"
importfile

You have transferred control to the other dwg and lisp stops. You can via VL open a dwg and switch back

 

(defun openblk (blkname / adocs)
(setq acDocs (vla-get-documents (vlax-get-acad-object)))
(vla-open acDocs blkname)
(vla-activate (vla-item acdocs 1))
;(vla-put-activedocument (vlax-get-acad-object) (vla-item acdocs 1))
)

(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG102")

 

0 Likes