Hi guys i am looking for a way to import content from a dwg into my current drawing. ive seen several different code to import blocks from a drawing into another which i can do. but it needs to import all content of the model space into the current one at a user specified point. i cant seem to figure this out its way above my skill level if its possible
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Hi,
You can use this overload of the Database.Insert method.
Here's an example:
private static void InsertDwgContents(string fileName, Point3d insertionPoint)
{
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var transform = Matrix3d.Displacement(insertionPoint.GetAsVector());
using (var sourceDatabase = new Database(false, true))
{
sourceDatabase.ReadDwgFile(fileName, FileOpenMode.OpenForReadAndAllShare, true, null);
db.Insert(transform, sourceDatabase, true);
}
}
Can't find what you're looking for? Ask the community or share your knowledge.