Jump to content

Difference between static and dynamic blocks (programmically)


Recommended Posts

Posted

Hi. Does anyone know if dynamic blocks contain difference DXF codes or any way of differentiating between regular blocks and dynamic blocks. thanks!

Posted

ActiveX object of block has IsDynamicBlock property.

 

Command: (vl-load-com)
Command: (setq vlaBl(vlax-ename->vla-object(car(entsel))))
Select object: #<VLA-OBJECT IAcadBlockReference 0e83853c>
Command: (vla-get-IsDynamicBlock vlaBl)
:vlax-true

Posted
ActiveX object of block has IsDynamicBlock property.

 

Command: (vl-load-com)
Command: (setq vlaBl(vlax-ename->vla-object(car(entsel))))
Select object: #<VLA-OBJECT IAcadBlockReference 0e83853c>
Command: (vla-get-IsDynamicBlock vlaBl)
:vlax-true

 

Cool, I can handle that. thank you.

Posted
ActiveX object of block has IsDynamicBlock property.

 

Command: (vl-load-com)
Command: (setq vlaBl(vlax-ename->vla-object(car(entsel))))
Select object: #<VLA-OBJECT IAcadBlockReference 0e83853c>
Command: (vla-get-IsDynamicBlock vlaBl)
:vlax-true

 

Is there any more information you can get about the dynamic block? Such as it's visibility or what type of action it uses?

Posted

a little off topic, but how would you insert a dynamic block, and then eddit the attributy things,

 

eg length and angle of a dynamic polor strech?

hence so this can become a lisp,

select 1 points and works out angle and length?

cheers

Posted
Is there any more information you can get about the dynamic block? Such as it's visibility or what type of action it uses?

 

eg length and angle of a dynamic polor strech?

hence so this can become a lisp,

select 1 points and works out angle and length?

cheers

 

This code can to copy visibility state from one block to others, try to analize it: http://www.asmitools.com/Files/Lisps/Vico.html

 

There is two function to get and put dynamic property:

 

(vl-load-com)

(defun GetDynamicProperty(Block Property / oVal)
 (if(= 'ENAME(type Block))
   (setq Block(vlax-ename->vla-object Block))
   ); end if
 (if(= :vlax-true(vla-get-IsDynamicBlock Block))
   (foreach p(vlax-safearray->list
	(vlax-variant-value
	  (vla-GetDynamicBlockProperties Block)))
     (if(=(strcase Property)(strcase(vla-get-PropertyName p)))
(if(vl-catch-all-error-p
     (setq oVal(vl-catch-all-apply
		 'vla-get-Value(list p))))
  nil
  (setq oVal(vlax-variant-value oVal))
  ); end if
); end if
     ); end foreach
   ); end if
 oVal
 ); end of GetDynamicProperty


(defun PutDynamicProperty(Block Property Value / oVal cVal)
 (if(= 'ENAME(type Block))
   (setq Block(vlax-ename->vla-object Block))
   ); end if
 (if(= :vlax-true(vla-get-IsDynamicBlock Block))
   (foreach p(vlax-safearray->list
	(vlax-variant-value
	  (vla-GetDynamicBlockProperties Block)))
     (if(=(strcase Property)(strcase(vla-get-PropertyName p)))
(progn
(setq cVal(vlax-make-variant Value vlax-vbDouble))
(if(vl-catch-all-error-p
     (vl-catch-all-apply
		 'vla-put-Value(list p cVal)))
   (setq oVal nil)(setq oVal Value)
  ); end if
 ); end progn
); end if
     ); end foreach
   ); end if
 oVal
 ); end of GetDynamicProperty

 

Testing with dynamic block witn standard "Distance" property:

 

Get block ename:

(setq bl(car(entsel)))
Select object: <Entity name: 7efa3390>

 

Get property "Distance":

Command: (GetDynamicProperty bl "Distance")
667.536

 

Resize block with puting new "Distance" value:

Command: (PutDynamicProperty bl "Distance" 100.0)
100.0

 

Excuse me guys. It isn't short conversation and I havn't today more time.

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...