ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AcDbTable and dwg In/Out Fileds

1 REPLY 1
Reply
Message 1 of 2
MikeB_2K4
685 Views, 1 Reply

AcDbTable and dwg In/Out Fileds

I have a custom entity which is a title block. I would like to add a BOM (Bill Of Materials) to this title block. I tried to use a non-database resident table for this but it doesn't seem to work. It draws the table when I first add it, but after saving the drawing and re-open it, the table doesn't get drawn. In my titleblocks dwginfields and dwgoutfields functions I file the table using its dwginfileds and dwgoutfields functions. This works for every other sub entity I have created, and seems to work for the table, but.....
[code]
Acad::ErrorStatus TitleBlock::dwgInFields(AcDbDwgFiler* pFiler)
{
...
...
return _hardware.dwgInFields(pFiler);
}

Acad::ErrorStatus TitleBlock::dwgOutFields(AcDbDwgFiler* pFiler)
{
....
....
return _hardware.dwgOutFields(pFiler);
}
[/code]

This leads me to a couple of questions:
1) Do I have to file in / out all of the table properties and data.
2) Should I be adding the table to the database?

Any suggestions?

Mike B
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: MikeB_2K4

Hi Mike,
If you create an AcDbTable, it is an Entity, so you got to add it to the DWG
file Database. If not, you can not see it in the next time you enter the DWG
file.
Try these lines:

//You create the table:
AcDbTable *pTable = 0;

pTable = new AcDbTable();

...........//Do what you want to define the table

AcDbBlockTableRecord *pBlockTableRecord = 0;

AcDbBlockTable *pBlockTable = 0;

acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable,AcDb::kForRead);

pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);

pBlockTable->close();

if(!pBlockTableRecord)

errorTreatment(); //Do not continue.

AcDbObjectId objectId;

pBlockTableRecord->appendAcDbEntity(objectId, pTable);//Main Idea - to
append the Entity.

pBlockTableRecord->close();

pTable->close();

Regards,

Nirit



wrote in message news:5619215@discussion.autodesk.com...
I have a custom entity which is a title block. I would like to add a BOM
(Bill Of Materials) to this title block. I tried to use a non-database
resident table for this but it doesn't seem to work. It draws the table when
I first add it, but after saving the drawing and re-open it, the table
doesn't get drawn. In my titleblocks dwginfields and dwgoutfields functions
I file the table using its dwginfileds and dwgoutfields functions. This
works for every other sub entity I have created, and seems to work for the
table, but.....
[code]
Acad::ErrorStatus TitleBlock::dwgInFields(AcDbDwgFiler* pFiler)
{
...
...
return _hardware.dwgInFields(pFiler);
}

Acad::ErrorStatus TitleBlock::dwgOutFields(AcDbDwgFiler* pFiler)
{
....
....
return _hardware.dwgOutFields(pFiler);
}
[/code]

This leads me to a couple of questions:
1) Do I have to file in / out all of the table properties and data.
2) Should I be adding the table to the database?

Any suggestions?

Mike B

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost