Hi again,
I'm sorry but I'm not much of a coder and at this point don't have the knowledge to do much more in iLogic than relatively simple commands.
What I've been trying to do is automate the export of DXF files from the sheet named "FLAT PATTERN" from all the part drawings related to an assembly. I'd also like the file name of the DXF to be in the format "part_number"_REV"revision".DXF
The object types that I've wanting to export are "Visible View Edge" and "3D Sketch Geometry" objects, these are defaulting to Layer 0. I often use 3D Sketch Geometry in Dotted line type to indicate NC marking lines on the DXFs. Since layer 0 is set to continuous, I am overriding some of the line types of the 3D Sketch Geometry objects to ensure that I get a WYSIWYG output. I have a custom export configuration created called "ExportDXF2019.ini" which is currently giving me the expected line outputs when I manually export the "FLAT PATTERN" sheet.
On a related matter, I also want the export PDFs of the printable sheets of each drawing, again with the _REV"revision" suffix. I don't want this to be combined with the DXF export since I won't always want to do both together. This I think should be a little easier and I can likely find a script on the forum that will do it.
I've tried using Drawing Porter but there's not enough export options and the output is too messy (extra output files will need deleting, all output files will need renaming, etc). If it were possible to write sheet selection rules and file naming rules into the export configuration for Drawing Porter to then use that'd be great but I don't think such options exist. Likewise with Task Scheduler, the options that I'd like do not exist; there seems to be even less control over the process than with Drawing Porter.
Any help the iLogic pros can provide would be greatly appreciated.
Solved! Go to Solution.
Solved by NOEL_GETTINGBYCZTUC. Go to Solution.
Importantly, I do not want to have to open the drawings manually before running the rule, I need it to to be run from a top level assembly (with multiple subassembly levels).
Or, if that is too difficult, or if a script that works for an individual drawing is much easier, then I could use the iLogic Rule Batch Tool to run and delete it from all drawings in a project folder.
Since nobody was responding, this is what I came up with after an hour or so on ChatGPT.
There were originally a couple of message boxes for failure and confirmation included but they were pausing the progress when using the iLogic Rule Batch Tool so I got rid of them.
ChatGPT is probably not the best way to create these scripts, it gets stuck in a loop sometimes applying fixes to errors but I got there in the end.
Imports System.IO
' iLogic script to export the FLAT PATTERN sheet as DXF ' The exported DXF filename includes the drawing file name and its REVISION NUMBER iProperty Sub Main Dim doc As DrawingDocument = ThisDoc.Document Dim flatPatternSheet As Sheet = Nothing ' Find the "FLAT PATTERN" sheet For Each sheet As Sheet In doc.Sheets If sheet.Name = "FLAT PATTERN" Then flatPatternSheet = sheet Exit For End If Next If flatPatternSheet Is Nothing Then Exit Sub End If ' Activate the "FLAT PATTERN" sheet flatPatternSheet.Activate() Dim parentPartRevision As String = doc.PropertySets.Item("Inventor Summary Information").Item("Revision Number").Value ' Get the drawing file name without extension Dim drawingFileName As String = System.IO.Path.GetFileNameWithoutExtension(doc.FullFileName) ' Specify the export directory Dim exportDirectory As String = "V:\Market\Team 8\DXFs Temp\" ' Change this to your desired directory ' Construct the export filename with DXF extension Dim exportFilename As String = System.IO.Path.Combine(exportDirectory, drawingFileName & "_Rev" & parentPartRevision & ".dxf") ' Save a copy of the FLAT PATTERN sheet as DXF doc.SaveAs(exportFilename, True) End Sub
Can't find what you're looking for? Ask the community or share your knowledge.