;; | --------------------------------------------------------------------------- ;; | BL_CheckIfSame ;; | --------------------------------------------------------------------------- ;; | Function : Checks two block inserts to see if they are the same ;; | Argument : 'Blk1' - First block name (must be defined in current drawing) ;; | 'Blk2' - Second block name (must be defined in current drawing) ;; | 'ChkAtts' - If T, the attributes also are checked ;; | Returns : T if both the block definitions are the same, else nil ;; | Updated : July 8, 2002 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun BL_CheckIfSame ( Blk1 Blk2 CheckAtts / ss1 ss2 _ss1 _ss2 ssl1 ssl2 elast NAtts1 NAtts2 DupSS Same ss Go TagLst1 TagLst2 ) (setq Same nil) (if (tblsearch "BLOCK" Blk1) (progn (if (tblsearch "BLOCK" Blk2) (progn (setq NAtts1 (BL_GetNumAtts Blk1) NAtts2 (BL_GetNumAtts Blk2) elast (MI_xentlast) ) (LA_mk_c_lyr "0" "") (command "._Insert" (strcat "*" Blk1) (list 0.0 0.0 0.0) 1.0 0.0) (setq ss1 (MI_after elast) elast (MI_xentlast) ) (command "._Insert" (strcat "*" Blk2) (list 0.0 0.0 0.0) 1.0 0.0) (setq ss2 (MI_after elast) Go nil ) (if (not CheckAtts) (setq _ss1 (SS_RemoveTypes ss1 (list "ATTDEF")) _ss2 (SS_RemoveTypes ss2 (list "ATTDEF")) Go T ) (progn (if (= NAtts1 NAtts2) (progn (setq TagLst1 (BL_GetTagNames Blk1) TagLst2 (BL_GetTagNames Blk2) ) (if (equal TagLst1 TagLst2) (setq Go T) ) )) )) (if Go (progn (if (and _ss1 _ss2) (progn (setq ssl1 (sslength _ss1) ssl2 (sslength _ss2) ) (if (= ssl1 ssl2) (progn (setq ss (SS_ssjoin _ss1 _ss2) DupSS (MI_ChkDup ss nil nil nil nil 0.01) ) (if (and DupSS (= (sslength DupSS) ssl1)) (setq Same T) ) )) )) )) (if ss1 (command "._Erase" ss1 "")) (if ss2 (command "._Erase" ss2 "")) ) (alert (strcat "Error: Block " Blk2 " is not defined in the current drawing.")) ) ) (alert (strcat "Error: Block " Blk1 " is not defined in the current drawing.")) ) Same )