style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<coddy> wrote in messageHello,
href="news:6120616@discussion.autodesk.com">news:6120616@discussion.autodesk.com...
In C#, can anybody give me some example code to insert a drawing as block
using jig? Thanks
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">Huh...
So your logic is - if he is as intolerant of others as you are then don't bother
learning something from that person? Hope you don't
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">code
with that brain!
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
href="http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro.html">...
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">OP
- Try this link - Kean has other samples too. Also keep a notepad handy while
watching those videos mentioned as some have a strong
accent.
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">The
good part is the more you understand the api the easier it is to understand the
speakers’ different accents. I assume you will be bright enough to
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman','serif'; mso-fareast-font-family: 'Times New Roman'">
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">understand
when the lecturer is fully qualifying his classes to make it easier for students
to understand what comes from where!
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family: 'Times New Roman'">You
can obviously us a ‘using’ directive so you don’t have to fully qualify
everything in your own code.
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Some time ago I found the following file on the
web: "DevTV - AutoCAD.NET Intro.wmv".
I remember there was something in it about jigs.
Could be what you're looking for.
P.S. If you can't stand guys who talk through
their nose and are reciting long strings of namespaces all the time, then
don't look at it.
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<coddy> wrote in messageHello,
href="news:6120616@discussion.autodesk.com">news:6120616@discussion.autodesk.com...
In C#, can anybody give me some example code to insert a drawing as block
using jig? Thanks
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<coddy> wrote in messageKean's
href="news:6120838@discussion.autodesk.com">news:6120838@discussion.autodesk.com...
code is excellent and that is what I want too. But, this code is to insert a
block that is already in the drawing. I would like to link this code to insert
an external drawing and then insert the block with jig. Can this be
accomplished? Thanks
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<coddy> wrote in messageI
href="news:6121558@discussion.autodesk.com">news:6121558@discussion.autodesk.com...
did so, but sends out "Insertion Point" command twice. How do I go about it?
[CommandMethod("test")] public void test() { string fName=@"C:\a.dwg";
Document doc =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
//Get the editor object Editor ed = doc.Editor; string blkName="a"; //Get the
working database Database dwg = doc.Database; //Start a transaction
Transaction tr = doc.TransactionManager.StartTransaction(); try { //Create
temporary database to read in block Database dbDwg = new Database(); //Read
the file from disk dbDwg.ReadDwgFile(fName, System.IO.FileShare.Read, true,
""); //Insert it into the current database. dwg.Insert(blkName, dbDwg, false);
dbDwg.Dispose(); //Open the block for read. BlockTable bt =
(BlockTable)tr.GetObject(dwg.BlockTableId, OpenMode.ForRead); //See if the
block table record exists if (bt.Has(blkName)) { //Prompt user for insertion
point PromptPointOptions po = new PromptPointOptions("Select insertion point:
"); //Get user to select the insertion point PromptPointResult pr =
ed.GetPoint(po); //user selected a valid point if (pr.Status ==
PromptStatus.OK) { //fix up the point to be a Point3D object Point3d pt = new
Point3d(pr.Value.X, pr.Value.Y, pr.Value.Z); ObjectId bId = bt[blkName];
//insert the block at the insertion point BlockReference br = new
BlockReference(pt, bId); BlockJig blkJig = new BlockJig(br); //Perform the jig
operation pr =(PromptPointResult) ed.Drag(blkJig); if (pr.Status ==
PromptStatus.OK) { //Add block reference to the current space BlockTableRecord
curSpace = (BlockTableRecord)tr.GetObject(dwg.CurrentSpaceId,
OpenMode.ForWrite); //Add the block reference to the current space
curSpace.AppendEntity(blkJig.GetEntity()); //Tell the transaction
tr.AddNewlyCreatedDBObject(blkJig.GetEntity(), true); //Commit transaction to
database tr.Commit(); } } else { MessageBox.Show("Block " + blkName + " does
not exists"); } } } catch (System.Exception ex) {
MessageBox.Show(ex.ToString()); } finally { //Always dispose of transaction
tr.Dispose(); } } Thanks Edited by: coddy on Feb 10, 2009 7:36 AM Edited by:
coddy on Feb 10, 2009 7:39 AM
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<coddy> wrote in messageIn
href="news:6122374@discussion.autodesk.com">news:6122374@discussion.autodesk.com...
fact, the code is working, but I'm looking to multiply insert blocks which I
cannot get to work.