Jump to content

ActiveX Inquiry


ojacomarket

Recommended Posts

I have to investigate the BlockReference properties in order to find those constants, which I could use later in other drawings also, but got only that "????????????"

 

Could you have an idea, friends?

(setq p1 (vlax-ename->vla-object (car (entsel))))
(setq p2 (vla-getattributes p1))
(setq p3 (vlax-safearray->list (vlax-variant-value p2)))

					Returns>>

#<VLA-OBJECT IAcadBlockReference 0000025e15206e28> 
_$ 

#<variant 8201 ...> 
_$ 
ActiveX Server returned an error: ???????? ??????

 

Link to comment
Share on other sites

(setq p3 (vlax-invoke p1 'GetAttributes))

 

And if your block has attribute(s), it will return a list of all the VLA-Object representing each attribute of the selected block, including its tag name, text string, etc... 

 

But if the object you select at p1 doesn't have the GetAttributes method, then the above will fail because you're trying to invoke a method on an object that doesn't actually support that method. You can find out what methods are supported for a object by using vlax-dump-object... For example:

 

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

 

And all the properties and methods will be printed into the console.

Edited by Jonathan Handojo
  • Thanks 1
Link to comment
Share on other sites

4 minutes ago, Jonathan Handojo said:

(setq p3 (vlax-invoke p1 'GetAttributes))

 

And if your block has attribute(s), it will return a list of all the VLA-Object representing each attribute of the selected block, including its tag name, text string, etc... 

_$ 

nil 
_$ 

Returns nil... but how could it be possible, the block exists and could be inserted into drawing, but has no attributes to inspect wtf.:/

 

Is it somehow related to "reactors" or something like this..?

Edited by ojacomarket
Link to comment
Share on other sites

1 minute ago, ojacomarket said:

_$ 

nil 
_$ 

Returns nil... but how could it be possible, the block exists and could be inserted into drawing, but has no attributes to inspect wtf.:/

 

Well, do you know what block attributes are in the first place?

Link to comment
Share on other sites

Or actually, if you want to inspect the properties of that block, simply use (vla-get- followed by the property you want to inspect.

 

For example, a block has an insertion point and effective name, so you can do (vla-get-InsertionPoint p1) or (vla-get-EffectiveName p1). When you inspect the VLA block, you get a full list of properties you want to get.

  • Thanks 1
Link to comment
Share on other sites

6 minutes ago, Jonathan Handojo said:

(setq p3 (vlax-invoke p1 'GetAttributes))

 

And if your block has attribute(s), it will return a list of all the VLA-Object representing each attribute of the selected block, including its tag name, text string, etc... 

 

But if the object you select at p1 doesn't have the GetAttributes method, then the above will fail because you're trying to invoke a method on an object that doesn't actually support that method. You can find out what methods are supported for a object by using vlax-dump-object... For example:

 


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

 

And all the properties and methods will be printed into the console.

Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   ConvertToAnonymousBlock ()
;   ConvertToStaticBlock (1)
;   Copy ()
;   Delete ()
;   Explode ()
;  							>>>>>>>>>>. GetAttributes () <<<<<<<<<<<<<
;   GetBoundingBox (2)
;   GetConstantAttributes ()
;   GetDynamicBlockProperties ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   ResetBlock ()
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

Not it doesn't..
So how could I relate to my blockreferenced, I only expected via GetAttributes..

Link to comment
Share on other sites

20 minutes ago, ojacomarket said:

I have to investigate the BlockReference properties in order to find those constants, which I could use later in other drawings also, but got only that "????????????"

 

Could you have an idea, friends?


(setq p1 (vlax-ename->vla-object (car (entsel))))
(setq p2 (vla-getattributes p1))
(setq p3 (vlax-safearray->list (vlax-variant-value p2)))

					Returns>>

#<VLA-OBJECT IAcadBlockReference 0000025e15206e28> 
_$ 

#<variant 8201 ...> 
_$ 
ActiveX Server returned an error: ???????? ??????

 

 

What constants are you referring to?

Link to comment
Share on other sites

1 minute ago, Jonathan Handojo said:

 

What constants are you referring to?

Maybe not good expressed on a Lisp language :)
I meant that I would like to find those values of BlockReferenced objects, that will not change from drawing to drawing and,

                                                                                                                                                                        consequently, which I could reffer to my block in another drawings and CAD sessions

Because as it shows before, just reffering to (0 . "INSERT") type won't draw me desired block on my NEW drawing session

Link to comment
Share on other sites

12 minutes ago, ojacomarket said:

Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   ConvertToAnonymousBlock ()
;   ConvertToStaticBlock (1)
;   Copy ()
;   Delete ()
;   Explode ()
;  							>>>>>>>>>>. GetAttributes () <<<<<<<<<<<<<
;   GetBoundingBox (2)
;   GetConstantAttributes ()
;   GetDynamicBlockProperties ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   ResetBlock ()
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

Not it doesn't..
So how could I relate to my blockreferenced, I only expected via GetAttributes..

 

You can only invoke a method if it pertains to the block. i.e. It has attributes.

 

You should use

 

(if (= :vlax-true (vlax-get-property p1 'hasattributes)) (setq p3 (vlax-invoke p1 'getattributes)))

 

Link to comment
Share on other sites

You expect to (entsel) from the current drawing and get attributes from the same block from another drawing? How's that gonna work?

 

I mean it's not impossible, can be done using DBX.

Edited by Jonathan Handojo
Link to comment
Share on other sites

3 minutes ago, Jonathan Handojo said:

You expect to (entsel) from the current drawing and get attributes from the same block from another drawing? How's that gonna work?

 

I mean it's not impossible, can be done using ARX.

The only way is to invoke "Open drawing, that contain desired block" and then apply it into new drawing session?

 

My point was that, I could use BlockReferenced data from another drawing (template), since it couldn't be done from simple (entmake (cons 0 "INSERT"))

 

But I have to somehow store those Attributes of this block and then in the new drawing I could connect it, like to you use same function ENTMAKE to place this block on desired place of drawing, if got me..I hope :DD

Link to comment
Share on other sites

Linking to other drawings is possible, but not as simple as just an entmake function.

 

Maybe this will tell you how much effort is put to access drawings from another drawing. Purge the current block first in the current drawing though.

  • Thanks 1
Link to comment
Share on other sites

  • SLW210 changed the title to ActiveX Inquiry

If its a case of say getting attributes in simple method 2 lisps but ran individually.

ran in 1st dwg dump atts -> text file

ran in 2nd dwg Get atts -> text file

 

Why not just copy and paste between the 2 dwgs no code required.

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, BIGAL said:

If its a case of say getting attributes in simple method 2 lisps but ran individually.

ran in 1st dwg dump atts -> text file

ran in 2nd dwg Get atts -> text file

 

Why not just copy and paste between the 2 dwgs no code required.

Thanks for response, I got you idea!

1. It takes time to copy and paste (even if it is couple secs)

2. If I have many objects on drawing, that require to place a block on it, I find it too boring to place every block on right position, rather I use code to place them automatically

Link to comment
Share on other sites

1 hour ago, BIGAL said:

Look into palettes and that may help, or a library of block dwgs the when you do a insert it will be based around a known insert point.

By now, I have an idea, how to extract those properties, but cannot bound them, I had a proper look at Lee Mac code, but won't copy that, cuz insterested also in programming hah.


So i downloaded the AutoCAD: Bible by David M.Stein, I hope I got an idea from this book, how to bound complicated functions and use them.

As always, thank you for the feedbacks and comments, appreciate!

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