(defun c:dxfplt () (dxf_batchinsert) ) (defun dxf_batchinsert (/ fn j k l m s1 rows cols pt0 pt1 pt2 rowdist coldist goahead ) (setq olderr *ERROR* *ERROR* myerror ) ;_ setq (setq fn " " j 0 k 0 l 0 m 0 goahead nil cols 10 rows 10 ) ;_ setq (command "undo" "group") (if (= (getvar "dwgtitled") 1) (progn (setq goahead "N") (while (= (strcase goahead) "N") (setq fn (getstring "\nEnter search keyword. <*.dxf>:")) (if (= fn "") (setq fn "*.dxf") ) (setq s1 (vl-directory-files (getvar "dwgprefix") fn)) (setq m (length s1)) (prompt (strcat "\n" (itoa m) " files found.")) (setq goahead "Y") (if (< m 1) (setq goahead "N") ) (if (> m 40) (progn (textscr) (INITGET "Y N y n") (setq goahead (getkword " maybe take too long time, Goahead? [Y/N] <Y>:" ) ) (if (= goahead nil) (setq goahead "Y") ) ) ) ) (graphscr) (setq pt0 (getpoint "\nInsert point:")) (setq pt1 (getcorner pt0 " another point to set the dist:")) (setq coldist (- (car pt1) (car pt0)) rowdist (- (cadr pt1) (cadr pt0)) ) (setq j 0) (prompt "\n") (repeat (length s1) (setq fn (strcase (nth j s1))) (setq pt1 (list (+ (car pt0) (* k coldist)) (+ (cadr pt0) (* l rowdist)) (caddr pt0) ) ) (command "insert" (strcat "*" fn) pt1 "1" "0") (setq j (1+ j) k (1+ k)) (if (= k cols) (progn (setq k 0) (setq l (1+ l)) ) ) (prompt (strcat (itoa j) "/" (itoa m) " " fn "\n")) ) ;_ repeat (prompt "\nDone") ) (princ "\nplease save me first,I want to know where to find those dxf files.") ) ;_ if (command "undo" "e") (setq *ERROR* olderr) (princ) ) (setq n-pllst2 0) (setq x_scale 1.0) (setq y_scale 1.0) (defun c:lll (/ ss e pt j l_list x1 x2 o_file ptlist temp_y_sc) (setq j 0 tmplayer "tmplayer" ) ;;; (setq temp_y_sc (getreal (strcat "Input the scale of Y value:<" ;;; (rtos y_scale 2 4) ;;; ">" ;;; ) ;;; ) ;;; ) (if (/= temp_y_sc nil) (setq y_scale temp_y_sc) ) ;;; (setq filename ;;; (strcat (getvar "dwgprefix") (getvar "dwgname") ".gf.txt") ;;; );_ setq ;;; (setq o_file (open filename "a")) ;;; (setq clayer (getvar "CLAYER")) ;;; (command "layer" "m" tmplayer "s" clayer "off" tmplayer "") (if (= n-pllst nil) (progn ;;; (setq n-pllst (getint "Enter the number of first line <1>:")) (setq n-pllst 1) (if (= n-pllst nil) (setq n-pllst 0) (setq n-pllst2 (1-n-pllst)) ) ) ) (princ "\nSelect polylines one by one:") (setq ss (ssget '((-4 . "<OR") (0 . "LWPOLYLINE") (0 . "POLYLINE") (-4 . "OR>") ) ) ) (if (/= ss nil) (repeat (sslength ss) (setq ptlist nil) (setq n-pllst2 (1+ n-pllst2)) (setq e (ssname ss 0)) (ssdel e ss) (setq d (entget e)) ;;; (setq d (subst (cons 8 tmplayer) (assoc 8 d) d)) (redraw e 1) (entmod d) (entupd e) (if (= (fld 0) "POLYLINE") (progn (setq e (entnext e)) (setq d (entget e)) (while (/= (fld 0) "SEQEND") (setq ptlist (append ptlist (list (trans (fld 10) 0 1)))) (setq e (entnext e)) (setq d (entget e)) ) ;_ while ) ;_ progn ) ;_ if (if (= (fld 0) "LWPOLYLINE") (progn (setq d (entget e)) (setq l_list (length d)) (setq j 2) (while (< j l_list) (if (= (car (setq pt (nth j d))) 10) (setq ptlist (append ptlist (list (trans (cdr pt) 0 1)))) ) ;_ if (setq j (1+ j)) ) ;_ while ) ;_ progn ) ;_ if (setq x1 (car (car ptlist))) (if (> (abs x1) 5.0) (setq ptlist (reverse ptlist)) ) (princ "aaaaa") (command "_pline" (foreach pt ptlist (command pt))) (command "_matchprop" e (entlast) "") (entdel e) (princ "bbbbb") ;;; (princ "\n\n" o_file) ;;; (princ (rtos n-pllst2 2) o_file) ;;; (princ " " o_file) ;;; (foreach pt ptlist ;;; (princ (rtos (abs (car pt)) 2 1)) 'X car ;;; (princ ",") ;;; (princ (rtos (cadr pt) 2 1)) 'Y cadr ;;; (princ ",") ;;; (princ (rtos (* (cadr pt) y_scale) 2 4) o_file) ;;; (princ " @" o_file) ;;; (princ (rtos (* (car pt) x_scale) 2 4) o_file) ;;; (princ " ;" o_file) ;;; (princ (rtos (* (cadr pt) y_scale) 2 4) o_file) ;;; (princ " @ " o_file) ;;; (princ (rtos (* (car pt) x_scale) 2 4) o_file) ;;; (princ "," o_file) ;;;) ;_ foreach ;;; (princ "\nline ") ;;; (princ (rots n-pllst2 2)) ;;; (princ " output to ") ;;; (ptinc filename ) ) ) ;;; (close o_file) ;;; (textpage) (princ )) ;_ defun Do NOT add text below the comment! |