Save as assembly with numbering scheme
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a question about an iLogic rule i wan't to use.
When we download a file (STEP or Assembly) we now have the following sequence:
> Copy the file to the right folder
> Open the STEP or Assy from this folder
> Check in the Assembly
> Go to folder in de vault
> Rename the Assembly with the right numbering scheme
> Get the assembly
This process is very time consuming and we need to do it often.
I found the following iLogic rule i want to use. It was made to export STEP files.
I changed it so it saves to iam. and ipt. files.
'check that the active document is an assembly file If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then MessageBox.Show("This Rule " & iLogicVb.RuleName & " only works on Assembly Files.", "WRONG DOCUMENT TYPE", MessageBoxButtons.OK, MessageBoxIcon.Error) Return End If 'define the active document as an assembly file Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oAsmName As String = ThisDoc.FileName(False) 'without extension 'get user input Dim RUsure = MessageBox.Show( "This will create a STEP file for all components." _ & vbLf & " " _ & vbLf & "Are you sure you want to create STEP Drawings for all of the assembly components?" _ & vbLf & "This could take a while.", "iLogic - Batch Output STEPs ", MessageBoxButtons.YesNo) If RUsure = vbNo Then Return Else End If '- - - - - - - - - - - - -STEP setup - - - - - - - - - - - - Dim oPath = ThisDoc.Path 'get STEP target folder path ' original => oFolder = oPath & "\" & oAsmName & " STEP Files" Dim oFolder = oPath & "\STEP Files" 'Check for the step folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If '- - - - - - - - - - - - -Assembly - - - - - - - - - - - - ThisDoc.Document.SaveAs(oFolder & "\" & oAsmName & (".iam"), True) '- - - - - - - - - - - - -Components - - - - - - - - - - - - 'look at the files referenced by the assembly Dim oRefDocs As DocumentsEnumerator = oAsmDoc.AllReferencedDocuments 'work the referenced models For Each oRefDoc As Document In oRefDocs Dim oCurFile As Document = ThisApplication.Documents.Open(oRefDoc.FullFileName, True) Dim oCurFileName = oCurFile.FullFileName Dim ShortName = IO.Path.GetFileNameWithoutExtension(oCurFileName) Dim oPropSets As PropertySets = oCurFile.PropertySets Dim oPropSet As PropertySet = oPropSets.Item("Design Tracking Properties") Dim oPartNumiProp As [Property] = oPropSet.Item("Part Number") Try oCurFile.SaveAs(oFolder & "\" & oPartNumiProp.Value & (".ipt"), True) Catch MessageBox.Show("Error processing " & oCurFileName, "ilogic") End Try oCurFile.Close() Next '- - - - - - - - - - - - - MessageBox.Show("New Files Created in: " & vbLf & oFolder, "iLogic")
I want to change two things but i can't get it to work.
1: It now uses the partnumber for the new filename. I want to use a numbering scheme to generate a number for this name. Is there a possibility to acces the numbering scheme to do this? I can't find out where to start.
2: It now saves the file in a subfolder from the original file (/STEP). I want to change it so the engineer can choose a folder from a pull down menu. The location is as following: C:\Manders Vault\Designs\03 MAP - Manders Purchase\Festo . The last part of the location (Festo) is what i want to choose with a pull down menu.
The data i want to use in the pull down menu is stored in a excel file. Is this possible to do?
This shoud give me the following sequence:
> Open the Assembly STEP from download folder
> Run the iLogic rule
> Choose the correct folder
> Ready