PDA

View Full Version : Help! Automatically grabbing 'Title Attribute' data



Gavin.Ostlund
2004-10-20, 06:52 PM
I'm attempting to write an app using API calls to automatically grab the information in the "Title Attribute" block, but am encountering some difficulties. I've gotten to the point where I'm able to extract the text fields from the block, but am not able to get the data that should be contained in those fields. I follow the following process:
Open AutoCad & Drawing
Iterate through $drawing->Blocks until I find the block that has the words 'Title Attribute' in it
Iterate through each $block->Item() of the appropriate block

Each of the items in $block->Item() should are an 'ACADEntity' and I'm able to get from them attributes like 'ObjectName', 'TextString', 'TagString' and so on. The problem is that none of the *String properties contain the information that I would anticipate that they should have in it, except of course for the 'PromptString' which contains the prompt label that appears beside the text box in the actual Edit Attributes window.

I'm at a bit of a loss as to how to proceed, I thought I was looking at the data the right way, but it doesn't appear to be so. If anyone has any suggestions or solutions, it would be most appreciated.

Ed Jobe
2004-10-20, 07:43 PM
This is a common question. Its just a matter of learning the ActiveX object model. The AcadBlock object corresponds to a block definition and the AcadBlockReference object corresponds to an insertion of a block. Think back to how you do it manually. You define a block with attributes and then insert it. Where do you edit the attributes? In the def or the insertion? Ans: from the insert and you've been working with the def. Likewise, attributes have two objects, AcadAttribute (the definition in the block def) and AcadAttributeReference (the att in the insertion). For an example, see help for the GetAttributes method.

Also, you can search this forum for some of those terms.

Gavin.Ostlund
2004-10-21, 07:32 PM
Thanks for the info! I'm actually writing this program in PHP, using the COM support to perform the appropriate tasks in AutoCAD 2000i. It's proving to be quite a challenge, but I've been enjoying it. Unfortunately I've actually just been informed that this project is to come to a halt, we don't have a need for it anymore, but I may try and finish it up when I have some spare time as I know some people might be interested in seeing it. Appreciate your help in working with this problem, I must admit that prior to working on this project, I'd never even used a recent version of AutoCAD... last time I used the software it seems to bring images to my mind of DOS, probably R10 or R12, something like that... Somewhat more familiar with 3D Studio Max myself, but I'm a programmer, not a artist or designer, so not a whole lot of working knowledge of these programs.

Thanks again for the help!

Kyrin