Write / Read some information to block

Write / Read some information to block

Anonymous
Not applicable
807 Views
1 Reply
Message 1 of 2

Write / Read some information to block

Anonymous
Not applicable

I write one prorgam, that works good, but i have one problem.

 

I have some block. I insert one copy of my block to document.

I write to block some code by this function:

 

 

(setq spec '((0 . 1) 2 3 4 5 (6 . 7)))
(vlax-ldata-put vla "spec" spec).

 

 

So I can read this information by this function:

(vlax-ldata-get vla "spec")

>'((0 . 1) 2 3 4 5 (6 . 7))

My problem is that this information is in one copy of my block. I want to this information would be in all copies of this block. 

If I insert more copies of my block, it would have not this information.

 

So how I can put this information to block, to read it from any copyes of this block?

Sorry for my English:-(

0 Likes
Accepted solutions (1)
808 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution
I got answer on other forum:

We can write information to block definition

; Syntax (BlockLdataPut "MyBlockName" '(1 2 3))

(defun BlockLdataPut (strBlockName lstLdata / entBlockDefinition objBlockDefinition)
(and
(setq entBlockDefinition (tblobjname "block" strBlockName))
(setq objBlockDefinition (vlax-ename->vla-object entBlockDefinition))
(vlax-ldata-put objBlockDefinition "blockldata" lstLdata)
)
)

; Syntax (BlockLdata "MyBlockName")
(defun BlockLdata (strBlockName / entBlockDefinition objBlockDefinition)
(if
(and
(setq entBlockDefinition (tblobjname "block" strBlockName))
(setq objBlockDefinition (vlax-ename->vla-object entBlockDefinition))
)
(vlax-ldata-get objBlockDefinition "blockldata")
)
)
(vl-load-com)
0 Likes