附属的。dwg为空白,其中包含一个块。代码如下
- (defun C:tblk(); will have 5 parameters used to modify block attributes
- (setq oattreq (getvar 'attreq))
- (setvar 'attreq 0)
- (command "_insert" "IO")
- (command "S" "1" "R" "0")
- (setvar 'attreq oattreq)
- ; (LM:setdynpropvalue ( (vlax-ename->vla-object (entlast)) "Visbility1" "4")
- (LM:SetVisibilityState ( (vlax-ename->vla-object (entlast)) "4")
- )
- ;; Set Dynamic Block Property Value - Lee Mac
- ;; Modifies the value of a Dynamic Block property (if present)
- ;; blk - [vla] VLA Dynamic Block Reference object
- ;; prp - [str] Dynamic Block property name (case-insensitive)
- ;; val - [any] New value for property
- ;; Returns: [any] 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)
- )
- )
- ;; 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] VLA Dynamic Block Reference object
- ;; val - [str] Visibility State Parameter value
- ;; Returns: [str] 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)
- )
- )
LDT。图纸 |