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

Copy entity data to dwg buffer

3 REPLIES 3
Reply
Message 1 of 4
Bica.Bogdan
508 Views, 3 Replies

Copy entity data to dwg buffer

Hello,

I'm wondering if it's possible to copy data about one or more AcRxObject(AcDbEntity to be more precise) in the DWG format to a buffer.

Any ideas?

3 REPLIES 3
Message 2 of 4
Balaji_Ram
in reply to: Bica.Bogdan

Hello,

 

When you save a drawing, AutoCAD creates an instance of the AcDbDwgFiler and passes it to all the entities that requires a save. Entities write the information about themselves using that filer instance.

 

On similar lines, it is possible to implement your own DwgFiler by deriving from AcDbDwgFiler and implement its virtual methods such that they write to a buffer. The instance of your custom filer can then be passed on to the entities that you are interested in by calling its "dwgOutFields".

So, yes, it is possible to do that.

 

But, if you can explain more about what you are trying to achieve by this technique, other experts in this forum may suggest an alternate way of doing it without needing this technique if that is possible.

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
Bica.Bogdan
in reply to: Balaji_Ram

Hi!

I was aware of the AcDbDwgFiler, and the possibility of deriving from it, i just haven't been able to figure out (i'm probably blind) how to point out a buffer to the filer. Sorry if i am not clear enough.

 

I only need to save some entities in one of our own file formats.

There we need to create a "DWG SECTION" where we save information about the entities in binary.

So suppose i iterate through the database and stumble upon an entity i need to save.

Do i call dwgOutFields on it, or are there other intermediate steps? And how to i instantiate an AcDbDwgFiler derived object that points to a buffer?

Thanks for taking interest in my problem.

 

Message 4 of 4
Balaji_Ram
in reply to: Bica.Bogdan

Hello,

 

I dont understand what you mean by "AcDbDwgFiler derived object that points to a buffer"

 

The buffer is a class member variable that you will maintain in your derived class.

 

Let me clarify how this might work :

 

1) Derive a class from AcDbDwgFiler, say AcDbMyDwgFiler

 

2) Have a buffer (say of type AcString) as a class member variable in AcDbMyDwgFiler class

 

3) Override all the virtual methods of AcDbDwgFiler and provide an implemention of those methods such that they update the AcString member variable. For example, the "writeDouble" method should update the string based on the double parameter.

 

Regarding the usage of the AcDbMyDwgFiler :

 

When you iterate the model space and find entities that interest you, then create an instance of the AcDbMyDwgFiler by getting its AcRxClass and using it to call the "AcRxClass::create" method.

 

Finally call the dwgOutFields method on the entity and pass-in the instance of AcDbMyDwgFiler.

 

Now you have the buffer from the AcDbMyDwgFiler class and you can use it as you need it.

 

Hope this clarifies.



Balaji
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report

”Boost