Hey Everyone,
I've worked on a command that automatically imports a dwg into paperspace and positions it. I've just realized that when imported vertically, the titleblock is on the wrong side of the layout. I've imported it to (10,10,0) and would ideally like to import to those exact opposite co-ordinates to essentially flip it but i'm a bit unclear as to how. I know that I can use the commands Database.PextMax and Database.PextMin to determine the max and min points of the primary layout, but what co-ordinates are these, are they the top right corner and bottom right corner, how do i tell? Also, is there any documentation on these commands?
Thanks
Vince
For what it's worth, here's my routine:
string dwgName = HostApplicationServices.Current.FindFile(comp, acadApp.DocumentManager.MdiActiveDocument.Database, FindFileHint.Default);
Database db1 = new Database(false, false);
db1.ReadDwgFile(dwgName, System.IO.FileShare.Read, true, "");
ObjectId BlkId;
BlkId = doc.Database.Insert(dwgName, db1, false);
BlockTable bt = (BlockTable)tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead, true);
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.PaperSpace], OpenMode.ForWrite);
BlockReference bref = new BlockReference(new Autodesk.AutoCAD.Geometry.Point3d(10, 10, 0), BlkId);
btr.AppendEntity(bref);
tr.AddNewlyCreatedDBObject(bref, true);
bref.ExplodeToOwnerSpace();
bref.Erase();
tr.Commit();
}
finally
{
tr.Dispose();
}
}
}
Solved! Go to Solution.
Solved by Irvin. Go to Solution.
Solved by Irvin. Go to Solution.
Hello vince,
If i understand your question please look at the next lines:
'these sysvars gives us the true LL and UR paper edges
pvEdge1 = ThisDrawing.GetVariable("LIMMIN")
pvEdge2 = ThisDrawing.GetVariable("LIMMAX")
Kind regards Irvin
Ok awesome thanks, is it possible to re-assign the grip points of my block? So for example, i have a vertical titleblock that I would like to position on the right hand side of the page. The only point i have that is constant regardless of page size is my LIMAX. Unfortuantely my grip point of my titleblock is the lower right corner, so when i assign it its new coordinates, it flys almost entirely off the page. Ideally i'd like to position it using the lower right hand corner.
Thanks
I don't understand you question verry whell but if you mean you got a stamp and you need to insert this on the lower left corner you can you the x coordinate of limitmax .
so your insertionpoint whill be (limitmax x, limitmin y)
Kind regards,
Irvin
Thanks Irvin, i'm actually trying to insert my block on the lower left-hand corner. If i use limit-max, my block goes off the page.
Cheers
Hi there,
If you need to change the insertion point of the block you can open that block in the block editor.
The 0,0 coordinate is the insertion point from that block. If you move the entity's you can change the insertion point
Irvin
From searching help for 'drawing limits': Pextmin and Pextmax - Returns the extents of the current Paper space layout.
Thanks, i've set the blockreference as follows
BlockReference bref = new BlockReference(pMax, BlkId);
and i've set up the switches for pMax as follows:
string comp = "";
//these are the switches based upon the value sent by the form
if (y == 1)
{ comp = "C:\\ACADSTUFF\\tbmetric.dwg";
pMax = new Point3d(10, 10, 0);
}
if (y == 2)
{ comp = "C:\\ACADSTUFF\\tbmetricv.dwg";
pMax = new Point3d(db.Pextmax.X, 10, 0);
}
if (y == 3)
{ comp = "C:\\ACADSTUFF\\tbimperial.dwg";
pMax = new Point3d(10, 10, 0);
}
if (y == 4)
{ comp = "C:\\ACADSTUFF\\tbimperialv.dwg";
pMax = new Point3d(db.Pextmax.X, 10, 0);
}
but what i've noticed is that my block automatically imports at it's co-ordinates from it's original dwg. Even though i've specified a position a pMax, it won't obey. Am i doing something wrong or is this just a limitation?
Take a look at online docs:
Thanks for this, unfortunately i still can't seem to import my block at a specified postiion. This guide is great for modifying my views though, thanks.
I'll leave it for now, it seems to be working even though it shouldn't be, thanks to everyone for their help! As always, much appreciated
I think I've found why this trouble may be occurs
Take a look at:
http://autocadtips.wordpress.com/2011/10/04/layout-tab-cooridinates/
Hth