- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all, I am looking for some assistance with iLogic coding... Let me try to explain what i am looking for here, bear with me.
For my workflow, i am designing one-off tooling that trims plastic blow molded parts. We have an in house tool room where we design and build most of the tooling we use. With that being said, we build some of the parts, some times some of them get sent out to other companies to build then we assemble depending on the job.
So i will design an entire project for say a trim station, and the parts we build i will save as an igs for our cnc department to use. Then some of the companies need the files as a stp and the drawings as a dxf.
What i am trying to do essentially is take the entire assembly, and hide the parts i do not want to convert to say an iges. But when i use this code it saves everything in the assembly, and i believe it saves assemblies within the assembly as an iges as well, whereas i want each individual part saved as an iges, not the whole assembly. So it seems i need to add something to recognize only visible items, and to only select parts, not assemblies within the assembly. Is this possible? This is the current code i am using right now.
'Define the open document Dim openDoc As Document openDoc = ThisDoc.Document 'path from current file oFolder = ThisDoc.WorkspacePath() & "\CNC FILES" 'Check for the destination folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Look at all of the files referenced in the open document Dim docFile As Document For Each docFile In openDoc.AllReferencedDocuments 'format file name Dim FNamePos As Long 'postion of last back slash FNamePos = InStrRev(docFile.FullFileName, "\", -1) Dim docFName As String 'file name with extension docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 'file name without extension shortname = Left(docFName, Len(docFName) -4) ' Get the IGES translator Add-In. Dim oIGESTranslator As TranslatorAddIn oIGESTranslator = ThisApplication.ApplicationAddIns.ItemById _ ("{90AF7F44-0C01-11D5-8E83-0010B541CD80}") Dim oContext As TranslationContext oContext = ThisApplication.TransientObjects.CreateTranslationContext Dim oOptions As NameValueMap oOptions = ThisApplication.TransientObjects.CreateNameValueMap If oIGESTranslator.HasSaveCopyAsOptions(docFile, oContext, oOptions) Then ' Set geometry type for wireframe. ' 0 = Surfaces, 1 = Solids, 2 = Wireframe 'oOptions.Value("GeometryType") = 1 ' To set other translator values: ' oOptions.Value("SolidFaceType") = n ' 0 = NURBS, 1 = Analytic ' oOptions.Value("SurfaceType") = n ' 0 = 143(Bounded), 1 = 144(Trimmed) oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism Dim oData As DataMedium oData = ThisApplication.TransientObjects.CreateDataMedium 'set file path for IGS file oData.FileName = oFolder & "\" & shortname & ".igs" oIGESTranslator.SaveCopyAs(docFile, oContext, oOptions, oData) End If Next
This code also checks and makes a folder for CNC FILES if there isnt one there, as mentioned, i use this for our CNC department so it works, but it seems like it saves subassemblies as one igs file, and not the individual parts within a subassembly.
Also i would like to map out how to reference if i translate to an step file, to find a reference drawing of that part and also save the drawing as a dxf if this would be possible.
Thanks for any help!! Ill take anything i can get for knowledge of this, i am pretty new to ilogic but have made this code from cross referencing a number of posts and different codes and eventually got it to work.
Solved! Go to Solution.