Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Anonymous
en respuesta a: Anonymous

use this:

(if (not (tblsearch "layer" "DIMENSION"))
(progn
(entmake
(list
'(0 . "LAYER")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbLayerTableRecord")
(cons 2 "DIMENSION")
'(70 . 0)
(cons 62 3)
)
)
) ;_progn
) ;_if

(if (not acdb:reactor)
(setq acdb:reactor
(vlr-AcDb-Reactor
nil
'((:vlr-objectappended . a+objcreated))
)
)
)

(if (not acdb:reactor2)
(setq acdb:reactor2
(vlr-command-reactor
nil
'((:vlr-commandended . a+commandended))
)
)
)

(defun a+objcreated (Reac Args / ent)
(setq ent (cadr args))
(if (and
(null (member ent objcreated))
)
(progn
(setq objcreated (cons ent objcreated))
)
)
)

(defun a+commandended (Reac Args / ent entl vla)
(foreach ent objcreated

(if (and
ent
(setq entl (entget ent))
(member (cdr (assoc 0 entl)) (list "DIMENSION" "LEADER"))
(/= (cdr (assoc 8 entl)) "DIMENSION")
)
(progn
(setq vla (vlax-ename->vla-object ent))
(vla-put-layer vla "DIMENSION")
(vla-update vla)
)
)
)
(setq objcreated nil)
(princ)
)

(princ "\n Dimdef Loaded for more go to www.cadaplus.com :)")
(princ)

 

now will not crash