您是否注意到,通过更改工具选项板的视图,您可以将其外观更改为模仿工具栏(某种程度上)?(见下图)
至于Tim的评论,他的意思是您必须创建一个自定义插入例程来动态更改vis状态(或者您可以直接使用它)
- ;;;=================================================================================================
- ;;; Function: DYNAMIC_BLOCK_SETPROPERTY
- ;;;
- ;;; Description: Inserts a dynamic block, changes a specified property
- ;;; and automatically highlights it to enable dynamic grips
- ;;;=================================================================================================
- (defun DYNAMIC_BLOCK_SETPROPERTY (strBlockPath strBlockName strPropName strPropValue strAtt /
- lista lts pickset1 insPT objLast)
- (setvar "attdia" 0)
- (setq insPT (getpoint "\n Pick insertion point..."))
- (setq lts (getvar "ltscale"))
- (if (= strAtt "")
- (progn
- (if (= (tblsearch "block" strBlockName) nil)
- (command "-insert" (strcat strBlockPath strBlockName) insPT lts lts "")
- (command "-insert" strBlockName insPT lts lts "")
- )
- )
- (progn
- (if (= (tblsearch "block" strBlockName) nil)
- (command "-insert" (strcat strBlockPath strBlockName) insPT lts lts "" (strcase strAtt))
- (command "-insert" strBlockName insPT lts lts "" (strcase strAtt))
- )
- )
- )
- (setq objLast (entlast))
- (setq obj (if (= (type objLast) 'vla-object) objLast (vlax-ename->vla-object objLast)))
- (if (= (vlax-get-property obj 'isdynamicblock) :vlax-true)
- (progn
- (setq v (vla-getdynamicblockproperties obj)
- vval (vlax-variant-value v)
- sal (vlax-safearray->list vval)
- tot (length sal)
- i 0
- )
- (while (< i tot)
- (if (= (vlax-get-property (nth i sal) "PropertyName") strPropName)
- (progn
- (vlax-put-property (nth i sal) "Value" strPropValue)
- (setq i tot)
- )
- (setq i (1+ i))
- )
- )
- )
- )
- (setq pickset1 (ssadd))
- (ssadd objLast pickset1)
- (sssetfirst nil pickset1)
- (princ)
- )
按钮后面的代码看起来像这样…
- ^C^C^P(load "Blocks.lsp");(Dynamic_Block_SetProperty "YourDir" "Your Block Name" "Visibility" "Visibility State Name" "");
如果要插入的数据库具有属性,并且希望自动神奇地填充值…
- ^C^C^P(load "Blocks.lsp");(Dynamic_Block_SetProperty "YourDir" "Your Block Name" "Visibility" "Visibility State Name" "Your Attribute Value");
|