
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have to insert dwg file from autocad blocks into specific location on inventor template drawing.
Also i have insert dwg file from secifiled folder on inebentor drawing on specific part using c#.net add inson click of button of WPF window.
I have write some code for it but did not work.
public Inventor.AutoCADBlock ReplaceOrInsertTitleBlock(DrawingDocument doc, string tbName, string fromIDWFile)
{
DrawingDocument from = m_inventorApplicationNew.Documents.Open(fromIDWFile, false) as DrawingDocument;
int count = from.AutoCADBlockDefinitions.Count;
AutoCADBlockDefinition tbdToInsert = from.AutoCADBlockDefinitions[tbName];
AutoCADBlockDefinition tbdCopied = tbdToInsert.CopyTo(doc as _DrawingDocument, true);
Point2d point2 = null;
point2.X = 0.00;
point2.Y = 0.00;
AutoCADBlock tb = doc.ActiveSheet.AutoCADBlocks.Add(tbdCopied, point2, 0,1,"Hello");
from.Close(true);
return tb;
}
public void TestInsertTitleBlock()
{
DrawingDocument drawDoc = (DrawingDocument)m_inventorApplicationNew.ActiveDocument;
ReplaceOrInsertTitleBlock(drawDoc, "DWG_Stamp_AsBuiltRevised", @"C:\CAD Support\2019\Blocks\DWG_Stamp_AsBuiltRevised.dwg");
}
private void button_Ok_Click(object sender, RoutedEventArgs e)
{
}
I have shown in screen show (attachment) what which is now we are manually doing we want it on click of button of wpf.
Solved! Go to Solution.