- (vl-load-com)
- (setq olayer (GETVAR "CLAYER"))
- (if (not COMSTART)
- (setq COMSTART
- (vlr-editor-reactor
- NIL
- '((:vlr-commandwillstart . COMS)
- ;;(:vlr-commandended . COME)
- )
- )
- )
- )
- (defun COMS (OBJREACTOR LSTCOMMAND)
- (setq lst1 '("DIMLINEAR" "DIMANGULAR" "DIMARC"
- "DIMDIAMETER" "DIMORDINATE" "DIMRADIUS"
- "DIMJOGGED" "DIMALIGNED" "DIMCONTINUE"
- "DIMBASELINE"
- )
- )
- (setq lst2 '("HATCH" "BHATCH"))
- (setq lst3 '("TEXT" "DTEXT" "MTEXT"))
- (COND ((member (car LSTCOMMAND) lst2)
- (IF (/= olayer "HATCH")
- (setvar "clayer" "001-建筑-墙体填充") ;_打剖面线时自动切换到"001-建筑-墙体填充"层
- )
- )
- ((member (car LSTCOMMAND) lst1)
- (IF (/= olayer "DIM")
- (setvar "clayer" "001-建筑-标注") ;_标注尺寸时自动切换到"001-建筑-标注"层
- )
- )
- ((member (car LSTCOMMAND) lst3)
- (IF (/= olayer "TXT")
- (setvar "clayer" "002-平面-文字") ;_打文字时自动切换到"002-平面-文字"层
- )
- )
- (t (setvar "clayer" olayer))
- )
- (princ)
- )
- (setvar "clayer" olayer)
输入完文字后需要手动re一下才能恢复原图层
|