-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFinish Drawing.iLogicVB
More file actions
84 lines (70 loc) · 2.91 KB
/
Finish Drawing.iLogicVB
File metadata and controls
84 lines (70 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
'AUTHOR: Cody Redding
'CONTACT: codered741@gmail.com
'"Finish Drawing" rule.
'completes drawing and prepares for posting.
' 1. Update drawing date (on part)
' 2. Update Copied iProperties
' 3. Check for 2d Laser/waterjet OS Ops, export DXF if found
' 4. Export PDF
' 5. Save File
' 6. check in file
Sub Main()
On Error Goto ErrorHandler
Dim oDoc As Document
SharedVariable("LogVar") = "Finish Drawing"
iLogicVB.RunExternalRule("Write SV to Log.iLogicVB")
oDoc = ThisApplication.ActiveDocument
If Not oDoc.DocumentType = kDrawingDocumentObject Then
MessageBox.Show("Please run this rule from a Drawing file. ", "Drawing Only Rule", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Dim oCommandMgr As CommandManager = ThisApplication.CommandManager
' Dim oRefDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments
' Dim oRefDoc As Document = oRefDocs.Item(1)
' Dim makeDxf AS Boolean = False
' Dim notDone as Boolean = False
'If the first reference is not a part or assembly, find the first assembly/part in the list.
' If oRefDoc.DocumentType <> kAssemblyDocumentObject OrElse oRefDoc.DocumentType <> kPartDocumentObject
' For docnum = 2 to oDoc.AllReferencedDocuments.Count ' oRefDoc.DocumentType <> kAssemblyDocumentObject OrElse oRefDoc.DocumentType <> kPartDocumentObject
' oRefDoc = oDoc.AllReferencedDocuments.Item(docnum)
' If oRefDoc.DocumentType = kAssemblyDocumentObject OrElse oRefDoc.DocumentType = kPartDocumentObject
' Exit For
' End If
' Next
' End If
' invDesignInfo = oRefDoc.PropertySets.Item("Design Tracking Properties")
' oRefCustomProps = oRefDoc.PropertySets.Item("Inventor User Defined Properties")
'oRefSumProps = oRefDoc.PropertySets.Item("Design Tracking Properties")
'DateProp = invDesignInfo.Item("Creation Time")
'CheckedDateProp = invDesignInfo.Item("Date Checked")
'ApprovedDate = invDesignInfo.Item("Engr Date Approved")
'DateProp.Value = DateString
'CheckedDateProp.Value = DateString
'ApprovedDate.Value = DateString
oCommandMgr.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd").Execute2(True)
oCommandMgr.ControlDefinitions.Item("AppZoomAllCmd").Execute
' Try
' prop = oRefCustomProps.Item("OPS")
' If oRefCustomProps.Item("OPS").Value.Contains("OS") Then
' iLogicVb.RunExternalRule("Export and Attach DXF")
' End If
' Catch
' MessageBox.Show("Please check the Smart Part Config for this Part/Assembly. The 'OPS' Parameter is missing. ", "Missing Parameter")
' 'Exit Sub
' notDone = True
' End Try
'iLogicVb.RunExternalRule("Export and Attach PDF")
oDoc.Update
oDoc.Sheets.Item(1).Activate
oDoc.Save
If notDone = False Then
oCommandMgr.ControlDefinitions.Item("VaultCheckinTop").Execute
Else
MessageBox.Show("An Error occurred. Please try again.", "iLogic", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
ThisApplication.ActiveDocument.Close
ErrorHandler:
notDone = True
Resume Next
End Sub