Guest User

iLogic

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