Jump to content

send data to attributes inside a block


samifox

Recommended Posts

Hi

 

my program interviews the user and send the info to a dynamic block with attributes, i have some questions

 

1.how to communicate with the attributes so i can set their text?

2.how can i eliminate the default behavior of inserted blocks which is to set attributes first before the block is actually inserted.

 

i've attached the block for your convenience

Thanks

Shay

 

 

(vl-load-com)




(defun C:tst (/ stpt edpt vla-blk ss)
 (if (setq stpt (getpoint "\nclick start point"))
   (if	(setq edpt (getpoint stpt "\nclick end point"))
     (progn
(command "-insert" "re1" stpt "1" "" "0" "" "")
(setq vla-blk (vlax-ename->vla-object (entlast)))
(setq ss (ssadd (entlast)))
(sssetfirst nil ss)

(LM:setdynpropvalue vla-blk "Pin Length" 15)
(LM:setdynpropvalue vla-blk "Rebar Length" 600)
(LM:setdynpropvalue vla-blk "Angle" (angle stpt edpt))
     )
   )
 )
)



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




insert_block.LSP

Link to comment
Share on other sites

Hi

2.how can i eliminate the default behavior of inserted blocks which is to set attributes first before the block is actually inserted.

 

For item number two, since you area using the command "_insert", look into ATTREQ system variable.

 

BTW: where is the attached block?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...