open the saved drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
One lisp is going process in a drawing, mean while I have to open another saved drawing and have to work with lisp in newly opened file. Drawing file was opened but the lisp is proecessing in previous opened drawing. Is any solution to work in newly opened drawing?
My code is::
(defun c:plt2()
(setvar "osmode" 0)
(setvar "luprec" 8)
(setq point_list (list))
(setq s 65)
(while (progn
(setvar 'OSMODE 32)
(setq pt (getpoint "\nPick a point <exit>:")))
(setvar 'OSMODE 0)
(command "_.TEXT" (list (+ (car pt) 0.00002) (+ (cadr pt) 0.000035) 0.) 0.00005 0. (chr s))
(setq point_list (append point_list (list pt)))
(setq s (1+ s)))
(princ)
point_list
(setq num 0)
(setq len_point_list (length point_list))
(while (< num (- len_point_list 1))
(setq 1st_pt (nth num point_list))
(setq 2nd_pt (nth (+ num 1) point_list))
(setq mid_pt1_pt2 (list (/ (+ (car 1st_pt)(car 2nd_pt)) 2)(/ (+ (cadr 1st_pt)(cadr 2nd_pt)) 2)))
(setq dist_1to2 (distance 1st_pt 2nd_pt))
(setq ang_1to2 (dtr1 (angle 1st_pt 2nd_pt)))
(command "text" "j" "bc" mid_pt1_pt2 "0.00005" ang_1to2 (rtos dist_1to2))
(setq num (1+ num ))
);while
(setq 1st_pt (nth 0 point_list))
(setq last_pt (nth (- len_point_list 1) point_list))
(setq mid_pt1_pt2 (list (/ (+ (car 1st_pt)(car last_pt)) 2)(/ (+ (cadr 1st_pt)(cadr last_pt)) 2)))
(setq dist_1tolast (distance last_pt 1st_pt ))
(setq ang_1tolast (dtr1 (angle last_pt 1st_pt)))
(command "text" "j" "bc" mid_pt1_pt2 "0.00005" ang_1tolast (rtos dist_1tolast))
(command "qsave")
;***************************** new drawing open *********************************************
(setq fileName "D:\\xxxxxx\\xxxxxx\\xxxxx\\xxxxx\\xxxxx.dwg")
(if (and (findfile fileName)
(not (vl-catch-all-error-p
(setq oDoc (vl-catch-all-apply 'vla-open (list (vla-get-documents (vlax-get-acad-object))fileName)))
)
)
)
(vla-activate oDoc)
)
(setq blkname (getstring "\nEnter Plot Number:"))
(setq sget_plot_no (ssget "_X" (list (cons 8 "T_PLOT_NO")(cons 0 "TEXT")(cons 1 blkname))))
(setq sname_poly_no (ssname sget_plot_no 0))
(setq prop_poly_no (vlax-ename->vla-object sname_poly_no))
(setq text_poly_no (vla-get-TextString prop_poly_no))
(setq ins_poly_no (vlax-safearray->list (vlax-variant-value (vla-get-InsertionPoint prop_poly_no))))
(command "zoom" "c" ins_poly_no "150")
);defun