Guest User

Untitled

a guest
Sep 5th, 2012
640
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //////////////////////// IPT: Update (Nach dem Öffnen) ////////////////////////
  2.  
  3. durchmesser = InputBox("Durchmesser (mindestens 150mm)", "Schelle ändern", durch & "mm")
  4. If Val(durchmesser) <> 0 Then
  5.     If Val(durchmesser) <=  150  Then durchmesser = 150
  6.     durch = Val(durchmesser)
  7.     ThisDoc.Save() 
  8.     Updated = True
  9.     RuleParametersOutput()
  10.     InventorVb.DocumentUpdate()
  11.     ' Zeichnung öffnen
  12.     ThisDoc.Launch("Schellentest.idw")     
  13.     ThisApplication.ActiveDocument.Save()
  14. End If
  15.  
  16.  
  17. //////////////////////// IDW: Update (Vor dem Speichern) ////////////////////////
  18.  
  19. If  Parameter("Schellentest.ipt.Updated") = True Then
  20.     Parameter("Schellentest.ipt.Updated") = False
  21.     Auftrag = InputBox("Neuer Auftrag", "Speichern unter", "Nummer?")
  22.     auftrag = Val(Auftrag)
  23.     If auftrag <> 0 Then
  24.         Parameter("Schellentest.ipt.Nummer") = auftrag
  25.         ' Zweite Aktualisierung, wahrscheinlich unnötig
  26.         RuleParametersOutput()
  27.         InventorVb.DocumentUpdate()
  28.         ActiveSheet = ThisDrawing.Sheet("Blatt:1")
  29.         ActiveSheet = ThisDrawing.Sheet("Blatt:2")
  30.         ' Dateien generieren
  31.         iLogicVb.RunRule("Save")
  32.     End If
  33. End If
  34.  
  35.  
  36. //////////////////////// IDW: Save (Durch "Update" aufgerufen) ////////////////////////
  37.  
  38.  
  39. durch = Parameter("Schellentest.ipt.durch")
  40. auftrag = Parameter("Schellentest.ipt.Nummer")
  41.  
  42. If auftrag <> 0 Then
  43.           If Len(Dir(ThisDoc.Path & "\Test\" & auftrag, vbDirectory)) = 0 Then
  44.                 MkDir(ThisDoc.Path & "/Test/" & auftrag)
  45.         End If
  46.        
  47.         ' IPT und IDW
  48.        fname = ThisDoc.Path & "\Test\" & auftrag & "\Schelle " & auftrag & " (" & durch & " mm)"
  49.         FileCopy(ThisDoc.PathAndFileName(False) & ".ipt", fname & ".ipt")
  50.         FileCopy(ThisDoc.PathAndFileName(False) & ".idw", fname & ".idw")
  51.        
  52.         ' Translator Optionen
  53.         Dim oDocument As Document
  54.         oDocument = ThisApplication.ActiveDocument
  55.         oContext = ThisApplication.TransientObjects.CreateTranslationContext
  56.         oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
  57.         oOptions = ThisApplication.TransientObjects.CreateNameValueMap
  58.         oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
  59.        
  60.         ' PDF
  61.        PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
  62.         If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
  63.                 oOptions.Value("All_Color_AS_Black") = 1
  64.                 oOptions.Value("Remove_Line_Weights") = 1
  65.                 oOptions.Value("Vector_Resolution") = 400
  66.                 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
  67.         End If
  68.         oDataMedium.FileName = fname & ".pdf"
  69.         PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions,oDataMedium)
  70.        
  71.         ' DXF
  72.         oOptions = ThisApplication.TransientObjects.CreateNameValueMap
  73.         DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
  74.         If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
  75.                 'strIniFile = "C:\temp\dxfout.ini"
  76.                'oOptions.Value("Export_Acad_IniFile") = strIniFile
  77.        End If
  78.         oDataMedium.FileName =  ThisDoc.PathAndFileName(False) & ".dxf"
  79.         'DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
  80.                ' Aufräumen
  81.                'FileCopy(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf", fname & ".dxf")
  82.                'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_1.dxf")
  83.                'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf")
  84.              
  85.         ' Anzeigen
  86.        Process.Start("explorer.exe", ThisDoc.Path & "\Test\" & auftrag)
  87. End If
Advertisement
Add Comment
Please, Sign In to add comment