How to access dynamic parameters as an entity name

How to access dynamic parameters as an entity name

Anonymous
Not applicable
1,683 Views
7 Replies
Message 1 of 8

How to access dynamic parameters as an entity name

Anonymous
Not applicable

Is there a way to access dynamic parameters as an entity name ?

 

For example in a block editor if I dump an flip parameter I get these:

 

((-1 . <Entity name: 7ff6022d6e50>))
; IAcadBlockFlipParameterEntity: IAcadBlockFlipParameterEntity Interface
; Property values:
; Angle = 0.0
; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff6034e3f10>
; BasePoint = (0.0 50.0 0.0)
; BaseStateLabel = "Not flipped"
; ChainActions = 0
; Document (RO) = #<VLA-OBJECT IAcadDocument 000000447200bc38>
; EndPoint = (100.0 50.0 0.0)
; EntityTransparency = "ByLayer"
; FlipDescription = ""
; FlipLabel = "Flip state1"
; FlippedStateLabel = "Flipped"
; Grips = 1
; Handle (RO) = "39D"
; HasExtensionDictionary (RO) = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000003ca5a471c8>
; LabelPosition = (100.0 50.0 0.0)
; Layer = "0"
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; Name = "Flip"
; ObjectID (RO) = 46
; ObjectName (RO) = "AcDbBlockFlipParameterEntity"
; OwnerID (RO) = 43
; PlotStyleName = "ByLayer"
; ShowProperties = -1
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000003ca5a48f60>
; Visible = -1

 

But when I get the block from the blocktablerecord and then i get entities with entnext function, I cannot get dynamic parameter entity.

0 Likes
1,684 Views
7 Replies
Replies (7)
Message 2 of 8

patrick_35
Collaborator
Collaborator

Hi

 

Try

(setq ent (vlax-ename->vla-object (car (entsel))))
(vlax-dump-object ent T)

 And

(mapcar 'vlax-dump-object (vlax-invoke ent 'getdynamicblockproperties))

@+

0 Likes
Message 3 of 8

Anonymous
Not applicable

Thanks for the reply, but with this method only properties I get is like this:

 

; IAcadDynamicBlockReferenceProperty: AutoCAD Dynamic Block Property Interface
; Property values:
; AllowedValues (RO) = (0 1)
; Description (RO) = ""
; PropertyName (RO) = "Flip state1"
; ReadOnly (RO) = 0
; show (RO) = -1
; UnitsType (RO) = 0
; Value = 0

 

But I'm trying to find the properties like "BasePoint = (0.0 50.0 0.0)", "EndPoint = (100.0 50.0 0.0)", "ChainActions = 0" etc.

0 Likes
Message 4 of 8

patrick_35
Collaborator
Collaborator

What do you want to do exactly and can you give an example ?

 

@+

0 Likes
Message 5 of 8

Anonymous
Not applicable

I' m trying to find the coordinates of the any parameter (flip, rotation, distance) in OCS. In block editor I can do that by selecting the parameter with entsel function. But I want to do same thing by only selecting the block. I can access all entities in block but not if it is a parameter.

0 Likes
Message 6 of 8

patrick_35
Collaborator
Collaborator

You can find everything by searching the anonymous block (not effective name) in the block table and using a matrix to transpose the coordinates.

 

@+

0 Likes
Message 7 of 8

hgasty1001
Advisor
Advisor

Hi,

 

Most of the work digging into the dynamic blocks structures using Autolisp was done by Andrey Lazebny (RIP)  several years ago in this blog: Dynamic Blocks .

 

Gaston Nunez

 

 

Message 8 of 8

Anonymous
Not applicable

Thanks for the solution... This was helpful for understanding dynamic blocks and lisp relations.

 

(defun c:flipsil ()
(setq parametreler nil)
(setq obje(entsel "\nLütfen bir blok seçin"));
(setq blk (vla-get-effectivename (vlax-ename->vla-object (car obje))))
(setq ent (tblobjname "block" blk))
(setq EVAL_GRAPH(entget(cdr(assoc 360 (entget(cdr (assoc 360(entget (cdr (assoc 330 (entget ent))))))))))) ;This part I found the entity that has parameters. 
(While (/= nil (assoc 360 EVAL_GRAPH))
(setq parameter (cdr (assoc 360 EVAL_GRAPH)))
(if (= (cdr (assoc 0 (entget parameter))) "BLOCKFLIPPARAMETER") ;there are some other (360. X) dotted pairs that belongs to parameters or some other things, so find which is flip parameter.
(progn
(setq parameterlist nil)
(setq parameterlist (cons (cdr (assoc 305 (entget parameter))) parameterlist)); Get parameter name
(setq parameterlist (cons (cdr (assoc 1010 (entget parameter))) parameterlist)); Get parameter axis line first point
(setq parameterlist (cons (cdr (assoc 1011 (entget parameter))) parameterlist)); Get parameter axis line second point.
(setq parameterlist (reverse parameterlist))
(setq parametreler (cons parameterlist parametreler))
)
)
(setq EVAL_GRAPH(vl-remove (assoc 360 EVAL_GRAPH) EVAL_GRAPH)); 
)

(setq secim (STD-SSLIST(getblockselection blk)))
(foreach block secim
(setq blockvla(vlax-ename->vla-object block))
(setq properties (LM:getdynprops blockvla))
(foreach flipparam parametreler
(setq flip (cdr(assoc (car flipparam) properties)))
(if (= flip 1)
(progn
(setq noktalar (cdr flipparam))
(setq nokta1 (car(apply 'LM:ApplyMatrixTransformation (cons noktalar (LM:WCS->Geom blockvla)))))
(setq nokta2 (cadr(apply 'LM:ApplyMatrixTransformation (cons noktalar (LM:WCS->Geom blockvla)))))
(setq block2 blockvla)
(setq blockvla(vla-mirror blockvla (vlax-3D-point nokta1) (vlax-3D-point nokta2)))
(vla-delete block2)

)
)
)
)
(princ)
)

0 Likes