AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Entity belong to current or attached drawing?

4 REPLIES 4
Reply
Message 1 of 5
trangasatish
596 Views, 4 Replies

Entity belong to current or attached drawing?

Hi,
How to find out an entity belongs to the current drawing or to any attached drawing(s) using .NET API?

Thanks,
Ranga
4 REPLIES 4
Message 2 of 5
djonio
in reply to: trangasatish

Entity e;
string filename = e.Database.Filename;

DBObject obj = trans.GetObject(wrkEntityId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead);
string whereAmIfrom = obj.Database.Filename;

r,
dennis
Message 3 of 5
Anonymous
in reply to: trangasatish

If you are using Map Objects, they have 2 properties:

MapObjectId.ObjectHandle and MapObjectId.DrawingId

-gnb

"trangasatish" wrote in message news:6371788@discussion.autodesk.com...
> Hi,
> How to find out an entity belongs to the current drawing or to any
> attached drawing(s) using .NET API?
>
> Thanks,
> Ranga
Message 4 of 5
trangasatish
in reply to: trangasatish

Dear Dennis,
I have tried your method...

There are 2 entities in my drawing, 1 is from the attached drawing and the other one I have digitized in the current drawing. For both the entities I am getting the obj.Database.Filename as...

1. C:\Documents and Settings\\Local Settings\Application Data\Autodesk\Autodesk Map 3D 2007\R17.0\enu\Template\map2d.dwt

2. C:\Documents and Settings\\Local Settings\Application Data\Autodesk\Autodesk Map 3D 2007\R17.0\enu\Template\map2d.dwt

Is there any alternative methods...

Thanks,
Ranga
Message 5 of 5
trangasatish
in reply to: trangasatish

Hi,
I got the solution from this thread...
http://discussion.autodesk.com/forums/thread.jspa?messageID=6033118�

Solution is...
1. Iterate on project drawing objects
2. Get the object's origin drawing using: HostMapApplicationServices.Application.ActiveProject.GetSourceDrawingId(objId);
3. Note: Beware of exception thrown if the object is not queried from an attached drawing.

Thanks,
Ranga Edited by: trangasatish on Apr 13, 2010 9:45 PM

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

Post to forums  

Autodesk Design & Make Report

”Boost