View difference between Paste ID: yp0XnQCD and qRL2FGD3
SHOW: | | - or go back to the newest paste.
1
//////////////////////// IPT: Update (Nach dem Öffnen) ////////////////////////
2
3-
iLogicVb.UpdateWhenDone = True
3+
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-
	ThisDoc.Save()
9+
	RuleParametersOutput()
10
	InventorVb.DocumentUpdate()
11
	' Zeichnung öffnen
12
	ThisDoc.Launch("Schellentest.idw")		
13-
//////////////////////// IPT: Update (Nach dem Speichern) ////////////////////////
13+
	ThisApplication.ActiveDocument.Save()
14
End If
15
16-
ThisDoc.Launch("Schellentest.idw")
16+
17-
ThisApplication.ActiveDocument.Save()
17+
18
19
If  Parameter("Schellentest.ipt.Updated") = True Then
20
	Parameter("Schellentest.ipt.Updated") = False
21
	Auftrag = InputBox("Neuer Auftrag", "Speichern unter", "Nummer?")
22-
iLogicVb.UpdateWhenDone = True
22+
	auftrag = Val(Auftrag)
23
	If auftrag <> 0 Then
24-
Auftrag = InputBox("Nummer?", "Neuer Auftrag", "")
24+
		Parameter("Schellentest.ipt.Nummer") = auftrag
25-
auftrag = Val(Auftrag)
25+
		' Zweite Aktualisierung, wahrscheinlich unnötig
26
		RuleParametersOutput() 
27-
	Parameter("Schellentest.ipt.Nummer") = auftrag
27+
		InventorVb.DocumentUpdate()
28-
	ActiveSheet = ThisDrawing.Sheet("Blatt:1")
28+
		ActiveSheet = ThisDrawing.Sheet("Blatt:1")
29-
	ActiveSheet = ThisDrawing.Sheet("Blatt:2")
29+
		ActiveSheet = ThisDrawing.Sheet("Blatt:2")
30
		' Dateien generieren
31-
	ThisDoc.Launch("Schellentest.ipt")
31+
		iLogicVb.RunRule("Save")
32
	End If
33-
	ThisApplication.ActiveView.Update()
33+
34
35-
	updated = True
35+
36-
	ThisDoc.Launch("Schellentest.idw")
36+
//////////////////////// IDW: Save (Durch "Update" aufgerufen) ////////////////////////
37
38-
	ThisApplication.ActiveView.Update()
38+
39-
	ActiveSheet = ThisDrawing.Sheet("Blatt:1")
39+
40
auftrag = Parameter("Schellentest.ipt.Nummer")
41
 
42
If auftrag <> 0 Then
43-
//////////////////////// IDW: Generate (Nach dem Speichern) ////////////////////////
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-
If updated = True And auftrag <> 0 Then
49+
        FileCopy(ThisDoc.PathAndFileName(False) & ".ipt", fname & ".ipt")
50-
	updated = False
50+
        FileCopy(ThisDoc.PathAndFileName(False) & ".idw", fname & ".idw")
51-
	ActiveSheet = ThisDrawing.Sheet("Blatt:1")	
51+
       
52-
	ActiveSheet = ThisDrawing.Sheet("Blatt:2")
52+
        ' Translator Optionen
53
		Dim oDocument As Document
54-
	If Len(Dir(ThisDoc.Path & "\Test\" & auftrag, vbDirectory)) = 0 Then
54+
        oDocument = ThisApplication.ActiveDocument
55-
		MkDir(ThisDoc.Path & "/Test/" & auftrag)
55+
        oContext = ThisApplication.TransientObjects.CreateTranslationContext
56
        oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
57-
	
57+
        oOptions = ThisApplication.TransientObjects.CreateNameValueMap
58-
	' IPT und IDW
58+
        oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
59-
	fname = ThisDoc.Path & "\Test\" & auftrag & "\Schelle " & auftrag & " (" & durch & " mm)"
59+
       
60-
	FileCopy(ThisDoc.PathAndFileName(False) & ".ipt", fname & ".ipt")
60+
        ' PDF
61-
	FileCopy(ThisDoc.PathAndFileName(False) & ".idw", fname & ".idw")
61+
        PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
62-
	
62+
        If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
63-
	' Translator Optionen
63+
                oOptions.Value("All_Color_AS_Black") = 1
64-
	oDocument = ThisApplication.ActiveDocument
64+
                oOptions.Value("Remove_Line_Weights") = 1
65-
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
65+
                oOptions.Value("Vector_Resolution") = 400
66-
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
66+
                oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
67-
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
67+
        End If
68-
	oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
68+
        oDataMedium.FileName = fname & ".pdf"
69-
	
69+
        PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions,oDataMedium)
70-
	' PDF
70+
       
71-
	PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
71+
        ' DXF
72-
	If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
72+
		oOptions = ThisApplication.TransientObjects.CreateNameValueMap
73-
		oOptions.Value("All_Color_AS_Black") = 1
73+
        DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
74-
		oOptions.Value("Remove_Line_Weights") = 1
74+
        If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
75-
		oOptions.Value("Vector_Resolution") = 400
75+
                'strIniFile = "C:\temp\dxfout.ini"
76-
		oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
76+
                'oOptions.Value("Export_Acad_IniFile") = strIniFile
77
        End If
78-
	oDataMedium.FileName = fname & ".pdf"
78+
        oDataMedium.FileName =  ThisDoc.PathAndFileName(False) & ".dxf"
79-
	PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions,oDataMedium)
79+
       	'DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
80-
	
80+
                ' Aufräumen
81-
	' DXF
81+
                'FileCopy(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf", fname & ".dxf")
82-
	DXFAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC4-122E-11D5-8E91-0010B541CD80}")
82+
                'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_1.dxf")
83-
	If DXFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
83+
                'Kill(ThisDoc.PathAndFileName(False) & "_Blatt_2.dxf")
84-
		strIniFile = "C:\temp\dxfout.ini"
84+
               
85-
		oOptions.Value("Export_Acad_IniFile") = strIniFile
85+
        ' Anzeigen
86
        Process.Start("explorer.exe", ThisDoc.Path & "\Test\" & auftrag)
87-
	oDataMedium.FileName =  ThisDoc.PathAndFileName(False) & ".dxf"
87+