更改DYN块可视化状态(命令行)?
是否有一种方法可以通过命令提示符更改块可见性状态?我正在四处交换秤。我想选择公司箭头,并将可见性状态更改为我需要的任何规模。我确定我错过了什么!再次感谢。**** Hidden Message ***** 从未在命令行尝试过
您能用autolisp完成吗?我有一个例程,根据视口的比例在条形图上设置文本。
我本想使用视口的字段部分,但…无法使用该部分。。。 我的大多数指北针都是注释性块....放置在模型空间中,以便根据世界UCS自动向北旋转。
插入后无需缩放或旋转它们。
由于paperspace指北针很难处理,而且不需要一些代码就能100%正确旋转。 好吧,我有机会找到一些有用的东西。李先生又这样做了
我想知道如何将(“成本计算”)更改为(“1”=10”)?我得到一个错误
;错误:输入的字符串太长
(setq blk "DWA STAMP" ;; Block Name
vis "For Costing" ;; New Visibility State
)
这是他的代码:
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-visibility-states-in-dynamic-block/td-p/5322263
(defun c:changevis ( / blk idx obj sel vis )
(setq blk "DWA STAMP" ;; Block Name
vis "For Costing" ;; New Visibility State
)
(if (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," blk)) '(410 . "~Model"))))
(repeat (setq idx (sslength sel))
(if (= (strcase blk) (strcase (LM:blockname (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx))))))))
(LM:SetVisibilityState obj vis)
)
)
)
(princ)
)
;; Block Name - Lee Mac
;; Returns the true (effective) name of a supplied block reference
(defun LM:blockname ( obj )
(if (vlax-property-available-p obj 'effectivename)
(defun LM:blockname ( obj ) (vla-get-effectivename obj))
(defun LM:blockname ( obj ) (vla-get-name obj))
)
(LM:blockname obj)
)
;; Set Dynamic Block Visibility State - Lee Mac
;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed)
;; blk - VLA Dynamic Block Reference object
;; val - Visibility State Parameter value
;; Returns: New value of Visibility Parameter, else nil
(defun LM:SetVisibilityState ( blk val / vis )
(if
(and
(setq vis (LM:getvisibilityparametername blk))
(member (strcase val) (mapcar 'strcase (LM:getdynpropallowedvalues blk vis)))
)
(LM:setdynpropvalue blk vis val)
)
)
;; Set Dynamic Block Property Value - Lee Mac
;; Modifies the value of a Dynamic Block property (if present)
;; blk - VLA Dynamic Block Reference object
;; prp - Dynamic Block property name (case-insensitive)
;; val - New value for property
;; Returns: New value if successful, else nil
(defun LM:setdynpropvalue ( blk prp val )
(setq prp (strcase prp))
(vl-some
'(lambda ( x )
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
(cond (val) (t))
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)
;; Get Dynamic Block Property Allowed Values - Lee Mac
;; Returns the allowed values for a specific Dynamic Block property.
;; blk - VLA Dynamic Block Reference object
;; prp - Dynamic Block property name (case-insensitive)
;; Returns: List of allowed values for property, else nil if no restrictions
(defun LM:getdynpropallowedvalues ( blk prp )
(setq prp (strcase prp))
(vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'allowedvalues)))
(vlax-invoke blk 'getdynamicblockproperties)
)
)
;; Get Visibility Parameter Name - Lee Mac
;; Returns the name of the Visibility Parameter of a Dynamic Block (if present)
;; blk - VLA Dynamic Block Reference object
;; Returns: Name of Visibility Parameter, else nil
(defun LM:getvisibilityparametername ( blk / vis )
(if
(and
(vlax-property-available-p blk 'effectivename)
(setq blk
(vla-item
(vla-get-blocks (vla-get-document blk))
(vla-get-effectivename blk)
)
)
(= :vlax-true (vla-get-isdynamicblock blk))
(= :vlax-true (vla-get-hasextensiondictionary blk))
(setq vis
(vl-some
'(lambda ( pair )
(if
(and
(= 360 (car pair))
(= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair)))))
)
(cdr pair)
)
)
(dictsearch
(vlax-vla-object->ename (vla-getextensiondictionary blk))
"ACAD_ENHANCEDBLOCK"
)
)
)
)
(cdr (assoc 301 (entget vis)))
)
)
(vl-load-com) (princ)
您将需要使用反斜杠转义字符转义字符串中的双引号,即:
"1\"=10'"
我很高兴您发现代码有用! 伙计,太棒了。真的真的太棒了!很容易改变,也很容易理解。再次感谢你!
页:
[1]