Accessing Properties of an Existing Polar Array

Accessing Properties of an Existing Polar Array

wicj2015
Participant Participant
461 Views
4 Replies
Message 1 of 5

Accessing Properties of an Existing Polar Array

wicj2015
Participant
Participant

As I iterate through all blocks of a drawing, I need to be able to identify a block as a polar array and then find the number of items in that array.

 

To be clear, this array already exists on the drawings, so I don't need the ArrayPolar method for creating one.

 

I am reasonably experienced with exploring various aspects of most blocks, but this one has me stumped, so any guidance in the right direction would be very appreciated. I would not be adverse to using LISP although I am not as well versed in it.

 

T.I.A.

 

0 Likes
462 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor

Array of entities created with "Array" command is a special dynamic/anonymous block reference. Its properties related to the array (row/column/space/direction...) are not exposed to COM API/VBA. So sorry, you cannot have access to these properties.

 

However, if you do AutoCAD .NET API, then you can have access to them (another reason to abandon VBA and move on?).

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 5

wicj2015
Participant
Participant

Thank you for the response, Norman, and for, unfortunately, confirming what I've suspected about array of entities.

 

VBA in AutoCAD has definitely been an exercise in frustration and, in this case, futility.  While it's an incredibly powerful tool, compared to MSOffice VBA, I have found it convoluted, esoteric and unintuitive.

 

I did a quick search for porting VBA to .NET and it seems it is possible, but the size of my current project would make it an extremely time-consuming endeavor (not to mention the learning curve for me with .NET).  For now, I'll investigate the possibility of calling a .NET routine from VBA as a workaround. 

0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor

Well, AutoCAD VBA being incredibly powerful tool or not is determined by AutoCAD exposed COM APIs, and it has been on its dying bed for so long. The 64-bit only for last a few year is almost the last nail to the coffin, because it is nearly impossible to add useful UI to VBA solutions.

 

As for calling .NET routine from VBA, I would rank it as the VERY last/desperate measure to take, even behind moving away from VBA to rewrite in .NET API: it likely causes more troubles later on: just image: you still need to learn/write code in AutoCAD .NET API; you still have to make sure the .NET DLL to be loaded before your VBA runs; you have to expose the .NET DLL as COM server, and install/register it on every computer that run the VBA code (as local administer), which you may have to redo it all over again if the .NET code is modified. So, I'd avoid it at all cost.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 5 of 5

wicj2015
Participant
Participant

I agree with all of your points. The installation of the DLL on every computer is enough of a deterrent.

 

Thanks again for the input.

 

Best regards,

 

CJ

0 Likes