6
21
13
初来乍到
使用道具 举报
0
132
198
限制会员
2
439
536
Command: (entget Empty_Variable) ; variable Empty_Variable = nil; error: bad argument type: lentityp nil
Command: (entget 23) ; integer 23 instead ename; error: bad argument type: lentityp 23
(defun C:FA ( / adoc);;; (setq adoc (vla-get-activedocument (vlax-get-acad-object)));;; (vla-startundomark adoc) (defun get_acad_vars () (setq osm-set (getvar "osmode")) (setq cmd-ech (getvar "cmdecho")) (setvar "cmdecho" 0) (setq lay-cur (getvar "clayer"))) ; END defun to get original settings to be restored(defun res_acad_vars () (setvar "osmode" osm-set) (setvar "clayer" lay-cur) (setvar "pickstyle" 1 ) (command "wipeout" "f" "off") (setvar "cmdecho" cmd-ech)) ; END defun to restore original acad settings(defun init_vars ()(setq pick_ok 0)(if (= first_time nil) (progn (princ "SELECT reference point BEFORE Continuing: ") (setq ins_pnt (getpoint)) (setq pick_start ins_pnt) (setq first_time 1)))) ; END progn & defun init_vars procedure(defun *error* (msg)(res_acad_vars)(princ msg)(princ)) ; END defun *error*(defun rel_dist () (setq rel_x 72.0 rel_y1 0.0 rel_y2 16.0)) ;END defun relative_distances procedure(defun get_obj () ; find new insertion point or pick block/mtext to move (setvar "osmode" 520) (initget 128 "Select") (setq ins_pnt (getpoint "\nPICK Block or Mtext or <S>elect new reference point: ")) (cond ((null ins_pnt) (progn (res_acad_vars) (exit))) ;cond 1 - picked enter ((listp ins_pnt) (progn (setq pick_object 1) )) ;cond 2 - picked object ((= ins_pnt "Select") (progn (setq pick_object 0) (setq ins_pnt (getpoint)) (setq pick_start ins_pnt) (setq first_time 1))) ;cond 3 - select new ref point )) ;END cond function & defun in_pts (defun start_pnt () (setq new_x (car pick_start)) (setq new_y1 (cadr pick_start));<===========Problem here? (setq new_y2 (- new_y1 rel_y2))) ;END defun start_pnt(defun increment () (setq new_x (+ new_x rel_x)) (setq new_y (+ new_y1 rel_y1)) (setq y2_val_n (+ new_y rel_y2)))(defun pick_obj () (setq ss_obj (ssget ins_pnt)) (setq ent (entget (ssname ss_obj 0))) ;get the entire entity list (cond ((= (cdr (cadr ent)) "INSERT") (progn (setq pick_ok 1) ; found a BLock (setq list_num 10) (increment) (mov_ins_pnt) (while(/= "SEQEND" (cdr (cadr ent))) (setq list_num 11) (setq ent_nam (cdr (car ent))) (setq ent (entget (entnext ent_nam))) (mov_ins_pnt) ) ;END while ) ;progn - found block ) ;condition 1 ((= (cdr (cadr ent)) "MTEXT") (progn (setq pick_ok 2) ; found MText (setq list_num 10) (increment) (mov_ins_pnt) )) ;END progn & condition 2 ) ;END cond);defun pick_obj(defun mov_ins_pnt () ;move the insertion point (setq blck_pnt (assoc list_num ent));get the list of the block insertion point (setq old_x (cadr blck_pnt)) ;insertion point x value at start) (setq old_y (caddr blck_pnt)) ;insertion point y value at start) (setq delta_x (- new_x old_x)) (setq delta_y (- new_y old_y)) (setq x1_val (+ old_x delta_x)) ; for block/attributes (setq x2_val (+ old_x delta_x)) ; for mtext (setq y1_val (+ old_y delta_y)) (setq y2_val (+ old_y delta_y)) (cond ((= pick_ok 1)(progn ; for block/attributes (setq new_x x1_val) (setq new_y new_y1) (setq x1_val (+ old_x delta_x)) ))((= pick_ok 2)(progn ; for mtext (setq new_x x2_val) (setq new_y new_y2) (setq just1 (assoc 71 ent)) (setq just2 (cons 71 2)) (setq ent (subst just2 just1 ent)));progn);cond pick_ok 2 ) ;cond (setq ins_pnt (list new_x new_y 0.0)) ; new insertion point (setq mov_pnt (cons list_num ins_pnt)) ; new insertion point LIST (setq ent (subst mov_pnt blck_pnt ent)) (entmod ent) ;(ENTUPD ENT) ;;;;; <<<========= BAD ARGUMENT PROBLEM HERE *****);defun move insertion point