Copy Linetype from Another Database

Copy Linetype from Another Database

Anonymous
Not applicable
1,003 Views
8 Replies
Message 1 of 9

Copy Linetype from Another Database

Anonymous
Not applicable
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.
0 Likes
1,004 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
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).
0 Likes
Message 3 of 9

Anonymous
Not applicable
db.WblockCloneObjects(...)
0 Likes
Message 4 of 9

Anonymous
Not applicable

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?

0 Likes
Message 5 of 9

fenton_webb
Autodesk
Autodesk

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
AutoCAD Engineering
Autodesk

0 Likes
Message 6 of 9

Anonymous
Not applicable
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.
0 Likes
Message 7 of 9

fenton_webb
Autodesk
Autodesk

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




Fenton Webb
AutoCAD Engineering
Autodesk

0 Likes
Message 8 of 9

Anonymous
Not applicable

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);

0 Likes
Message 9 of 9

fenton_webb
Autodesk
Autodesk

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




Fenton Webb
AutoCAD Engineering
Autodesk

0 Likes