Author Topic: Dynamic Block Properties Quandary  (Read 3183 times)

0 Members and 1 Guest are viewing this topic.

MeyerForHire

  • Guest
Dynamic Block Properties Quandary
« on: January 05, 2012, 08:59:27 AM »
I’ll try to lay this question out logically………..

Using AutoCAD 2011

I have a dynamic desk block that I may or may not have inserted through code.

This dynamic desk block has three dynamic properties: Vertical Flip, Horizontal Flip, and a Rotation (Angle).

I want to insert a group of accessory blocks (task chair, guest chairs, lateral file, etc.) via VBA code.

I want this routine to work by selecting the desk block and figuring out the rest via code.

In order to insert the accessory blocks and orient them correctly, I need to gather information from the desk block such as: Is Vertical Flip = 1, Is Horizontal Flip = 1, what is the Rotation (Angle) equal to.

I have no problems with any of the above via code; it runs fine!

This is the sort-of-hard-to-explain portion of the post:

Let’s say I rotate the dynamic desk block by its angle grip by 90 degrees (ortho-on). Then, let’s say I flip the desk by its vertical flip grip. You would expect the dynamic angle property to be 90 degrees; and you would be correct.

After resetting the desk block…….Now let’s say I flip the desk by its vertical flip grip. Then I rotate the dynamic desk block by its angle grip by 90 degrees. You would expect the dynamic angle property to be 90 degrees; and you would be wrong! It’s now 270 degrees even though the block on the screen is identical to the first scenario and was gotten to by the same actions just in an alternate order.

QUESTION: If I run this routine on a “cold” block—I don’t know how it got to the angle and orientation it is currently at/in—how in the world do I determine the REAL angle given the above scenario?

Some other notes:

I am testing not only for dynamic angle properties, but also the block’s rotation properties just in case—those are accounted for.

I am testing not only for dynamic flip properties, but also the block’s X Scale property as well—those are also accounted for.

I have looked through all of the properties and methods associated with an AcadBlockReference Object including the XEffectiveScaleFactor and YEffectiveScaleFactor to no apparent avail.

Some ideas:
I figure I could use the Bounding Box and some basic geometric principles to try and determine the orientation of the desk block in conjunction with the insertion point. My guess is that this would entail either storing the “native” bounding box data in the Access DB I am using to store other information on these blocks, OR inserting a copy of the block at say 0,0,0 and determining the “native” bounding box data, then delete the copy and do my best to determine the orientation. However, that would entail a whole new slew of variables and actual knowledge of some basic geometric principles.

I’ll post the code if need be, but I really think this boils down to whether or not there is some property I can pull to figure out what the real rotation of the dynamic block is.

Thanks in advance!