.NET

Reply
Member
E3DE
Posts: 3
Registered: ‎07-10-2014
Message 1 of 3 (66 Views)
Accepted Solution

insert filtered and modified entities from external dwg

66 Views, 2 Replies
07-11-2014 01:46 AM

Hi,

I'm porting old objectarx plugin to .net.

I need to read external dwg, filtering some entities by layer, change layer to entities, and then insert only the filtered entities into current dwg.

Souces entities can be also blockreference and can have xrecord attacched.

 

In old c++ program this was the step:

1) readdwg to new database from source dwg

2) loop on blocktable record and filter entities id in object id collections and change layer

3) using wblock with object id collections to another temp db

4) insert temp db in current dwg whith db.Insert(xform, tempdb)

 

After these steps in c++ plugin (autocad 2011), in current dwg i have all single filtered entities from source dwg.

 

After porting in c# (autocad 2013) i have dirrente behaviour in step 4:

 

If i use Insert declination like in c++:

Database.Insert(new Matrix3d(), tempdb, true);

i have single entities except blockreference (but there are block definitions in dwg)

 

If i use:

Database.Insert(blockName, tempdb, true);

and then insert the blockName as reference i see al source entities (including blockreference), but i have all inside a block,

and this is not my goal, i need single entities and i don't want to explode block.

 

what is the problem?

 

thank you very much

You may find useful this example from Kean's blog http://through-the-interface.typepad.com/through_the_interface/2006/08/import_blocks_f.html

Maybe you need to treat BlockReferences separately.

Distinguished Contributor
mcicognani
Posts: 125
Registered: ‎12-01-2004
Message 2 of 3 (63 Views)

Re: insert filtered and modified entities from external dwg

07-11-2014 02:06 AM in reply to: E3DE

You may find useful this example from Kean's blog http://through-the-interface.typepad.com/through_the_interface/2006/08/import_blocks_f.html

Maybe you need to treat BlockReferences separately.

Member
E3DE
Posts: 3
Registered: ‎07-10-2014
Message 3 of 3 (40 Views)

Re: insert filtered and modified entities from external dwg

07-11-2014 08:54 AM in reply to: mcicognani

thank you!

 

at this point i prefer use Insert(blockname, db) that creare a complete insert with blockreferences,

and then iterating and modify (scale) the nested blockreferences.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.