Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////// IPT: Update (Nach dem Öffnen) ////////////////////////
- durchmesser = InputBox("Durchmesser (mindestens 150mm)", "Schelle ändern", durch & "mm")
- If Val(durchmesser) <> 0 Then
- If Val(durchmesser) <= 150 Then durchmesser = 150
- durch = Val(durchmesser)
- ThisDoc.Save()
- Updated = True
- RuleParametersOutput()
- InventorVb.DocumentUpdate()
- ' Zeichnung öffnen
- ThisDoc.Launch("Schellentest.idw")
- ThisApplication.ActiveDocument.Save()
- End If
- //////////////////////// IDW: Update (Vor dem Speichern) ////////////////////////
- If Parameter("Schellentest.ipt.Updated") = True Then
- Parameter("Schellentest.ipt.Updated") = False
- Auftrag = InputBox("Neuer Auftrag", "Speichern unter", "Nummer?")
- auftrag = Val(Auftrag)
- If auftrag <> 0 Then
- Parameter("Schellentest.ipt.Nummer") = auftrag
- ' Zweite Aktualisierung, wahrscheinlich unnötig
- RuleParametersOutput()
- InventorVb.DocumentUpdate()
- ActiveSheet = ThisDrawing.Sheet("Blatt:1")
- ActiveSheet = ThisDrawing.Sheet("Blatt:2")
- ' Dateien generieren
- iLogicVb.RunRule("Save")
- End If
- End If
- //////////////////////// IDW: Save (Durch "Update" aufgerufen) ////////////////////////
- durch = Parameter("Schellentest.ipt.durch")
- auftrag = Parameter("Schellentest.ipt.Nummer")
- If auftrag <> 0 Then
- If Len(Dir(ThisDoc.Path & "\Test\" & auftrag, vbDirectory)) = 0 Then
- MkDir(ThisDoc.Path & "/Test/" & auftrag)
- End If
- ' IPT und IDW
- fname = ThisDoc.Path & "\Test\" & auftrag & "\Schelle " & auftrag & " (" & durch & " mm)"
- FileCopy(ThisDoc.PathAndFileName(False) & ".ipt", fname & ".ipt")
- FileCopy(ThisDoc.PathAndFileName(False) & ".idw", fname & ".idw")
- ' Translator Optionen
- Dim oDocument As Document
- oDocument = ThisApplication.ActiveDocument
- oContext = ThisApplication.TransientObjects.CreateTranslationContext
- oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
- oOptions = ThisApplication.TransientObjects.CreateNameValueMap
- oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
- ' PDF
- PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
- If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
- oOptions.Value("All_Color_AS_Black") = 1
- oOptions.Value("Remove_Line_Weights") = 1
- oOptions.Value("Vector_Resolution") = 400
- oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
- End If
- oDataMedium.FileName = fname & ".pdf"
- PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions,oDataMedium)
- ' DXF
- oOptions = ThisApplication.TransientObjects.CreateNameValueMap
- DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
- If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
- 'strIniFile = "C:\temp\dxfout.ini"
- 'oOptions.Value("Export_Acad_IniFile") = strIniFile
- End If
- oDataMedium.FileName = ThisDoc.PathAndFileName(False) & ".dxf"
- 'DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
- ' Aufräumen
- 'FileCopy(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf", fname & ".dxf")
- 'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_1.dxf")
- 'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf")
- ' Anzeigen
- Process.Start("explorer.exe", ThisDoc.Path & "\Test\" & auftrag)
- End If
Advertisement
Add Comment
Please, Sign In to add comment