Link attributes to parameter.

How do I link an attribute to a parameter so that after adding a block with this attribute, if I enter the value = when inserting the block, it overwrites the attribute = and thus changes the length of the inserted block?

Comments

  • Via a lisp you can do this by selecting an attribute, enter a new value, the dynamic block is updated. Or again using a lisp to insert the block and update the length. Something like this.

    ;; 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)
    )
    )

    (defun c:insdyn ( / pt obj blkname)

    (setq blkname (getstring "\nEnter block name " T))

    (setq pt (getpoint "\nPick a pt for block "))
    (command "-insert" blkname "s" 1.0 pt 0)
    (setq obj (vlax-ename->vla-object (entlast)))

    ( LM:setdynpropvalue obj "Distance1" (getreal "\nEnter nmew length "))

    (princ)

    )