External Rule to Create auto DWG of Part
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey all,
Hoping this is a quick question but I have not found anything on this all week. Any help would be greatly appreciated. I am looking to use an external rule in iLogic to automatically create a drawing of an open part. The catch is I want it to use a specific drawing template.
Current code I have runs it pretty well which is nice, however it doesn't use the template I want. See Code below and more notes to follow.
Imports System.IO Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Try 'to open the drawing ThisApplication.Documents.Open _ (ThisDoc.PathAndFileName(True).Replace("ipt", "idw")) Return 'exit rule Catch End Try 'since nothing found create it... oNewDrawing = ThisDoc.ChangeExtension(".idw") oTemplateFolder = ThisApplication.FileOptions.TemplatesPath Dim oList As New ArrayList Dim Folder As New IO.DirectoryInfo(oTemplateFolder) For Each File As IO.FileInfo In Folder.GetFiles("*.idw", IO.SearchOption.AllDirectories) Dim sName As New FileInfo(File.Name) oList.Add(sName.Name) Next oTemplate = InputListBox("Select a template", oList, oList(0),"iLogic", "List") oTemplate = oTemplateFolder & oTemplate Dim oDrawingDoc As DrawingDocument oDrawingDoc = ThisApplication.Documents.Add _ (DocumentTypeEnum.kDrawingDocumentObject, oTemplate, True) oDrawingDoc.Activate() Dim oSheet As Sheet oSheet = oDrawingDoc.Sheets.Item(1) Dim oPoint As Point2d oPoint = ThisApplication.TransientGeometry.CreatePoint2d(10, 10) Dim oView As DrawingView oView = oSheet.DrawingViews.AddBaseView(oDoc, oPoint, 1, _ ViewOrientationTypeEnum.kFrontViewOrientation, _ DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle) oDrawingDoc.SaveAs(oNewDrawing, False)
I am guessing it might be a simple fix but I have not written code quite like this before. Just not sure on what I need to insert to change it up so it works.
Original Code is from: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/create-drawing-with-existing-ilogic-...
Other link that might be similar: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/automatic-sheet-generation-for-idw/m...
Thanks!!