
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Looking for help in iLogic.
The goal is to create a comma delimited file so I can import to another program. From a Multi Sheet drawing file I want to cycle through the sheets, open the part (hidden) extract 2 items from the iProperties Part file Custom Tab (_AncestryStr, NAME) and 2 items from the Project Tab (Part Number, Description) string the information together (Each part per line) and write it to a text file.
This is what I have so far. (excuse my many trials with comments). Thanks for any help.
1st problem is that when I open the part file I can't seem to get the part information. It gets the drawing information for the file instead.
2nd is how to write the complied strings to a .txt file
'open file Dim oDoc As DrawingDocument oDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim sSheetName As String 'For Each oSheet In oDoc.Sheets'do the operation for each sheet oPartSheet = ActiveSheet.Name 'MessageBox.Show(oPartSheet, "oPartSheet")'step through each drawing sheet'For Each oSheet In oDrawing.Sheets'Remove the (:) lPos = InStr(oPartSheet, ":") 'MessageBox.Show(lPos, "Position")'find the number of characters in the sheet name sLen = Len(oPartSheet) 'find the sheet name oPart = Left(oPartSheet, lPos -1) oPartN = oPart 'Add the .ipt oPart = oPart & ".ipt" MessageBox.Show(oPartN, "Part no ipt") 'Open part and get Custom Information, Description oFullPath = ThisDoc.WorkspacePath() MessageBox.Show(oFullPath , "directory PATH") 'Open Part and get information oPartPath = oFullPath & "\" & oPart MessageBox.Show(oPartPath , "Full PATH") Dim xDoc As Document = ThisApplication.Documents.Open(oPartPath, True) 'False means it will open invisible oName = iProperties.Value("Custom", "NAME") MessageBox.Show(oNAME, " Part NAME") ' Getting information from drawing not the part. ' Remove the .ipt from the part'TO DO'oNAME = iProperties.Value("Custom", "NAME") ' From the Part File Custom Tab'oPart = iProperties.Value("Project, "Part Number")' From the Part File Project Tab'oDescription = iProperties.Value("Project", "Description")' From the Part File Project Tab'oRefDwg = iProperties.Value("Custom", "_AncestryStr") ' From the Part File Custom Tab'MessageBox.Show(oStr, "Assemblies") 'String information together Testing'Testing to see what string will look like oName = "CHANNEL" oPartN = "CH1" oDescription = "C6x13 x 13'-2 15/16" oRefDwg = "CPSW(7x2), CP1SW(2)" oStr = oName & "," & oPartN & "," & oDescription & "," & oRefDwg MessageBox.Show(oStr, "Comma File") ' Get next sheet in Drawing 'Write to a text file, copied from elsewhere Needs work'Dim oPath As String = oDoc.FullFileName 'oPath = Left(oPath, Len(oPath) - 3) & "txt" 'oPath = Left(oPath, Len(oPath) - 4) & "-Assemblies" & ".txt" 'System.IO.File.WriteAllText(oPath, Result) 'Pass it the variable Result 'System.Diagnostics.Process.Start(oPath)
Solved! Go to Solution.