Hello to Swamp members.
I have a block definition with more 'MTEXT subentities with value "" (see attached file, I don't remember why and when I have performed such stupid operations), and I want to eliminate that useless subentities, that cause an exagerate "minimum enclosed box".
I have proved to perform a function constructed on the basis of one similar, designed to modify subentities and
posted by Andrea in
https://www.theswamp.org/index.php?topic=28154.msg337414#msg337414Unfortunately it doesn't work.
Please, can someone help me? Thanks in advance.
(defun EL_MTEXTBLOCK
(/ eBlockSel
; Block selection lInsertData ; Entity data
sBlockName ; Block name
lBlockData ; Entity data
eSubEntity ; Sub-entity name
lSubData ; Sub-entity data
iCount ; Counter
blk§
)
;; Redefine error handler
*error* D_FB_ERROR) ;_ end setq
;; Set up environment
(setq #sysvars
(#SAVESYSVARS
(list "cmdecho"))) ;; Get block from user and make sure it's an INSERT type
) ;_ end if
) ;_ end if
;; Get block info from the block table
eSubEntity
(cdr (assoc -2 lBlockData
))) ;_ end setq ;; Make sure block is not an Xref
(princ "\nUpdating blocks sub-entities. . .") ;; Parse through all of the blocks sub-entities
(setq eSubEntity
(entnext eSubEntity
)) ; get next sub entity ) ; end while
;; Update attributes
(IDC_FB_UPDATTRIBS)) ; end progn
(alert "XREF selected. Not updated!")) ; end if ) ; end progn
(alert "Nothing selected.")) ; end if (IDC_RESTORESYSVARS)
(defun IDC_FB_UPDATTRIBS
() ;; Update any attribute definitions
(princ "\nUpdating attributes. . .") ) ;_ end ssget
) ;_ end setq
eSubType
(cdr (assoc 0 lSubData
))) ;_ end setq ) ;_ end if
(while (or (= eSubType
"ATTRIB") (= eSubType
"SEQEND")) ;; Update layer property
) ;_ end setq
(entmod lSubData
)) ;_ end progn ) ;_ end if
;; Update the linetype property
) ;_ end setq
(entmod lSubData
)) ;_ end progn ;; Update the color property
) ;_ end setq
(entmod lSubData
)) ;_ end progn eSubType
(cdr (assoc 0 lSubData
))) ;_ end setq (setq eSubType
nil)) ;_ end if ) ; end while
(setq iCount
(1+ iCount
))) ; end repeat ) ; end if
;*******************************************************************************
; Function to save a list of system variables
;*******************************************************************************
(defun #SAVESYSVARS
(lVarList
/ sSystemVar
) ) ;_ end setq
) ;_ end lambda
lVarList) ;_ end mapcar
lSystemVars) ;_ end defun
;*******************************************************************************
; Function to restore a list of system variables
;*******************************************************************************
(defun IDC_RESTORESYSVARS
() #SYSVARS) ;_ end mapcar
) ;_ end defun
;*******************************************************************************
; Error Handler
;*******************************************************************************
(princ "\nError occurred in the Fix Block routine...") (*error* msg)) ;_ end if
(if (/= msg
"quit / exit abort") ) ;_ end if
(IDC_RESTORESYSVARS)