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)

    )

  • @ALANH

    I tried but without good results.

    Bricscad cannot create dynamic blocks. or I miss something?

    In the parametric block I tried to give a 2d constraint and a parameter and also the stretch function, all 3 at the same time also separated, just parameter or stretch, but my bricscad can't find parameter to change.

    For now, the only option is to create a dynamic block in AutoCAD and use it in BricsCAD.

    Or is the way how to create dynamic block in bricscad ?

  • Hi @Kardo , in V26 "Commands for creating dynamic blocks with actions and visibility states are available under experimental mode except in the USA region where it is not supported.

    A BEDIT session can now run in two mutually exclusive modes depending on the type of block:

    • the preexisting parametric block editing mode still exists and it disallows editing and creation of dynamic block.
    • A new dynamic block editing mode allows creation and editing of dynamic blocks and it disallows editing and creation of parametric blocks.
    • You can edit static blocks in both modes. Once you edit a static block to include dynamic or parametric features does the next BEDIT session for that block become locked into a mode."