Message 1 of 7
Use iLogic to set layer color and line style when exporting image
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We started adding additional sheets to assembly prints to use as work instructions. We've made a code snippet (below) that will export an image directly from Inventor so we don't have to flatten and convert in an image editing app. The code will capture paper color, set it to white while it makes the image, and then sets paper color back to what it was.
I'd like to do the same thing with tweak trails; make the layer red, line style as double dash chain, and line weight of .039. Can I add that to the code I have?
Dim Doc As DrawingDocument = ThisApplication.ActiveDocument Dim Path As String = ThisDoc.Path Dim Name As String = ThisDoc.FileName(False) Dim Sheet As String = ActiveSheet.Name Sheet = Replace(Sheet, ":", "_") Dim ImagePath As String = Path & "\" & Name & "_" & Sheet & ".png" Dim OriginalColor As Color = Doc.SheetSettings.SheetColor Dim White As Color = ThisApplication.TransientObjects.CreateColor(255,255,255) Dim H1 = ThisDrawing.ActiveSheet.Height * 150 Dim W1 = ThisDrawing.ActiveSheet.Width * 150 ' Message box used when error proofing ' MessageBox.Show(ImagePath, "This is where we are trying to save", MessageBoxButtons.OK) ThisApplication.CommandManager.ControlDefinitions.Item("AppZoomAllCmd").Execute Doc.SheetSettings.SheetColor = White ThisApplication.ActiveView.SaveAsBitmap(ImagePath, W1, H1) Doc.SheetSettings.SheetColor = OriginalColor