.NET

Reply
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 1 of 9 (281 Views)

Copy Linetype from Another Database

281 Views, 8 Replies
08-17-2006 07:46 PM
Here is my situation:
I have 1 drawing open, I have another drawings Database open
I have found the LinetypeTableRecord (in the Database) of the line type I want to copy to the open drawing.

The Question:
How do I copy a LinetypeTableRecord from one drawing to another?
any examples would be helpfull.
Active Contributor
Techno Destructo
Posts: 47
Registered: ‎04-05-2006
Message 2 of 9 (281 Views)

Re: Copy Linetype from Another Database

08-18-2006 04:50 AM in reply to: Techno Destructo
Ok, here's the track I am on now. Im not sure its the right track mind you!

I think I have to use DeepClone, so here is what I tried:

Database db = HostApplicationServices.WorkingDatabse;

ObjectIdCollection vObjs = newObjectIdCollection();
vObjs(0) = Object Id of linetype I want to copy

db.DeepCloneObjects(vObjs,?????,false);

Now IF I am on the right track what goes where the ????? are?
The help says ObjectId is required there but ID of what? The LineTypeTable? (I tried that and it didn't work).
Distinguished Contributor
Alexander Rivilis
Posts: 303
Registered: ‎09-26-2004
Message 3 of 9 (281 Views)

Re: Copy Linetype from Another Database

08-18-2006 06:40 AM in reply to: Techno Destructo
db.WblockCloneObjects(...)
Contributor
ilya.s.solovyev
Posts: 15
Registered: ‎05-01-2012
Message 4 of 9 (176 Views)

Re: Copy Linetype from Another Database

07-24-2013 03:48 AM in reply to: Alexander Rivilis

I am using Database.WblockCloneObjects() to copy linetypes from external drawing. It works fine if linetype doesn't have a reference to complied shape file (.shx). If it does, linetypes are copied without shape-referenced part (e.g. geometries like rounds).

 

Is there any solution?

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 5 of 9 (147 Views)

Re: Copy Linetype from Another Database

07-25-2013 03:12 PM in reply to: ilya.s.solovyev

Is there a reason why you can't just use LoadLinetype()?

 

http://through-the-interface.typepad.com/through_the_interface/2010/03/loading-multiple-linetypes-in...





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Contributor
ilya.s.solovyev
Posts: 15
Registered: ‎05-01-2012
Message 6 of 9 (142 Views)

Re: Copy Linetype from Another Database

07-25-2013 06:38 PM in reply to: fenton.webb
Yes, I am using drawing templates to load all the stuff for my current drawing.
Actually, now I have switched to loading line types from file, but it'd be good for me to load from *.dwt.
ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 7 of 9 (132 Views)

Re: Copy Linetype from Another Database

07-26-2013 11:10 AM in reply to: ilya.s.solovyev

Just use Database.Insert("dwtFile.dwt",,,)





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Contributor
ilya.s.solovyev
Posts: 15
Registered: ‎05-01-2012
Message 8 of 9 (114 Views)

Re: Copy Linetype from Another Database

07-28-2013 07:02 PM in reply to: fenton.webb

Are you shure about this?

 

There are three overloads and only two of them accept string parameters, which are blockName from another database, as I understand:

public void Insert(Matrix3d transform, Database dataBase, bool preserveSourceDatabase);
public ObjectId Insert(string blockName, Database dataBase, bool preserveSourceDatabase);
public ObjectId Insert(string sourceBlockName, string destinationBlockName, Database dataBase, bool preserveSourceDatabase);

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 9 of 9 (98 Views)

Re: Copy Linetype from Another Database

07-29-2013 09:04 AM in reply to: ilya.s.solovyev

Something like this http://forums.augi.com/showthread.php?145986-Insert-External-DWG-file-with-attributes





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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