├── Code Injector Project ├── Code Injector.sln ├── Code Injector.suo ├── Code Injector.v12.suo └── Code Injector │ ├── ApplicationEvents.vb │ ├── Code Injector.vbproj │ ├── Code Injector.vbproj.user │ ├── Code_Injector.Designer.vb │ ├── Code_Injector.resx │ ├── Code_Injector.vb │ ├── InventorProcess.vb │ ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ ├── Settings.settings │ └── app.manifest │ ├── RuleFromFileForm.Designer.vb │ ├── RuleFromFileForm.resx │ ├── RuleFromFileForm.vb │ ├── net-transport.ico │ └── obj │ └── x86 │ └── Release │ ├── Code Injector.exe │ ├── Code Injector.pdb │ ├── Code Injector.vbproj.FileListAbsolute.txt │ ├── Code Injector.vbproj.GenerateResource.Cache │ ├── Code Injector.vbproj.ResolveComReference.cache │ ├── Code Injector.vbprojResolveAssemblyReference.cache │ ├── Code Injector.xml │ ├── Code_Injector.Code_Injector.resources │ ├── Code_Injector.Resources.resources │ ├── Code_Injector.RuleSelectorForm.resources │ ├── DesignTimeResolveAssemblyReferences.cache │ └── DesignTimeResolveAssemblyReferencesInput.cache └── README.md /Code Injector Project/Code Injector.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Code Injector", "Code Injector\Code Injector.vbproj", "{506627D4-37B1-4A7C-B536-37100F4366E7}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {506627D4-37B1-4A7C-B536-37100F4366E7}.Debug|x86.ActiveCfg = Debug|x86 13 | {506627D4-37B1-4A7C-B536-37100F4366E7}.Debug|x86.Build.0 = Debug|x86 14 | {506627D4-37B1-4A7C-B536-37100F4366E7}.Release|x86.ActiveCfg = Release|x86 15 | {506627D4-37B1-4A7C-B536-37100F4366E7}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector.suo -------------------------------------------------------------------------------- /Code Injector Project/Code Injector.v12.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector.v12.suo -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/ApplicationEvents.vb: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/Code Injector.vbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 7 | 8 | 2.0 9 | {506627D4-37B1-4A7C-B536-37100F4366E7} 10 | WinExe 11 | Code_Injector.My.MyApplication 12 | Code_Injector 13 | Code Injector 14 | 512 15 | WindowsForms 16 | v3.5 17 | false 18 | publish\ 19 | true 20 | Disk 21 | false 22 | Foreground 23 | 7 24 | Days 25 | false 26 | false 27 | true 28 | 0 29 | 1.0.0.%2a 30 | false 31 | true 32 | 33 | 34 | x86 35 | true 36 | full 37 | true 38 | true 39 | bin\Debug\ 40 | Code Injector.xml 41 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 42 | 43 | 44 | x86 45 | pdbonly 46 | false 47 | true 48 | true 49 | bin\Release\ 50 | Code Injector.xml 51 | 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 52 | 53 | 54 | On 55 | 56 | 57 | Binary 58 | 59 | 60 | Off 61 | 62 | 63 | On 64 | 65 | 66 | My Project\app.manifest 67 | 68 | 69 | net-transport.ico 70 | 71 | 72 | 73 | ..\..\..\..\..\..\..\..\TEMP\dll_for_2011\Autodesk.iLogic.dll 74 | 75 | 76 | ..\..\..\..\..\..\..\..\TEMP\dll_for_2011\Autodesk.iLogic.Automation.dll 77 | 78 | 79 | ..\..\..\..\..\..\..\..\TEMP\dll_for_2011\Autodesk.iLogic.Interfaces.dll 80 | 81 | 82 | False 83 | True 84 | ..\..\..\..\..\..\..\..\TEMP\Autodesk.Inventor.Interop.dll 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | Form 111 | 112 | 113 | Code_Injector.vb 114 | Form 115 | 116 | 117 | 118 | RuleFromFileForm.vb 119 | 120 | 121 | Form 122 | 123 | 124 | 125 | True 126 | Application.myapp 127 | 128 | 129 | True 130 | True 131 | Resources.resx 132 | 133 | 134 | True 135 | Settings.settings 136 | True 137 | 138 | 139 | 140 | 141 | Code_Injector.vb 142 | 143 | 144 | RuleFromFileForm.vb 145 | 146 | 147 | VbMyResourcesResXFileCodeGenerator 148 | Resources.Designer.vb 149 | My.Resources 150 | Designer 151 | 152 | 153 | 154 | 155 | Designer 156 | 157 | 158 | MyApplicationCodeGenerator 159 | Application.Designer.vb 160 | 161 | 162 | SettingsSingleFileGenerator 163 | My 164 | Settings.Designer.vb 165 | 166 | 167 | 168 | 169 | {00020430-0000-0000-C000-000000000046} 170 | 2 171 | 0 172 | 0 173 | primary 174 | False 175 | True 176 | 177 | 178 | 179 | 180 | False 181 | .NET Framework 3.5 SP1 Client Profile 182 | false 183 | 184 | 185 | False 186 | .NET Framework 3.5 SP1 187 | true 188 | 189 | 190 | False 191 | Windows Installer 3.1 192 | true 193 | 194 | 195 | 196 | 197 | 198 | 199 | 206 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/Code Injector.vbproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ShowAllFiles 5 | publish\ 6 | 7 | 8 | 9 | 10 | 11 | en-US 12 | false 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/Code_Injector.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class Code_Injector 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Code_Injector)) 26 | Me.AddRules_Button = New System.Windows.Forms.Button() 27 | Me.Rule_Contents_TextBox = New System.Windows.Forms.TextBox() 28 | Me.Rule_Input_GroupBox1 = New System.Windows.Forms.GroupBox() 29 | Me.SelectfromInventorFileButton = New System.Windows.Forms.Button() 30 | Me.RuleNameTextBox1 = New System.Windows.Forms.TextBox() 31 | Me.Label2 = New System.Windows.Forms.Label() 32 | Me.Label1 = New System.Windows.Forms.Label() 33 | Me.ClearRuleText_Button = New System.Windows.Forms.Button() 34 | Me.ImportRuleFromFile_Button = New System.Windows.Forms.Button() 35 | Me.RuleFileDialog = New System.Windows.Forms.OpenFileDialog() 36 | Me.Directory_Browse_Dialog = New System.Windows.Forms.FolderBrowserDialog() 37 | Me.SelectFolder_Button = New System.Windows.Forms.Button() 38 | Me.CheckIPT = New System.Windows.Forms.CheckBox() 39 | Me.CheckIAM = New System.Windows.Forms.CheckBox() 40 | Me.CheckIDW = New System.Windows.Forms.CheckBox() 41 | Me.ListBox1 = New System.Windows.Forms.ListBox() 42 | Me.GroupBox1 = New System.Windows.Forms.GroupBox() 43 | Me.Label7 = New System.Windows.Forms.Label() 44 | Me.Label6 = New System.Windows.Forms.Label() 45 | Me.Label5 = New System.Windows.Forms.Label() 46 | Me.EventTriggers_CheckedListBox1 = New System.Windows.Forms.CheckedListBox() 47 | Me.GroupBox2 = New System.Windows.Forms.GroupBox() 48 | Me.CheckDWG = New System.Windows.Forms.CheckBox() 49 | Me.ClearFolderList_Button = New System.Windows.Forms.Button() 50 | Me.ClearSelectedFromList_Button = New System.Windows.Forms.Button() 51 | Me.Label4 = New System.Windows.Forms.Label() 52 | Me.Label3 = New System.Windows.Forms.Label() 53 | Me.ExitProgram_Button = New System.Windows.Forms.Button() 54 | Me.GroupBox3 = New System.Windows.Forms.GroupBox() 55 | Me.DeleteAfterRun_RadioButton = New System.Windows.Forms.RadioButton() 56 | Me.KeepAfterRun_RadioButton = New System.Windows.Forms.RadioButton() 57 | Me.RunRulesOnCreation_CheckBox = New System.Windows.Forms.CheckBox() 58 | Me.OverwriteDuplicateRules_CheckBox = New System.Windows.Forms.CheckBox() 59 | Me.HelpProvider1 = New System.Windows.Forms.HelpProvider() 60 | Me.StatusStrip1 = New System.Windows.Forms.StatusStrip() 61 | Me.ToolStripProgressBar1 = New System.Windows.Forms.ToolStripProgressBar() 62 | Me.InventorLoadingText = New System.Windows.Forms.ToolStripStatusLabel() 63 | Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel() 64 | Me.DeleteRulesButton = New System.Windows.Forms.Button() 65 | Me.Rule_Input_GroupBox1.SuspendLayout() 66 | Me.GroupBox1.SuspendLayout() 67 | Me.GroupBox2.SuspendLayout() 68 | Me.GroupBox3.SuspendLayout() 69 | Me.StatusStrip1.SuspendLayout() 70 | Me.SuspendLayout() 71 | ' 72 | 'AddRules_Button 73 | ' 74 | Me.AddRules_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 75 | Me.AddRules_Button.Location = New System.Drawing.Point(823, 505) 76 | Me.AddRules_Button.Margin = New System.Windows.Forms.Padding(2) 77 | Me.AddRules_Button.Name = "AddRules_Button" 78 | Me.HelpProvider1.SetShowHelp(Me.AddRules_Button, True) 79 | Me.AddRules_Button.Size = New System.Drawing.Size(164, 25) 80 | Me.AddRules_Button.TabIndex = 14 81 | Me.AddRules_Button.Text = "Add Rules" 82 | Me.AddRules_Button.UseVisualStyleBackColor = True 83 | ' 84 | 'Rule_Contents_TextBox 85 | ' 86 | Me.Rule_Contents_TextBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ 87 | Or System.Windows.Forms.AnchorStyles.Left) _ 88 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 89 | Me.Rule_Contents_TextBox.Location = New System.Drawing.Point(6, 79) 90 | Me.Rule_Contents_TextBox.Multiline = True 91 | Me.Rule_Contents_TextBox.Name = "Rule_Contents_TextBox" 92 | Me.Rule_Contents_TextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical 93 | Me.HelpProvider1.SetShowHelp(Me.Rule_Contents_TextBox, True) 94 | Me.Rule_Contents_TextBox.Size = New System.Drawing.Size(765, 173) 95 | Me.Rule_Contents_TextBox.TabIndex = 2 96 | ' 97 | 'Rule_Input_GroupBox1 98 | ' 99 | Me.Rule_Input_GroupBox1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ 100 | Or System.Windows.Forms.AnchorStyles.Left) _ 101 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 102 | Me.Rule_Input_GroupBox1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink 103 | Me.Rule_Input_GroupBox1.Controls.Add(Me.SelectfromInventorFileButton) 104 | Me.Rule_Input_GroupBox1.Controls.Add(Me.RuleNameTextBox1) 105 | Me.Rule_Input_GroupBox1.Controls.Add(Me.Label2) 106 | Me.Rule_Input_GroupBox1.Controls.Add(Me.Label1) 107 | Me.Rule_Input_GroupBox1.Controls.Add(Me.ClearRuleText_Button) 108 | Me.Rule_Input_GroupBox1.Controls.Add(Me.ImportRuleFromFile_Button) 109 | Me.Rule_Input_GroupBox1.Controls.Add(Me.Rule_Contents_TextBox) 110 | Me.Rule_Input_GroupBox1.Location = New System.Drawing.Point(12, 308) 111 | Me.Rule_Input_GroupBox1.Name = "Rule_Input_GroupBox1" 112 | Me.Rule_Input_GroupBox1.Size = New System.Drawing.Size(777, 261) 113 | Me.Rule_Input_GroupBox1.TabIndex = 2 114 | Me.Rule_Input_GroupBox1.TabStop = False 115 | Me.Rule_Input_GroupBox1.Text = "Rule Builder :" 116 | ' 117 | 'SelectfromInventorFileButton 118 | ' 119 | Me.SelectfromInventorFileButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 120 | Me.SelectfromInventorFileButton.Location = New System.Drawing.Point(383, 50) 121 | Me.SelectfromInventorFileButton.Name = "SelectfromInventorFileButton" 122 | Me.SelectfromInventorFileButton.Size = New System.Drawing.Size(164, 23) 123 | Me.SelectfromInventorFileButton.TabIndex = 5 124 | Me.SelectfromInventorFileButton.Text = "Import from Inventor file" 125 | Me.SelectfromInventorFileButton.UseVisualStyleBackColor = True 126 | ' 127 | 'RuleNameTextBox1 128 | ' 129 | Me.HelpProvider1.SetHelpString(Me.RuleNameTextBox1, "Input for the name of the rule that you are creating.") 130 | Me.RuleNameTextBox1.Location = New System.Drawing.Point(100, 24) 131 | Me.RuleNameTextBox1.Name = "RuleNameTextBox1" 132 | Me.HelpProvider1.SetShowHelp(Me.RuleNameTextBox1, True) 133 | Me.RuleNameTextBox1.Size = New System.Drawing.Size(170, 20) 134 | Me.RuleNameTextBox1.TabIndex = 1 135 | ' 136 | 'Label2 137 | ' 138 | Me.Label2.AutoSize = True 139 | Me.Label2.Location = New System.Drawing.Point(3, 27) 140 | Me.Label2.Name = "Label2" 141 | Me.Label2.Size = New System.Drawing.Size(91, 13) 142 | Me.Label2.TabIndex = 0 143 | Me.Label2.Text = "New Rule Name :" 144 | ' 145 | 'Label1 146 | ' 147 | Me.Label1.AutoSize = True 148 | Me.Label1.Location = New System.Drawing.Point(3, 63) 149 | Me.Label1.Name = "Label1" 150 | Me.Label1.Size = New System.Drawing.Size(87, 13) 151 | Me.Label1.TabIndex = 0 152 | Me.Label1.Text = "Rule Code Text :" 153 | ' 154 | 'ClearRuleText_Button 155 | ' 156 | Me.ClearRuleText_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 157 | Me.HelpProvider1.SetHelpString(Me.ClearRuleText_Button, "Will clear any text inside of the Rule Code Text box.") 158 | Me.ClearRuleText_Button.Location = New System.Drawing.Point(607, 19) 159 | Me.ClearRuleText_Button.Name = "ClearRuleText_Button" 160 | Me.HelpProvider1.SetShowHelp(Me.ClearRuleText_Button, True) 161 | Me.ClearRuleText_Button.Size = New System.Drawing.Size(164, 25) 162 | Me.ClearRuleText_Button.TabIndex = 3 163 | Me.ClearRuleText_Button.Text = "Clear Rule Code Text" 164 | Me.ClearRuleText_Button.UseVisualStyleBackColor = True 165 | ' 166 | 'ImportRuleFromFile_Button 167 | ' 168 | Me.ImportRuleFromFile_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 169 | Me.HelpProvider1.SetHelpString(Me.ImportRuleFromFile_Button, "Allows you to import the contents of a text file (.txt), a Visual Basics file (.v" & _ 170 | "b), or an iLogic file (.iLogicVB), directly into the Rule Code Text box.") 171 | Me.ImportRuleFromFile_Button.Location = New System.Drawing.Point(383, 18) 172 | Me.ImportRuleFromFile_Button.Name = "ImportRuleFromFile_Button" 173 | Me.HelpProvider1.SetShowHelp(Me.ImportRuleFromFile_Button, True) 174 | Me.ImportRuleFromFile_Button.Size = New System.Drawing.Size(164, 25) 175 | Me.ImportRuleFromFile_Button.TabIndex = 4 176 | Me.ImportRuleFromFile_Button.Text = "Import From text file" 177 | Me.ImportRuleFromFile_Button.UseVisualStyleBackColor = True 178 | ' 179 | 'RuleFileDialog 180 | ' 181 | Me.RuleFileDialog.Filter = "(Formats)|*.txt; *.vb; *.iLogicVB" 182 | Me.RuleFileDialog.Title = "Rule File Chooser" 183 | ' 184 | 'Directory_Browse_Dialog 185 | ' 186 | Me.Directory_Browse_Dialog.RootFolder = System.Environment.SpecialFolder.MyComputer 187 | Me.Directory_Browse_Dialog.SelectedPath = "C:\" 188 | ' 189 | 'SelectFolder_Button 190 | ' 191 | Me.SelectFolder_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 192 | Me.HelpProvider1.SetHelpString(Me.SelectFolder_Button, "Used to select a folder from a user specified directory. Use the check boxes abov" & _ 193 | "e to control which individual file types will be selected. ") 194 | Me.SelectFolder_Button.Location = New System.Drawing.Point(607, 137) 195 | Me.SelectFolder_Button.Name = "SelectFolder_Button" 196 | Me.HelpProvider1.SetShowHelp(Me.SelectFolder_Button, True) 197 | Me.SelectFolder_Button.Size = New System.Drawing.Size(164, 25) 198 | Me.SelectFolder_Button.TabIndex = 5 199 | Me.SelectFolder_Button.Text = "Select Folder" 200 | Me.SelectFolder_Button.UseVisualStyleBackColor = True 201 | ' 202 | 'CheckIPT 203 | ' 204 | Me.CheckIPT.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 205 | Me.CheckIPT.Checked = True 206 | Me.CheckIPT.CheckState = System.Windows.Forms.CheckState.Checked 207 | Me.HelpProvider1.SetHelpString(Me.CheckIPT, "By selecting this item before searching a folder / directory, all files with the " & _ 208 | "extension '.ipt' will be added to the File Selection List.") 209 | Me.CheckIPT.Location = New System.Drawing.Point(713, 29) 210 | Me.CheckIPT.Name = "CheckIPT" 211 | Me.HelpProvider1.SetShowHelp(Me.CheckIPT, True) 212 | Me.CheckIPT.Size = New System.Drawing.Size(43, 17) 213 | Me.CheckIPT.TabIndex = 2 214 | Me.CheckIPT.Text = "IPT" 215 | Me.CheckIPT.UseVisualStyleBackColor = True 216 | ' 217 | 'CheckIAM 218 | ' 219 | Me.CheckIAM.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 220 | Me.HelpProvider1.SetHelpString(Me.CheckIAM, "By selecting this item before searching a folder / directory, all files with the " & _ 221 | "extension '.iam' will be added to the File Selection List.") 222 | Me.CheckIAM.Location = New System.Drawing.Point(713, 52) 223 | Me.CheckIAM.Name = "CheckIAM" 224 | Me.HelpProvider1.SetShowHelp(Me.CheckIAM, True) 225 | Me.CheckIAM.Size = New System.Drawing.Size(45, 17) 226 | Me.CheckIAM.TabIndex = 3 227 | Me.CheckIAM.Text = "IAM" 228 | Me.CheckIAM.UseVisualStyleBackColor = True 229 | ' 230 | 'CheckIDW 231 | ' 232 | Me.CheckIDW.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 233 | Me.HelpProvider1.SetHelpString(Me.CheckIDW, "By selecting this item before searching a folder / directory, all files with the " & _ 234 | "extension '.idw' will be added to the File Selection List.") 235 | Me.CheckIDW.Location = New System.Drawing.Point(713, 75) 236 | Me.CheckIDW.Name = "CheckIDW" 237 | Me.HelpProvider1.SetShowHelp(Me.CheckIDW, True) 238 | Me.CheckIDW.Size = New System.Drawing.Size(48, 17) 239 | Me.CheckIDW.TabIndex = 4 240 | Me.CheckIDW.Text = "IDW" 241 | Me.CheckIDW.UseVisualStyleBackColor = True 242 | ' 243 | 'ListBox1 244 | ' 245 | Me.ListBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ 246 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 247 | Me.ListBox1.FormattingEnabled = True 248 | Me.HelpProvider1.SetHelpKeyword(Me.ListBox1, "File List Selection") 249 | Me.HelpProvider1.SetHelpString(Me.ListBox1, "Shows a list of all files that will be processed after the ""Add Rules"" button has" & _ 250 | " been pressed.") 251 | Me.ListBox1.Location = New System.Drawing.Point(6, 42) 252 | Me.ListBox1.Name = "ListBox1" 253 | Me.ListBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended 254 | Me.HelpProvider1.SetShowHelp(Me.ListBox1, True) 255 | Me.ListBox1.Size = New System.Drawing.Size(574, 238) 256 | Me.ListBox1.TabIndex = 8 257 | ' 258 | 'GroupBox1 259 | ' 260 | Me.GroupBox1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 261 | Me.GroupBox1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink 262 | Me.GroupBox1.Controls.Add(Me.Label7) 263 | Me.GroupBox1.Controls.Add(Me.Label6) 264 | Me.GroupBox1.Controls.Add(Me.Label5) 265 | Me.GroupBox1.Controls.Add(Me.EventTriggers_CheckedListBox1) 266 | Me.GroupBox1.Location = New System.Drawing.Point(795, 12) 267 | Me.GroupBox1.Name = "GroupBox1" 268 | Me.GroupBox1.Size = New System.Drawing.Size(238, 290) 269 | Me.GroupBox1.TabIndex = 3 270 | Me.GroupBox1.TabStop = False 271 | Me.GroupBox1.Text = "Event Triggers" 272 | ' 273 | 'Label7 274 | ' 275 | Me.Label7.AutoSize = True 276 | Me.Label7.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 277 | Me.Label7.Location = New System.Drawing.Point(13, 264) 278 | Me.Label7.Name = "Label7" 279 | Me.Label7.Size = New System.Drawing.Size(182, 13) 280 | Me.Label7.TabIndex = 0 281 | Me.Label7.Text = "(***) Indicates For Drawing File ONLY" 282 | ' 283 | 'Label6 284 | ' 285 | Me.Label6.AutoSize = True 286 | Me.Label6.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 287 | Me.Label6.Location = New System.Drawing.Point(13, 246) 288 | Me.Label6.Name = "Label6" 289 | Me.Label6.Size = New System.Drawing.Size(163, 13) 290 | Me.Label6.TabIndex = 0 291 | Me.Label6.Text = "(**) Indicates For Parts File ONLY" 292 | ' 293 | 'Label5 294 | ' 295 | Me.Label5.AutoSize = True 296 | Me.Label5.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer)) 297 | Me.Label5.Location = New System.Drawing.Point(13, 229) 298 | Me.Label5.Name = "Label5" 299 | Me.Label5.Size = New System.Drawing.Size(179, 13) 300 | Me.Label5.TabIndex = 0 301 | Me.Label5.Text = "(*) Indicates For Assembly File ONLY" 302 | ' 303 | 'EventTriggers_CheckedListBox1 304 | ' 305 | Me.EventTriggers_CheckedListBox1.CheckOnClick = True 306 | Me.EventTriggers_CheckedListBox1.FormattingEnabled = True 307 | Me.EventTriggers_CheckedListBox1.Items.AddRange(New Object() {"After Open Document", "Close Document", "Before Save Document", "After Save Document", "Any Model Parameter Change", "Part Geometry Change**", "Material Change**", "Drawing View Change***", "iProperty Change", "Feature Suppression Change**", "Component Suppression Change*", "iPart / iAssembly Change Component*", "New Document"}) 308 | Me.EventTriggers_CheckedListBox1.Location = New System.Drawing.Point(6, 19) 309 | Me.EventTriggers_CheckedListBox1.Name = "EventTriggers_CheckedListBox1" 310 | Me.HelpProvider1.SetShowHelp(Me.EventTriggers_CheckedListBox1, True) 311 | Me.EventTriggers_CheckedListBox1.Size = New System.Drawing.Size(225, 199) 312 | Me.EventTriggers_CheckedListBox1.TabIndex = 11 313 | ' 314 | 'GroupBox2 315 | ' 316 | Me.GroupBox2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ 317 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 318 | Me.GroupBox2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink 319 | Me.GroupBox2.Controls.Add(Me.CheckDWG) 320 | Me.GroupBox2.Controls.Add(Me.ClearFolderList_Button) 321 | Me.GroupBox2.Controls.Add(Me.ClearSelectedFromList_Button) 322 | Me.GroupBox2.Controls.Add(Me.Label4) 323 | Me.GroupBox2.Controls.Add(Me.Label3) 324 | Me.GroupBox2.Controls.Add(Me.ListBox1) 325 | Me.GroupBox2.Controls.Add(Me.CheckIPT) 326 | Me.GroupBox2.Controls.Add(Me.CheckIDW) 327 | Me.GroupBox2.Controls.Add(Me.SelectFolder_Button) 328 | Me.GroupBox2.Controls.Add(Me.CheckIAM) 329 | Me.GroupBox2.Location = New System.Drawing.Point(12, 12) 330 | Me.GroupBox2.Name = "GroupBox2" 331 | Me.GroupBox2.Size = New System.Drawing.Size(777, 290) 332 | Me.GroupBox2.TabIndex = 1 333 | Me.GroupBox2.TabStop = False 334 | Me.GroupBox2.Text = "Inventor File Selection" 335 | ' 336 | 'CheckDWG 337 | ' 338 | Me.CheckDWG.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 339 | Me.HelpProvider1.SetHelpString(Me.CheckDWG, "By selecting this item before searching a folder / directory, all files with the " & _ 340 | "extension '.idw' will be added to the File Selection List.") 341 | Me.CheckDWG.Location = New System.Drawing.Point(713, 98) 342 | Me.CheckDWG.Name = "CheckDWG" 343 | Me.HelpProvider1.SetShowHelp(Me.CheckDWG, True) 344 | Me.CheckDWG.Size = New System.Drawing.Size(58, 17) 345 | Me.CheckDWG.TabIndex = 9 346 | Me.CheckDWG.Text = "DWG" 347 | Me.CheckDWG.UseVisualStyleBackColor = True 348 | ' 349 | 'ClearFolderList_Button 350 | ' 351 | Me.ClearFolderList_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 352 | Me.HelpProvider1.SetHelpString(Me.ClearFolderList_Button, "Will clear the entire file list of all content.") 353 | Me.ClearFolderList_Button.Location = New System.Drawing.Point(607, 255) 354 | Me.ClearFolderList_Button.Name = "ClearFolderList_Button" 355 | Me.HelpProvider1.SetShowHelp(Me.ClearFolderList_Button, True) 356 | Me.ClearFolderList_Button.Size = New System.Drawing.Size(164, 25) 357 | Me.ClearFolderList_Button.TabIndex = 7 358 | Me.ClearFolderList_Button.Text = "Clear Folder List" 359 | Me.ClearFolderList_Button.UseVisualStyleBackColor = True 360 | ' 361 | 'ClearSelectedFromList_Button 362 | ' 363 | Me.ClearSelectedFromList_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 364 | Me.HelpProvider1.SetHelpString(Me.ClearSelectedFromList_Button, "Clear any files out of the list that have been selected by the user.") 365 | Me.ClearSelectedFromList_Button.Location = New System.Drawing.Point(607, 224) 366 | Me.ClearSelectedFromList_Button.Name = "ClearSelectedFromList_Button" 367 | Me.HelpProvider1.SetShowHelp(Me.ClearSelectedFromList_Button, True) 368 | Me.ClearSelectedFromList_Button.Size = New System.Drawing.Size(164, 25) 369 | Me.ClearSelectedFromList_Button.TabIndex = 6 370 | Me.ClearSelectedFromList_Button.Text = "Clear Selected From List" 371 | Me.ClearSelectedFromList_Button.UseVisualStyleBackColor = True 372 | ' 373 | 'Label4 374 | ' 375 | Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 376 | Me.Label4.AutoSize = True 377 | Me.Label4.Location = New System.Drawing.Point(609, 29) 378 | Me.Label4.Name = "Label4" 379 | Me.Label4.Size = New System.Drawing.Size(103, 13) 380 | Me.Label4.TabIndex = 1 381 | Me.Label4.Text = "Choose FileType(s) :" 382 | ' 383 | 'Label3 384 | ' 385 | Me.Label3.AutoSize = True 386 | Me.Label3.Location = New System.Drawing.Point(3, 29) 387 | Me.Label3.Name = "Label3" 388 | Me.Label3.Size = New System.Drawing.Size(113, 13) 389 | Me.Label3.TabIndex = 0 390 | Me.Label3.Text = "Current File Selection :" 391 | ' 392 | 'ExitProgram_Button 393 | ' 394 | Me.ExitProgram_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 395 | Me.HelpProvider1.SetHelpString(Me.ExitProgram_Button, "Used to close down this program.") 396 | Me.ExitProgram_Button.Location = New System.Drawing.Point(823, 535) 397 | Me.ExitProgram_Button.Name = "ExitProgram_Button" 398 | Me.HelpProvider1.SetShowHelp(Me.ExitProgram_Button, True) 399 | Me.ExitProgram_Button.Size = New System.Drawing.Size(164, 25) 400 | Me.ExitProgram_Button.TabIndex = 15 401 | Me.ExitProgram_Button.Text = "Exit Program" 402 | Me.ExitProgram_Button.UseVisualStyleBackColor = True 403 | ' 404 | 'GroupBox3 405 | ' 406 | Me.GroupBox3.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ 407 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 408 | Me.GroupBox3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink 409 | Me.GroupBox3.Controls.Add(Me.DeleteAfterRun_RadioButton) 410 | Me.GroupBox3.Controls.Add(Me.KeepAfterRun_RadioButton) 411 | Me.GroupBox3.Controls.Add(Me.RunRulesOnCreation_CheckBox) 412 | Me.GroupBox3.Controls.Add(Me.OverwriteDuplicateRules_CheckBox) 413 | Me.GroupBox3.Location = New System.Drawing.Point(795, 308) 414 | Me.GroupBox3.Name = "GroupBox3" 415 | Me.GroupBox3.Size = New System.Drawing.Size(237, 151) 416 | Me.GroupBox3.TabIndex = 4 417 | Me.GroupBox3.TabStop = False 418 | Me.GroupBox3.Text = "Advanced Options" 419 | ' 420 | 'DeleteAfterRun_RadioButton 421 | ' 422 | Me.DeleteAfterRun_RadioButton.AutoSize = True 423 | Me.DeleteAfterRun_RadioButton.Enabled = False 424 | Me.DeleteAfterRun_RadioButton.Location = New System.Drawing.Point(28, 88) 425 | Me.DeleteAfterRun_RadioButton.Name = "DeleteAfterRun_RadioButton" 426 | Me.DeleteAfterRun_RadioButton.Size = New System.Drawing.Size(118, 17) 427 | Me.DeleteAfterRun_RadioButton.TabIndex = 16 428 | Me.DeleteAfterRun_RadioButton.TabStop = True 429 | Me.DeleteAfterRun_RadioButton.Text = "Delete rule after run" 430 | Me.DeleteAfterRun_RadioButton.UseVisualStyleBackColor = True 431 | ' 432 | 'KeepAfterRun_RadioButton 433 | ' 434 | Me.KeepAfterRun_RadioButton.AutoSize = True 435 | Me.KeepAfterRun_RadioButton.Enabled = False 436 | Me.KeepAfterRun_RadioButton.Location = New System.Drawing.Point(28, 64) 437 | Me.KeepAfterRun_RadioButton.Name = "KeepAfterRun_RadioButton" 438 | Me.KeepAfterRun_RadioButton.Size = New System.Drawing.Size(112, 17) 439 | Me.KeepAfterRun_RadioButton.TabIndex = 15 440 | Me.KeepAfterRun_RadioButton.TabStop = True 441 | Me.KeepAfterRun_RadioButton.Text = "Keep rule after run" 442 | Me.KeepAfterRun_RadioButton.UseVisualStyleBackColor = True 443 | ' 444 | 'RunRulesOnCreation_CheckBox 445 | ' 446 | Me.RunRulesOnCreation_CheckBox.AutoSize = True 447 | Me.RunRulesOnCreation_CheckBox.Location = New System.Drawing.Point(6, 41) 448 | Me.RunRulesOnCreation_CheckBox.Name = "RunRulesOnCreation_CheckBox" 449 | Me.HelpProvider1.SetShowHelp(Me.RunRulesOnCreation_CheckBox, True) 450 | Me.RunRulesOnCreation_CheckBox.Size = New System.Drawing.Size(71, 17) 451 | Me.RunRulesOnCreation_CheckBox.TabIndex = 13 452 | Me.RunRulesOnCreation_CheckBox.Text = "Run Rule" 453 | Me.RunRulesOnCreation_CheckBox.UseVisualStyleBackColor = True 454 | ' 455 | 'OverwriteDuplicateRules_CheckBox 456 | ' 457 | Me.OverwriteDuplicateRules_CheckBox.AutoSize = True 458 | Me.OverwriteDuplicateRules_CheckBox.Location = New System.Drawing.Point(6, 18) 459 | Me.OverwriteDuplicateRules_CheckBox.Name = "OverwriteDuplicateRules_CheckBox" 460 | Me.HelpProvider1.SetShowHelp(Me.OverwriteDuplicateRules_CheckBox, True) 461 | Me.OverwriteDuplicateRules_CheckBox.Size = New System.Drawing.Size(149, 17) 462 | Me.OverwriteDuplicateRules_CheckBox.TabIndex = 12 463 | Me.OverwriteDuplicateRules_CheckBox.Text = "Overwrite Duplicate Rules" 464 | Me.OverwriteDuplicateRules_CheckBox.UseVisualStyleBackColor = True 465 | ' 466 | 'StatusStrip1 467 | ' 468 | Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripProgressBar1, Me.InventorLoadingText, Me.ToolStripStatusLabel1}) 469 | Me.StatusStrip1.Location = New System.Drawing.Point(0, 575) 470 | Me.StatusStrip1.Name = "StatusStrip1" 471 | Me.StatusStrip1.Size = New System.Drawing.Size(1045, 22) 472 | Me.StatusStrip1.TabIndex = 16 473 | Me.StatusStrip1.Text = "StatusStrip1" 474 | ' 475 | 'ToolStripProgressBar1 476 | ' 477 | Me.ToolStripProgressBar1.Name = "ToolStripProgressBar1" 478 | Me.ToolStripProgressBar1.Size = New System.Drawing.Size(100, 16) 479 | Me.ToolStripProgressBar1.Step = 1 480 | ' 481 | 'InventorLoadingText 482 | ' 483 | Me.InventorLoadingText.BackColor = System.Drawing.SystemColors.Control 484 | Me.InventorLoadingText.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text 485 | Me.InventorLoadingText.ForeColor = System.Drawing.SystemColors.Control 486 | Me.InventorLoadingText.Name = "InventorLoadingText" 487 | Me.InventorLoadingText.Size = New System.Drawing.Size(106, 17) 488 | Me.InventorLoadingText.Text = "Loading Inventor..." 489 | ' 490 | 'ToolStripStatusLabel1 491 | ' 492 | Me.ToolStripStatusLabel1.AutoSize = False 493 | Me.ToolStripStatusLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text 494 | Me.ToolStripStatusLabel1.Margin = New System.Windows.Forms.Padding(600, 3, 0, 2) 495 | Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1" 496 | Me.ToolStripStatusLabel1.RightToLeft = System.Windows.Forms.RightToLeft.No 497 | Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(155, 17) 498 | Me.ToolStripStatusLabel1.Text = "Current Version::" 499 | Me.ToolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight 500 | ' 501 | 'DeleteRulesButton 502 | ' 503 | Me.DeleteRulesButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) 504 | Me.DeleteRulesButton.Location = New System.Drawing.Point(823, 477) 505 | Me.DeleteRulesButton.Name = "DeleteRulesButton" 506 | Me.DeleteRulesButton.Size = New System.Drawing.Size(164, 23) 507 | Me.DeleteRulesButton.TabIndex = 17 508 | Me.DeleteRulesButton.Text = "Delete all rules" 509 | Me.DeleteRulesButton.UseVisualStyleBackColor = True 510 | ' 511 | 'Code_Injector 512 | ' 513 | Me.AcceptButton = Me.AddRules_Button 514 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 515 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 516 | Me.ClientSize = New System.Drawing.Size(1045, 597) 517 | Me.Controls.Add(Me.DeleteRulesButton) 518 | Me.Controls.Add(Me.StatusStrip1) 519 | Me.Controls.Add(Me.GroupBox3) 520 | Me.Controls.Add(Me.ExitProgram_Button) 521 | Me.Controls.Add(Me.GroupBox2) 522 | Me.Controls.Add(Me.GroupBox1) 523 | Me.Controls.Add(Me.AddRules_Button) 524 | Me.Controls.Add(Me.Rule_Input_GroupBox1) 525 | Me.HelpButton = True 526 | Me.HelpProvider1.SetHelpKeyword(Me, "") 527 | Me.HelpProvider1.SetHelpString(Me, "") 528 | Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) 529 | Me.Margin = New System.Windows.Forms.Padding(2) 530 | Me.MaximizeBox = False 531 | Me.MinimizeBox = False 532 | Me.MinimumSize = New System.Drawing.Size(1061, 635) 533 | Me.Name = "Code_Injector" 534 | Me.HelpProvider1.SetShowHelp(Me, True) 535 | Me.Text = "Code Injector for 2011-2013" 536 | Me.Rule_Input_GroupBox1.ResumeLayout(False) 537 | Me.Rule_Input_GroupBox1.PerformLayout() 538 | Me.GroupBox1.ResumeLayout(False) 539 | Me.GroupBox1.PerformLayout() 540 | Me.GroupBox2.ResumeLayout(False) 541 | Me.GroupBox2.PerformLayout() 542 | Me.GroupBox3.ResumeLayout(False) 543 | Me.GroupBox3.PerformLayout() 544 | Me.StatusStrip1.ResumeLayout(False) 545 | Me.StatusStrip1.PerformLayout() 546 | Me.ResumeLayout(False) 547 | Me.PerformLayout() 548 | 549 | End Sub 550 | Friend WithEvents AddRules_Button As System.Windows.Forms.Button 551 | Friend WithEvents Rule_Contents_TextBox As System.Windows.Forms.TextBox 552 | Friend WithEvents Rule_Input_GroupBox1 As System.Windows.Forms.GroupBox 553 | Friend WithEvents ImportRuleFromFile_Button As System.Windows.Forms.Button 554 | Friend WithEvents RuleFileDialog As System.Windows.Forms.OpenFileDialog 555 | Friend WithEvents Label1 As System.Windows.Forms.Label 556 | Friend WithEvents ClearRuleText_Button As System.Windows.Forms.Button 557 | Friend WithEvents Label2 As System.Windows.Forms.Label 558 | Friend WithEvents RuleNameTextBox1 As System.Windows.Forms.TextBox 559 | Friend WithEvents Directory_Browse_Dialog As System.Windows.Forms.FolderBrowserDialog 560 | Friend WithEvents SelectFolder_Button As System.Windows.Forms.Button 561 | Friend WithEvents CheckIPT As System.Windows.Forms.CheckBox 562 | Friend WithEvents CheckIAM As System.Windows.Forms.CheckBox 563 | Friend WithEvents CheckIDW As System.Windows.Forms.CheckBox 564 | Friend WithEvents ListBox1 As System.Windows.Forms.ListBox 565 | Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox 566 | Friend WithEvents EventTriggers_CheckedListBox1 As System.Windows.Forms.CheckedListBox 567 | Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox 568 | Friend WithEvents ClearFolderList_Button As System.Windows.Forms.Button 569 | Friend WithEvents ClearSelectedFromList_Button As System.Windows.Forms.Button 570 | Friend WithEvents Label4 As System.Windows.Forms.Label 571 | Friend WithEvents Label3 As System.Windows.Forms.Label 572 | Friend WithEvents ExitProgram_Button As System.Windows.Forms.Button 573 | Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox 574 | Friend WithEvents RunRulesOnCreation_CheckBox As System.Windows.Forms.CheckBox 575 | Friend WithEvents OverwriteDuplicateRules_CheckBox As System.Windows.Forms.CheckBox 576 | Friend WithEvents Label5 As System.Windows.Forms.Label 577 | Friend WithEvents Label7 As System.Windows.Forms.Label 578 | Friend WithEvents Label6 As System.Windows.Forms.Label 579 | Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider 580 | Friend WithEvents StatusStrip1 As System.Windows.Forms.StatusStrip 581 | Friend WithEvents ToolStripProgressBar1 As System.Windows.Forms.ToolStripProgressBar 582 | Friend WithEvents ToolStripStatusLabel1 As System.Windows.Forms.ToolStripStatusLabel 583 | Friend WithEvents InventorLoadingText As System.Windows.Forms.ToolStripStatusLabel 584 | Friend WithEvents DeleteAfterRun_RadioButton As System.Windows.Forms.RadioButton 585 | Friend WithEvents KeepAfterRun_RadioButton As System.Windows.Forms.RadioButton 586 | Friend WithEvents CheckDWG As System.Windows.Forms.CheckBox 587 | Friend WithEvents SelectfromInventorFileButton As System.Windows.Forms.Button 588 | Friend WithEvents DeleteRulesButton As System.Windows.Forms.Button 589 | 590 | End Class 591 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/Code_Injector.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Type 3 | Imports System.Activator 4 | Imports System.Runtime.InteropServices 5 | Imports Inventor 6 | Imports System.IO 7 | Imports System.IO.IsolatedStorage 8 | Imports Autodesk.iLogic.Automation 9 | Imports Autodesk.iLogic.Interfaces 10 | 11 | Public Class Code_Injector 12 | Public openInventorApp As Inventor.Application 13 | 'Create a new object called iLogicObject 14 | 15 | Dim wasStarted As Boolean = False 16 | 17 | Dim invProcess As New InventorProcess() 18 | 19 | Public Sub New() 20 | 21 | ' This call is required by the designer. 22 | InitializeComponent() 23 | 24 | ' Add any initialization after the InitializeComponent() call. 25 | invProcess.StartInventor() 26 | openInventorApp = invProcess.Application 27 | openInventorApp.Visible = False 28 | 29 | End Sub 30 | 31 | 'All of the Subs that handle the preparation work are found first, while the workhorses are found further below (Specifically after the Sub Button_1Click). 32 | 33 | 'Fires when the Import Rule button is pressed 34 | 35 | Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImportRuleFromFile_Button.Click 36 | 37 | 'Open a file browser window, and if the user clicks OK, then do the following... 38 | 39 | If RuleFileDialog.ShowDialog() = DialogResult.OK Then 40 | 41 | 'Create a new StreamReder to read the contents of the text file selected... 42 | 43 | Using ruleFileReader As New System.IO.StreamReader(RuleFileDialog.FileName) 44 | 45 | 'Make a container to store that text 46 | Dim newRuleText As String 47 | 48 | 'Throw that text into the container 49 | newRuleText = ruleFileReader.ReadToEnd 50 | 51 | 'Check if the Rule Editing box already has some text in it 52 | If Rule_Contents_TextBox.TextLength > 0 Then 53 | 54 | 'If it does, we'll go to the next line before adding our imported text 55 | Rule_Contents_TextBox.AppendText(vbNewLine & newRuleText) 56 | Else 57 | 58 | 'If it doesn't, we'll add our text with no new line 59 | Rule_Contents_TextBox.Text = newRuleText 60 | End If 61 | 62 | 'Tells you that everything went A-OK! Of course you could have told that by looking 63 | 'at the contents of the Rule Editor box. 64 | 65 | MessageBox.Show("Text Copied", "Rule Copy Success") 66 | 67 | 'Now we'll close down that StreamReader by ending the Using statement. 68 | End Using 69 | End If 70 | End Sub 71 | 72 | 'Fires when the Clear Rule Code Text button is pressed 73 | 74 | Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearRuleText_Button.Click 75 | 'Clears all text inside of the Rule Code Text box. 76 | Rule_Contents_TextBox.Clear() 77 | End Sub 78 | 79 | 'Fires when the Select Folder button is pressed 80 | 81 | Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectFolder_Button.Click 82 | 83 | 'Opens the Folder Browser, and if the user clicks on the OK button, do the following... 84 | If Directory_Browse_Dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then 85 | 86 | 87 | Dim IPTExt, IAMExt, IDWExt, DWGExt As String 88 | 89 | 'Looks at the state of IPT check box, to see whether or not it's checked. 90 | If CheckIPT.CheckState = CheckState.Checked Then 91 | IPTExt = ".ipt" 92 | Else 93 | IPTExt = "" 94 | End If 95 | 96 | 'Looks at the state of IAM check box, to see whether or not it's checked. 97 | If CheckIAM.CheckState = CheckState.Checked Then 98 | IAMExt = ".iam" 99 | Else 100 | IAMExt = "" 101 | 102 | End If 103 | 104 | 'Looks at the state of IDW check box, to see whether or not it's checked. 105 | If CheckIDW.CheckState = CheckState.Checked Then 106 | IDWExt = ".idw" 107 | Else 108 | IDWExt = "" 109 | End If 110 | 111 | 'Looks at the state of DWG check box, to see whether or not it's checked. 112 | If CheckDWG.CheckState = CheckState.Checked Then 113 | DWGExt = ".dwg" 114 | Else 115 | DWGExt = "" 116 | End If 117 | 118 | 'Checks to see if there are any items already in the list of queue files. 119 | 'If there are, then we will clear them from that list. 120 | 121 | If ListBox1.Items() IsNot Nothing Then 122 | ListBox1.Items.Clear() 123 | End If 124 | 125 | 'Sets the string DirectoryPath to the path of the selected folder 126 | 127 | Dim DirectoryPath As String 128 | DirectoryPath = Directory_Browse_Dialog.SelectedPath 129 | 130 | 131 | Dim _files As Stack = getFiletypes(DirectoryPath, {"*.ipt", "*.iam", "*.idw", "*.dwg"}) 132 | 133 | Dim fileDetail As IO.FileInfo 134 | Dim strafile As String = "" 135 | 136 | 'For every file that we find inside the directory and its subfolders ... 137 | For Each strafile In _files 138 | 'We do the same thing for each file extension. 139 | 'If the value of the ???Ext = the extension in question 140 | 'we'll add it to the list of files in queue. 141 | 142 | 143 | fileDetail = My.Computer.FileSystem.GetFileInfo(strafile) 144 | 'Skip the files in the OldVersions folders 145 | If Strings.Right(fileDetail.DirectoryName, 11) <> "OldVersions" Then 146 | 147 | fileDetail = My.Computer.FileSystem.GetFileInfo(strafile) 148 | If IPTExt = ".ipt" Then 149 | If fileDetail.Extension = ".ipt" Then 150 | ListBox1.Items.Add(fileDetail.FullName) 151 | End If 152 | End If 153 | 154 | If IAMExt = ".iam" Then 155 | If fileDetail.Extension = ".iam" Then 156 | ListBox1.Items.Add(fileDetail.FullName) 157 | End If 158 | End If 159 | 160 | If IDWExt = ".idw" Then 161 | If fileDetail.Extension = ".idw" Then 162 | ListBox1.Items.Add(fileDetail.FullName) 163 | End If 164 | End If 165 | 166 | If DWGExt = ".dwg" Then 167 | If fileDetail.Extension = ".dwg" Then 168 | If openInventorApp.FileManager.IsInventorDWG(strafile) = True Then 169 | ListBox1.Items.Add(fileDetail.FullName) 170 | End If 171 | End If 172 | End If 173 | End If 174 | Next strafile 175 | End If 176 | 177 | End Sub 178 | 179 | 'Fires when the Clear Folder List button is pressed 180 | 181 | Private Sub ClearFolderList_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearFolderList_Button.Click 182 | 'Clears the list of files in queue 183 | ListBox1.Items.Clear() 184 | End Sub 185 | 186 | 'Fires when the Clear Selected From List button is pressed 187 | 188 | Private Sub ClearSelectedFromList_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearSelectedFromList_Button.Click 189 | 190 | 'Sets up a loop that looks at each *SELECTED* item in the list of files in queue. 191 | For i As Integer = (ListBox1.SelectedItems.Count - 1) To 0 Step -1 192 | 'Removes each of those items from the list. 193 | ListBox1.Items.Remove(ListBox1.SelectedItems(i)) 194 | Next 195 | 196 | End Sub 197 | 198 | 'Fires when the Exit button is pressed 199 | 200 | Private Sub ExitProgram_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitProgram_Button.Click 201 | 'Tells the form to run its Close subroutine. 202 | Me.Close() 203 | 204 | If Not openInventorApp Is Nothing Then 205 | openInventorApp.Visible = True 206 | End If 207 | End Sub 208 | 209 | 'Fires when the program is closing down. This is the Close subroutine 210 | 211 | Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs) Handles Me.FormClosed 212 | 213 | invProcess.StopInventor() 214 | End Sub 215 | 216 | 'THIS IS WHERE THE MAGIC(S) START TO HAPPEN' 217 | 218 | 'Fires when the Add Rule button is pressed 219 | 220 | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddRules_Button.Click 221 | 222 | 'First, let's check to see if we have any files in queue to process. 223 | 'If we don't, then... 224 | 225 | If ListBox1.Items.Count = 0 Then 226 | MessageBox.Show("There is no folder or file(s) to process.", "No Folder / File Selected!", MessageBoxButtons.OK, MessageBoxIcon.Error) 227 | Exit Sub 228 | End If 229 | 230 | 'If we get here, that means that we do have files to process. 231 | 'Let's see if the rule we will create has been given a name by the user 232 | 'If the Rule Name text has been left blank then... 233 | 234 | If RuleNameTextBox1.Text = "" Then 235 | MessageBox.Show("Please enter a valid (non-blank) name for your rule before continuing.", "No Rule Name Selected", MessageBoxButtons.OK, MessageBoxIcon.Error) 236 | Exit Sub 237 | 238 | 'Otherwise we will make sure that characters being used are either numbers, letters, or an underscore. 239 | Else 240 | 'using a temp variable called character, we look at each Char inside of the string produced from our Rule Name text box. 241 | For Each character As Char In Me.RuleNameTextBox1.Text 242 | 243 | 'Now we'll look at the ASCII numeric value of each string, and see if it fits into 244 | 'our super special pre-determined characters. 245 | 'here is a link to an ASCII character chart : http://www.rolbe.com/2009/03/03/vb-keyascii-chart/ 246 | 247 | Select Case Asc(character) 248 | Case 48 To 57, 65 To 90, 95, 97 To 122 249 | 'if the case passes, then we end up here... doing nothing! 250 | Case Else 251 | 'if it gets here (because it couldn't pass the above), then we give the user an error message, and exit the sub. 252 | MessageBox.Show("The Rule Name that you are attempting to use, may be invalid. Please make sure that you're not using any special characters (other than an underscore)", _ 253 | "Rule Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Error) 254 | Exit Sub 255 | End Select 256 | Next 257 | End If 258 | 259 | 'If we're here, it means that we have files to process, and our new rule will have a proper name. 260 | 'Let's make sure that our New Rule actually has something in it! 261 | 262 | 'If the rule contents are empty then... 263 | If Rule_Contents_TextBox.Text = "" Then 264 | MessageBox.Show("Rule text has been left blank! Please include some code / text to populate the new rule(s).", "No Rule Text", MessageBoxButtons.OK, MessageBoxIcon.Error) 265 | Exit Sub 266 | End If 267 | 268 | 269 | 270 | 'By turning on the silent operation, we skip all of the dialogs that would normally pop up to inform 271 | 'us that our files are being modified. 272 | 'Because we are checking (below in the code) if the files are Read Only, we know that we'll only be 273 | 'messing with files that are able to be messed with. 274 | openInventorApp.SilentOperation = True 275 | 276 | 277 | 'On the other hand, if Inventor is running, we shall continue! 278 | 279 | Dim iLogicObject As Object 280 | 281 | 'Check to make sure that the iLogic addin for Inventor is currently running and well. 282 | iLogicObject = GetiLogicAddin(openInventorApp) 283 | 284 | 'If it couldn't be found then... 285 | If (iLogicObject Is Nothing) Then 286 | MessageBox.Show("Could not find ilogic automation plugin! Unable to complete actions!", "Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Error) 287 | Exit Sub 288 | End If 289 | 290 | 'If the plugin was found, then we'll continue - 291 | 292 | 'We'll start by making initializing a new Integer called listCount 293 | Dim listCount As Integer 294 | 295 | 'We'll also tell our progress bar to only be as long, as there are items to count. 296 | ToolStripProgressBar1.Maximum = ListBox1.Items.Count 297 | 298 | 'In addition we can also set up just how much each step in our progress bar will take us. 299 | ToolStripProgressBar1.Step = 1 300 | 301 | 'We'll make a loop that counts down from the number items in our file queue list 302 | 'one by one. 303 | For listCount = ListBox1.Items.Count To 1 Step -1 304 | 305 | 'Create and empty Document called singleDoc 306 | Dim singleDoc As Document 307 | 308 | 'Sets singleDoc to the item that is currently being looked at, from our file queue. 309 | 'This also opens the document in Inventor for editing. 310 | singleDoc = openInventorApp.Documents.Open(ListBox1.Items(listCount - 1), True) 311 | 312 | 'Let's make sure we're allowed to modify this document. 313 | 'If the file is 'Read Only' then it will be skipped! 314 | If singleDoc.IsModifiable = True Then 315 | 316 | 'If we can modify it, then we'll continue. 317 | 318 | 'At this point we'll go to the CreateRule subroutine, passing our Document, and our iLogicObject to it. 319 | Call CreateRule(singleDoc, iLogicObject) 320 | 321 | Dim saveEnabled As Boolean = iLogicObject.RulesOnEventsEnabled 322 | iLogicObject.RulesOnEventsEnabled = False 323 | Try 324 | 'Save the document and all dependant documents. 325 | Call singleDoc.Save2(True) 326 | 327 | 'Just incase the file you're attempting to save to, can't be saved to... 328 | 329 | Catch ex As Exception 330 | 331 | MessageBox.Show("The directory / file you are attempting to save to is Read-Only." & vbCrLf & _ 332 | "Please make sure that you have permission to write to this directory / file before attempting to continue.", _ 333 | "Read-Write Error", MessageBoxButtons.OK, MessageBoxIcon.Error) 334 | Exit Sub 335 | 336 | Finally 337 | iLogicObject.RulesOnEventsEnabled = saveEnabled 338 | End Try 339 | 340 | 'Closes the document without any hassle. 341 | Call openInventorApp.ActiveDocument.Close(True) 342 | Else 343 | 'This area is blank. 344 | 'If you want something to happen when you find that a document can not be modified, then you would put it here. 345 | 'Otherwise, you can leave this area blank. 346 | End If 347 | 348 | 'Last but not least, let's show that we've completed work on the file, by increasing our progress bar by one step 349 | ToolStripProgressBar1.PerformStep() 350 | 'On to the next file. 351 | Next 352 | 353 | openInventorApp.SilentOperation = False 354 | openInventorApp.Visible = False 355 | 'Once everything is done, and all the files have been modified, we'll inform the user. 356 | MessageBox.Show("Operation Complete!", "Status : Finished") 357 | 358 | 'We'll also reset the progress bar back to 0 359 | ToolStripProgressBar1.Value = 0 360 | 361 | End Sub 362 | 363 | 'This Funciton is called from the Sub Button1_Click. It simply returns a value if it finds that the 364 | 'iLogic plugin is present in Inventor as we need that plugin for all of this to work! 365 | 'it also sets the value iLogicObject which is found in the above code, to the ApplicationAddIn, Automation. 366 | 'Of course, I feel a bit like this is a throw back to the older days of Inventor when 367 | 'iLogic was a seperate package, and didn't come installed right along with it, however, 368 | 'it never hurt anyone to be safe. 369 | 370 | Function GetiLogicAddin(ByVal oApplication As Inventor.Application) As Object 371 | Dim addIns As ApplicationAddIns 372 | addIns = oApplication.ApplicationAddIns 373 | 374 | Dim addIn As ApplicationAddIn 375 | On Error GoTo NotFound 376 | addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}") 377 | 378 | If (addIn Is Nothing) Then 379 | Return Nothing 380 | Exit Function 381 | End If 382 | 383 | addIn.Activate() 384 | GetiLogicAddin = addIn.Automation 385 | Exit Function 386 | NotFound: 387 | End Function 388 | 389 | Private Sub CreateRule(ByVal activeDoc As Document, ByVal iLogicAuto As Object) 390 | 391 | 'Creates a new String called ruleName, and sets it to Rule Name that user added 392 | Dim ruleName As String 393 | ruleName = RuleNameTextBox1.Text 394 | 395 | 'Creates a new String called ruleText, and sets it to the text contained in the Rule Code Text box. 396 | Dim ruleText As String 397 | ruleText = Rule_Contents_TextBox.Text 398 | 399 | 'Creates a new Object called rule. 400 | Dim rule As Object 401 | 402 | 'using our new object, we'll attempt to get the rule from the active document that is named the same 403 | 'as the rule name that the user put in. 404 | rule = iLogicAuto.GetRule(activeDoc, ruleName) 405 | 406 | 'creates a new Object called exRule, that we will leave blank for now. 407 | Dim exRule As Object 408 | 409 | 'if our rule Object doesn't equal anything (which means that it couldn't find a rule with the same 410 | 'name, then we'll do the following. 411 | If (rule Is Nothing) Then 412 | 413 | 'If the user has checked the Run Rules On Creation box, then... 414 | If RunRulesOnCreation_CheckBox.CheckState = CheckState.Checked Then 415 | 'We'll create a new rule in the current document, with our rule name, and our rule text 416 | 'By default when a rule is created, it is ran 417 | Call iLogicAuto.Addrule(activeDoc, ruleName, ruleText) 418 | If DeleteAfterRun_RadioButton.Checked = True Then iLogicAuto.DeleteRule(activeDoc, ruleName) ' Delete rule after run if radiobutton is checked 419 | 'otherwise... 420 | Else 421 | 422 | 'We will create a rule in the current document, that has a name, but doesn't have any text. 423 | 'This way the rule will fire with nothing to do, meaning that it does nothing! 424 | Call iLogicAuto.AddRule(activeDoc, ruleName, "") 425 | 426 | 427 | 'Now we can use that empty object, and grab rule that we just created. 428 | exRule = iLogicAuto.GetRule(activeDoc, ruleName) 429 | 430 | 'Now we can assign the users rule text to that rule, without it actually running. 431 | exRule.Text = ruleText 432 | End If 433 | Else 434 | 'If we're here, it means that we did find another rule inthe document that had the same name 435 | 'as the rule we wanted to add. 436 | 437 | 438 | 'check against rule text to see if it equals current text 439 | 'if it does, do nothing, if it doesn't, prompt user for an overwrite 440 | 441 | 'Set our empty object to the rule that exists. 442 | exRule = iLogicAuto.GetRule(activeDoc, ruleName) 443 | 444 | 'If the user chcked the Overwrite Duplicate Rules box, then... 445 | If OverwriteDuplicateRules_CheckBox.CheckState = CheckState.Checked Then 446 | If RunRulesOnCreation_CheckBox.CheckState = CheckState.Checked Then 447 | exRule.Text = ruleText 448 | iLogicAuto.RunRule(activeDoc, ruleName) 449 | If DeleteAfterRun_RadioButton.Checked = True Then iLogicAuto.DeleteRule(activeDoc, ruleName) 450 | Else 451 | 'We'll simply replace the text inside of the existing rule with the text the user entered into the Rule Code Text box. 452 | exRule.Text = ruleText 453 | End If 454 | 455 | 'otherwise... 456 | Else 457 | 458 | 'If the rule in the document has the exact same text as the user entered text, then there is nothing to change. 459 | If exRule.Text = ruleText Then 460 | 461 | If RunRulesOnCreation_CheckBox.CheckState = CheckState.Checked Then 462 | iLogicAuto.RunRule(activeDoc, ruleName) 463 | If DeleteAfterRun_RadioButton.Checked = True Then iLogicAuto.DeleteRule(activeDoc, ruleName) 464 | End If 465 | 466 | 'We'll initialize the Sub InitTriggers, and pass along a Document, and String 467 | InitTriggers(activeDoc, ruleName) 468 | 469 | 'When that's done, we'll exit this Sub 470 | Exit Sub 471 | 472 | 473 | Else 474 | 475 | 'If the text doesn't match, then we'll let the user decide if they want to replace it. 476 | 477 | 'If they select YES for the message box that shows up, then we will replace the existing rule's text with the user's text. 478 | If MessageBox.Show("The old rule does not match the new you are trying to overwrite it with. Would you like to continue?", _ 479 | "Duplicate Rule Text Mismatch", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) = Windows.Forms.DialogResult.Yes Then 480 | exRule.Text = ruleText 481 | 482 | If RunRulesOnCreation_CheckBox.CheckState = CheckState.Checked Then 483 | iLogicAuto.RunRule(activeDoc, ruleName) 484 | If DeleteAfterRun_RadioButton.Checked = True Then iLogicAuto.DeleteRule(activeDoc, ruleName) 485 | End If 486 | 487 | Else 488 | 489 | 'If the user doesn't want to replace the rule, then we'll exit the sub, and no changes will be made. 490 | 'This will also NOT apply any EventTriggers to the file. 491 | MessageBox.Show("File will be skipped.", "Duplicate Rule Skip", MessageBoxButtons.OK) 492 | Exit Sub 493 | End If 494 | End If 495 | End If 496 | End If 497 | 498 | 'We'll initialize the Sub InitTriggers, and pass along a Document, and String 499 | InitTriggers(activeDoc, ruleName) 500 | 501 | End Sub 502 | 503 | Private Sub InitTriggers(ByVal currentDoc As Document, ByVal currentRuleName As String) 504 | 505 | 'Let's make a new Integer, and String. 506 | Dim checkedCounter As Integer 507 | Dim checkedName As String 508 | 509 | 'If the user has not selected any Event Triggers, then we have no need to continue. We'll simply exit this sub. 510 | If EventTriggers_CheckedListBox1.CheckedItems.Count = 0 Then 511 | Exit Sub 512 | Else 513 | 514 | 'If the user has checked a/an Event Trigger(s), Then we'll need to go through each item that the user 515 | 'has checked. 516 | 517 | 'For every Event Trigger that was checked... 518 | For checkedCounter = 0 To EventTriggers_CheckedListBox1.CheckedItems.Count - 1 519 | 520 | 'We will set our checkedName variable to the current Event Trigger title. 521 | checkedName = EventTriggers_CheckedListBox1.CheckedItems(checkedCounter).ToString() 522 | 523 | 'We then gather all of this information and send it off to our VerifyTrigger Sub 524 | VerifyTrigger(currentDoc, currentRuleName, checkedName) 525 | Next 526 | End If 527 | End Sub 528 | 529 | Private Sub VerifyTrigger(ByVal cDoc As Document, ByVal rName As String, ByVal trigName As String) 530 | 531 | 'Let's set up some new data containers. 2 Strings and an Integer. 532 | 533 | 534 | Dim BaseID As Integer 535 | Dim BaseName As String 536 | Dim BaseUse As String 537 | 538 | 'Now... Let's talk. 539 | 'At this point I have to sort of point out why I'm doing the things I'm doing, sadly, it takes more 540 | 'than a simple 1 line comment. 541 | 'Event Triggers work in a sort of strange way. As I accidentally found out, - 542 | 'each Event Trigger is just a Property in the PropertySet called "iLogicEventsRules" 543 | 'Though unlike a regular property, you MUST assign a PropertyID to them when you create them, 544 | 'AND the property ID, MUST fall withen a certain range, otherwise, the trigger will simply not work. 545 | ' 546 | 'Below is a list of CheckList Box Names / Property Names / Property IDs. 547 | ' 548 | 'The Checklist Box Name is just the name that the user sees next to the checkboxes while they are 549 | 'selecting the various Event Triggers. I've tried to keep the names as close to what you would see 550 | 'in Inventor, had you set it up manually. 551 | ' 552 | 'The Property Name is the Name that is passed to the newly created Property. It's not as simple as 553 | 'passing just that name to the new property. You also have to tack on a numeric value to it! 554 | ' Example : AfterDocOpen1 555 | 'The numeric value simply tells Inventor the order in which to fire off the values associated with 556 | 'Event Triggers of the same type. To give you an example, let's assume that you want Rule1 and Rule2 557 | 'to both fire after the document is opened. If you were look at the properties of both of them, 558 | 'you would find that Rule1 would have a property name of AfterDocOpen0, and Rule2 would have a 559 | 'property name of AfterDocOpen1. 560 | ' 561 | ' 562 | 'The PropertyID is the default base Property ID that must be passed along to the property. 563 | 'Using the example above (Rule1 and Rule2), the entire property items would read out as : 564 | ' 565 | '("Rule1", "AfterDocOpen0", 400) 566 | ' & 567 | '("Rule2", "AfterDocOpen1", 401) 568 | ' 569 | 'Now that I think about it, I don't believe that I have tested out whether or not the 570 | 'numerical ending for the PropertyName should be the same amount added to the base PropertyID, 571 | 'but in the code below, I keep both values the same as it seems a rather fragile thing. 572 | ' 573 | 'I should also note that if you fail to include a PropertyID, and simply let Inventor set one 574 | 'for you, it will choose a number that is out of range, and though it will still 'look' as if 575 | 'it has created a working Trigger, it will actually do nothing. 576 | ' 577 | 'Below is a list of the Event Triggers for .ipt files (Solid and Sheet Metal) - 578 | '.iam files (Assembly), and .idw/.dwg files (Drawing Files). I do not know if this if the complete list 579 | 'of all available triggers inside of Inventor, as there maybe some filetypes / variations that I have 580 | 'overlooked (do not use regularly / at all). If you find that this list is incomplete, feel free to 581 | 'contact me using the information posted at the very topmost comments in this code. 582 | ' 583 | ' 584 | ' CheckList Box Name: : Property Name : : Property ID 585 | ' ---------------------------------------------------------------------------------------- 586 | ' After Open Document : AfterDocOpen : 400 587 | ' Close(Document) : DocClose : 500 588 | ' Before Save Document : BeforeDocSave : 700 589 | ' After Save Document : AfterDocSave : 800 590 | ' Any Model Parameter Change : AfterAnyParamChange : 1000 591 | ' Part Geometry Change** : PartBodyChanged : 1200 592 | ' Material Change** : AfterMaterialChange : 1400 593 | ' Drawing View Change*** : AfterDrawingViewsUpdate : 1800 594 | ' iProperty(Change) : AfterAnyiPropertyChange : 1600 595 | ' Feature Suppression Change** : AfterFeatureSuppressionChange : 2000 596 | ' Component Suppression Change* : AfterComponentSuppressionChange : 2200 597 | ' iPart / iAssembly Change Component* : AfterComponentReplace : 2400 598 | ' New Document : AfterDocNew : 2600 599 | ' 600 | ' ---------------------------------------------------------------------------------------- 601 | 602 | 603 | 604 | 'Let's look at the Event Trigger that user has selected (that has been passed to use here) 605 | 606 | 'If it matches the Case, then we will change the values of BaseName to the correct PropertyName 607 | 'We will change BaseID to the correct Base PropertyID 608 | 'And we will set where this trigger can be used, with the BaseUse value. 609 | 610 | 'A BaseUse of "All" means that it's a Trigger that can be used across the file types (.ipt/.iam/.idw/.dwg) 611 | 'A BaseUse of "Part" means that the trigger can only be used on a .ipt file. 612 | 'A BaseUse of "Assembly" means that the trigger can only be used on a .iam file. 613 | 'A BaseUse of "Drawing" means that the trigger can only be used on a .idw/.dwg file. 614 | 615 | Select Case trigName 616 | Case "After Open Document" 617 | BaseName = "AfterDocOpen" 618 | BaseID = 400 619 | BaseUse = "All" 620 | Case "Close Document" 621 | BaseName = "DocClose" 622 | BaseID = 500 623 | BaseUse = "All" 624 | Case "Before Save Document" 625 | BaseName = "BeforeDocSave" 626 | BaseID = 700 627 | BaseUse = "All" 628 | Case "After Save Document" 629 | BaseName = "AfterDocSave" 630 | BaseID = 800 631 | BaseUse = "All" 632 | Case "Any Model Parameter Change" 633 | BaseName = "AfterAnyParamChange" 634 | BaseID = 1000 635 | BaseUse = "All" 636 | Case "Part Geometry Change**" 637 | BaseName = "PartBodyChanged" 638 | BaseID = 1200 639 | BaseUse = "Part" 640 | Case "Material Change**" 641 | BaseName = "AfterMaterialChange" 642 | BaseID = 1400 643 | BaseUse = "Part" 644 | Case "Drawing View Change***" 645 | BaseName = "AfterDrawingViewsUpdate" 646 | BaseID = 1800 647 | BaseUse = "Drawing" 648 | Case "iProperty Change" 649 | BaseName = "AfterAnyiPropertyChange" 650 | BaseID = 1600 651 | BaseUse = "All" 652 | Case "Feature Suppression Change**" 653 | BaseName = "AfterFeatureSuppressionChange" 654 | BaseID = 2000 655 | BaseUse = "Part" 656 | Case "Component Suppression Change*" 657 | BaseName = "AfterComponentSuppressionChange*" 658 | BaseID = 2200 659 | BaseUse = "Assembly" 660 | Case "iPart / iAssembly Change Component*" 661 | BaseName = "AfterComponentReplace" 662 | BaseID = 2400 663 | BaseUse = "Assembly" 664 | Case "New Document" 665 | BaseName = "AfterDocNew" 666 | BaseID = 2600 667 | BaseUse = "All" 668 | Case Else 669 | 670 | 'If the value passed, doesn't match any of the Cases, then we'll throw up a crazy message box! 671 | 'It also means that I probably have a spelling error :( 672 | 673 | BaseUse = "None" 674 | MessageBox.Show("Trigger Event Error in Selection", "Trigger Event Selection Error") 675 | Exit Sub 676 | End Select 677 | 678 | 679 | 'First we check what the BaseUse is set to, then we check that against the current document's type. 680 | 'If they match up, we pass the current Document, the rule name, the trigger name, the base trigger name, and 681 | 'the base trigger ID to the sub SetEventProperty 682 | 683 | If BaseUse = "All" Then 684 | If cDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject _ 685 | Or cDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject _ 686 | Or cDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then 687 | SetEventProperty(cDoc, rName, trigName, BaseName, BaseID) 688 | Else 689 | Exit Sub 690 | End If 691 | ElseIf BaseUse = "Drawing" Then 692 | If cDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then 693 | SetEventProperty(cDoc, rName, trigName, BaseName, BaseID) 694 | Else 695 | Exit Sub 696 | End If 697 | ElseIf BaseUse = "Assembly" Then 698 | If cDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then 699 | SetEventProperty(cDoc, rName, trigName, BaseName, BaseID) 700 | Else 701 | Exit Sub 702 | End If 703 | ElseIf BaseUse = "Part" Then 704 | If cDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then 705 | SetEventProperty(cDoc, rName, trigName, BaseName, BaseID) 706 | Else 707 | Exit Sub 708 | End If 709 | ElseIf BaseUse = "None" Then 710 | Exit Sub 711 | End If 712 | End Sub 713 | 714 | Private Sub SetEventProperty(ByVal cDocument As Document, ByVal RuleName As String, ByVal CheckBoxTrigName As String, ByVal TriggerPropName As String, ByVal BaseID As Integer) 715 | 716 | 'Because we need to compare so many values, we'll need to set up a few containers 717 | 718 | Dim propItemCounter As Integer 719 | Dim TriggerID As Integer 720 | Dim CurrentID As Integer 721 | Dim EndHolder As Integer 722 | Dim CurrentEnd As Integer 723 | Dim customIPropSet As PropertySet 724 | 725 | 'EndHolder will act as the numerical value that will be attached to the end of the property name. 726 | EndHolder = 0 727 | 728 | 'TriggerID will hold on to the Trigger's base PropertyID value. 729 | TriggerID = BaseID 730 | 731 | Try 732 | customIPropSet = cDocument.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}") 733 | If customIPropSet.InternalName <> "{2C540830-0723-455E-A8E2-891722EB4C3E}" Then 734 | Call customIPropSet.Delete() 735 | Call cDocument.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}") 736 | customIPropSet = cDocument.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}") 737 | End If 738 | 739 | Catch ex As Exception 740 | Try 741 | Call cDocument.PropertySets.Add("iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}") 742 | customIPropSet = cDocument.PropertySets.Item("{2C540830-0723-455E-A8E2-891722EB4C3E}") 743 | Catch ex2 As Exception 744 | MessageBox.Show("Unable to create the Event Triggers property for this file!", "Event Triggers Not Set") 745 | Exit Sub 746 | End Try 747 | End Try 748 | 749 | 'Sets customIPropSet to equal the Item that contains the Event Triggers of the open document. 750 | 'customIPropSet = cDocument.PropertySets.Item("iLogicEventsRules") 751 | 752 | 'If there is an item (Event Trigger) found, then... 753 | If customIPropSet.Count > 0 Then 754 | 755 | 'We'll make a loop! This will go through each Property (Event Trigger), 1 Property at a time 756 | For propItemCounter = 1 To customIPropSet.Count Step 1 757 | 758 | 'This is for testing purposes. Because the individual Properties that are inside of a PropertySet 759 | 'are not exposed in VB.Net outright, you can uncomment the two lines of code below to allow you to 760 | 'see each Property as it goes through the count, one by one. 761 | '---------------------------- 762 | Dim megatest As [Property] 763 | megatest = customIPropSet.Item(propItemCounter) 764 | 765 | Dim nameTest As String 766 | nameTest = Strings.Left(customIPropSet.Item(propItemCounter).Name, Len(TriggerPropName)) 767 | 768 | Dim idTest As Integer 769 | idTest = (Convert.ToInt32(Math.Abs(customIPropSet.Item(propItemCounter).PropId / 100))) * 100 770 | 771 | If idTest = BaseID Then 772 | 773 | 'If the property name is equal, then we need to see if the Value of the property (AKA: The Rule Name) is 774 | 'equal to the new rule that we made previously. If it is, Then we're all done! The trigger already exists! 775 | If customIPropSet.Item(propItemCounter).Value = RuleName Then 776 | Exit Sub 777 | Else 778 | 779 | 'UPDATE Feb/3/2012 780 | 'Because of the unexpected things that I talk about above, I am making another statement here that will check 781 | 'to see if the PropertyName equals our TriggerPropName. 782 | If nameTest = TriggerPropName Then 783 | 784 | 'If that isn't the case, it's alright. But, we'll need to get that numerical value from the end of the current Property 785 | 'because we will need it later to determine which numerical value is needed for the end of our PropertyName. 786 | 'The below line is simply looking at the last character of the current Property's Name, which should be a number, and making sure that it IS a number 787 | If IsNumeric(Strings.Right(customIPropSet.Item(propItemCounter).Name, Len(customIPropSet.Item(propItemCounter).Name) - Len(TriggerPropName))) = True Then 788 | 789 | 'If it is a number, then we need to convert that value (because it's still a String), into an Integer, and set CurrentEnd to equal it. 790 | CurrentEnd = Convert.ToInt16(Strings.Right(customIPropSet.Item(propItemCounter).Name, Len(customIPropSet.Item(propItemCounter).Name) - Len(TriggerPropName))) 791 | 792 | 'We'll also go on and grab the Property ID of the open Property 793 | CurrentID = customIPropSet.Item(propItemCounter).PropId 794 | 795 | 'If the CurrentEnd is larger than our EndHolder (which was defined at the beginning of this sub), Then we need our EndHolder to 796 | 'equal 1 more than what is currently in use. Remember that we can't end up with two 'AfterDocSave0' entries. 797 | If CurrentEnd > EndHolder Then 798 | EndHolder = CurrentEnd + 1 799 | ElseIf CurrentEnd = EndHolder Then 800 | 801 | 'However, if CurrentEnd is = to EndHolder, then we'll just add 1 to it. 802 | EndHolder = EndHolder + 1 803 | End If 804 | 805 | 'We do the same thing for the Property ID. 806 | If CurrentID > TriggerID Then 807 | TriggerID = CurrentID + 1 808 | ElseIf CurrentID = TriggerID Then 809 | TriggerID = TriggerID + 1 810 | End If 811 | Else 812 | 813 | 'If for some reason that last character in the Property Name isn't a numeric value, then we have more work to do... 814 | MessageBox.Show("The end string for Var: CurrentEnd, was not a Numeric Value. If you're reading this, something needs debugging!", "Error in SetEventProperty Sub") 815 | Exit Sub 816 | End If 817 | Else 818 | 819 | CurrentEnd = (customIPropSet.Item(propItemCounter).PropId - BaseID) 820 | CurrentID = customIPropSet.Item(propItemCounter).PropId 821 | 822 | If CurrentEnd > EndHolder Then 823 | EndHolder = CurrentEnd + 1 824 | ElseIf CurrentEnd = EndHolder Then 825 | EndHolder = EndHolder + 1 826 | End If 827 | 828 | If CurrentID > TriggerID Then 829 | TriggerID = CurrentID + 1 830 | ElseIf CurrentID = TriggerID Then 831 | TriggerID = TriggerID + 1 832 | End If 833 | 834 | End If 835 | End If 836 | End If 837 | 'Now we do this all over again for every other item/property (if there are any) in the list 838 | 'each time checking to see if the Trigger already exists, or incrementing the values of the numeric ending for the PropertyName 839 | 'and PropertyID. 840 | Next 841 | End If 842 | 843 | 'Now that we're done gathering all of the data on the existing Properties / Items, let's add our own to the list. 844 | 'We call up our CustomIPropSet.Add. 845 | 'RuleName will be the name of the rule we made earlier. 846 | 'TriggerPropName & EndHolder equals the BaseID + the numeric value needed to show when it will fire. 847 | 'TriggerID is the new PropertyID that is next in line for use by Inventor. 848 | Call customIPropSet.Add(RuleName, TriggerPropName & EndHolder, TriggerID) 849 | 850 | 'Let's end this sub! 851 | 'Now we go all the way back to the sub Button1_Click 852 | 'Whew! 853 | End Sub 854 | 855 | Private Sub Code_Injector_Resize(sender As System.Object, e As System.EventArgs) Handles MyBase.Resize 856 | Dim winSize As New System.Drawing.Size(Me.Size.Width, Me.Size.Height) 857 | Dim stripPadding As New System.Windows.Forms.Padding(winSize.Width - 440, 3, 0, 2) 858 | ToolStripStatusLabel1.Margin = stripPadding 859 | End Sub 860 | 861 | Private Sub Code_Injector_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 862 | 863 | Dim vInfo As String 864 | vInfo = System.Reflection.Assembly.GetExecutingAssembly.GetName.Version.ToString 865 | 866 | ToolStripStatusLabel1.Text = "Current Version : " & vInfo 867 | 868 | End Sub 869 | 870 | 871 | 872 | Private Sub RunRulesOnCreation_CheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunRulesOnCreation_CheckBox.CheckedChanged 873 | 874 | If RunRulesOnCreation_CheckBox.Checked = True Then 875 | DeleteAfterRun_RadioButton.Enabled = True 876 | KeepAfterRun_RadioButton.Enabled = True 877 | KeepAfterRun_RadioButton.Checked = True 878 | DeleteAfterRun_RadioButton.Checked = False 879 | Else 880 | DeleteAfterRun_RadioButton.Enabled = False 881 | KeepAfterRun_RadioButton.Enabled = False 882 | End If 883 | 884 | End Sub 885 | 886 | Private Function getFiletypes(ByVal path As String, ByVal args() As String) As Stack 887 | Dim _files As New Stack 888 | 'Dim folder As New DirectoryInfo(path) 889 | For Each arg In args 890 | For Each _file In System.IO.Directory.GetFiles(path, arg, IO.SearchOption.AllDirectories) 891 | _files.Push(_file) 892 | Next 893 | Next 894 | Return _files 895 | End Function 896 | 897 | 898 | Private Sub SelectfromInventorFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectfromInventorFileButton.Click 899 | 900 | Try 901 | RuleSelectorForm.Show() 902 | 903 | Dim iLogicObject As Object 904 | 'Check to make sure that the iLogic addin for Inventor is currently running 905 | iLogicObject = GetiLogicAddin(openInventorApp) 906 | 907 | 'If it couldn't be found then... 908 | If (iLogicObject Is Nothing) Then 909 | MessageBox.Show("Could not find ilogic automation plugin! Unable to complete actions!", "Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Error) 910 | Exit Sub 911 | End If 912 | ' MessageBox.Show("Inventor has been started in the background") 913 | Catch ex As Exception 914 | End Try 915 | End Sub 916 | 917 | 918 | Private Sub DeleteRulesButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteRulesButton.Click 919 | 920 | openInventorApp.SilentOperation = True 921 | Dim iLogicObject As Object 922 | 923 | 'Check to make sure that the iLogic addin for Inventor is currently running and well. 924 | iLogicObject = GetiLogicAddin(openInventorApp) 925 | 926 | 'If it couldn't be found then... 927 | If (iLogicObject Is Nothing) Then 928 | MessageBox.Show("Could not find ilogic automation plugin! Unable to complete actions!", "Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Error) 929 | Exit Sub 930 | End If 931 | 932 | 'If the plugin was found, then we'll continue - 933 | 934 | 'We'll start by making initializing a new Integer called listCount 935 | Dim listCount As Integer 936 | 937 | 'We'll also tell our progress bar to only be as long, as there are items to count. 938 | ToolStripProgressBar1.Maximum = ListBox1.Items.Count 939 | 940 | 'In addition we can also set up just how much each step in our progress bar will take us. 941 | ToolStripProgressBar1.Step = 1 942 | 943 | 'We'll make a loop that counts down from the number items in our file queue list 944 | 'one by one. 945 | For listCount = ListBox1.Items.Count To 1 Step -1 946 | 947 | 'Create and empty Document called singleDoc 948 | Dim singleDoc As Document 949 | 950 | 'Sets singleDoc to the item that is currently being looked at, from our file queue. 951 | 'This also opens the document in Inventor for editing. 952 | singleDoc = openInventorApp.Documents.Open(ListBox1.Items(listCount - 1), True) 953 | 954 | 'Let's make sure we're allowed to modify this document. 955 | 'If the file is 'Read Only' then it will be skipped! 956 | If singleDoc.IsModifiable = True Then 957 | 958 | 'If we can modify it, then we'll continue. 959 | iLogicObject.DeleteAllRulesInDocument(singleDoc) 960 | 961 | 'Dim saveEnabled As Boolean = iLogicObject.RulesOnEventsEnabled 962 | 'iLogicObject.RulesOnEventsEnabled = False 963 | Try 964 | 'Save the document and all dependant documents. 965 | Call singleDoc.Save2(True) 966 | 967 | 'Just incase the file you're attempting to save to, can't be saved to... 968 | 969 | Catch ex As Exception 970 | 971 | MessageBox.Show("The directory / file you are attempting to save to is Read-Only." & vbCrLf & _ 972 | "Please make sure that you have permission to write to this directory / file before attempting to continue.", _ 973 | "Read-Write Error", MessageBoxButtons.OK, MessageBoxIcon.Error) 974 | Exit Sub 975 | 976 | Finally 977 | 978 | End Try 979 | 980 | 'Closes the document without any hassle. 981 | Call openInventorApp.ActiveDocument.Close(True) 982 | Else 983 | 'This area is blank. 984 | 'If you want something to happen when you find that a document can not be modified, then you would put it here. 985 | 'Otherwise, you can leave this area blank. 986 | End If 987 | 988 | 'Last but not least, let's show that we've completed work on the file, by increasing our progress bar by one step 989 | ToolStripProgressBar1.PerformStep() 990 | 'On to the next file. 991 | Next 992 | 993 | openInventorApp.SilentOperation = False 994 | openInventorApp.Visible = False 995 | 'Once everything is done, and all the files have been modified, we'll inform the user. 996 | MessageBox.Show("Operation Complete!", "Status : Finished") 997 | 998 | 'We'll also reset the progress bar back to 0 999 | ToolStripProgressBar1.Value = 0 1000 | 1001 | End Sub 1002 | End Class 1003 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/InventorProcess.vb: -------------------------------------------------------------------------------- 1 |  2 | Imports System.IO 3 | 4 | Public Class InventorProcess 5 | 6 | Private inventorApp As Inventor.Application 7 | Public m_quitInventor As Boolean = False 8 | 9 | Public Sub StartInventor() 10 | Try 11 | ' Try to get an active instance of Inventor 12 | Try 13 | Debug.Print("StartInventor - Trying to find Inventor application") 14 | inventorApp = TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application"), Inventor.Application) 15 | 'inventorApp = DirectCast(Interaction.GetObject(Nothing, "Inventor.Application"), Inventor.Application) 16 | Debug.Print(" - Found it") 17 | Catch ex As Exception 18 | ' System.Windows.Forms.MessageBox.Show("There was a problem getting an Inventor object.", "Error", MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error) 19 | End Try 20 | 21 | ' If not active, create a new Inventor session 22 | If inventorApp Is Nothing Then 23 | LaunchInventor() 24 | End If 25 | 26 | 'If (inventorApp IsNot Nothing) Then 27 | 'MessageBox.Show(inventorApp.SoftwareVersion.DisplayName, "Inventor Version") 28 | 'End If 29 | Catch ex As Exception 30 | System.Windows.Forms.MessageBox.Show("There was a problem starting Inventor.", "Error", MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error) 31 | End Try 32 | End Sub 33 | 34 | Public Sub StopInventor() 35 | Debug.Print("StopInventor") 36 | If m_quitInventor = True Then 37 | Debug.Print(" - Quitting Inventor") 38 | inventorApp.Quit() 39 | ' WaitForInventorToDie() 40 | End If 41 | 42 | inventorApp = Nothing 43 | End Sub 44 | 45 | Friend ReadOnly Property Application() As Inventor.Application 46 | Get 47 | Return inventorApp 48 | End Get 49 | End Property 50 | 51 | ''' 52 | ''' This tries to set the active Inventor project to the specified project file (full path name). 53 | ''' 54 | ''' 55 | Sub SetInventorProject(ByVal ipjFileName As String) 56 | Dim currentProjectFile As String = inventorApp.FileLocations.FileLocationsFile 57 | Debug.Print("Current active project file is: " & currentProjectFile) 58 | 59 | Dim ipjFilePath As New FileInfo(ipjFileName) 60 | 61 | If (String.Equals(currentProjectFile, ipjFilePath.FullName, StringComparison.OrdinalIgnoreCase)) Then 62 | Return 63 | End If 64 | 65 | Debug.Print("Checking for project file: " & ipjFilePath.FullName) 66 | If ipjFilePath.Exists Then 67 | Try 68 | inventorApp.FileLocations.FileLocationsFile = ipjFilePath.FullName 69 | Debug.Print("Set active project file to: " & inventorApp.FileLocations.FileLocationsFile) 70 | Catch ex As Exception 71 | Debug.Print("*** Failed to set active project file: " & ex.ToString) 72 | End Try 73 | End If 74 | 75 | End Sub 76 | 77 | 78 | Sub LaunchInventor() 79 | 80 | Debug.Print("InventorInfo - Launching Inventor...") 81 | Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application") 82 | inventorApp = System.Activator.CreateInstance(inventorAppType) 83 | 'm_inventorAppEvents = inventorApp.ApplicationEvents 84 | 85 | WaitForInventorToBeReady() 86 | 87 | inventorApp.Visible = True 88 | m_quitInventor = True 89 | 90 | End Sub 91 | 92 | Sub WaitForInventorToBeReady() 93 | Dim inventorReady As Boolean = False 94 | While Not inventorReady 95 | System.Threading.Thread.Sleep(100) 96 | System.Windows.Forms.Application.DoEvents() 97 | If inventorApp.Ready Then inventorReady = True 98 | End While 99 | Debug.Print("InventorInfo - Inventor Ready") 100 | End Sub 101 | 102 | Sub WaitForInventorToDie() 103 | ' Wait for Inventor to be gone 104 | Do While Not inventorApp Is Nothing 105 | Try 106 | inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") 107 | System.Threading.Thread.Sleep(100) 108 | Catch ex As Exception 109 | Debug.Print(" - Inventor is dead") 110 | inventorApp = Nothing 111 | End Try 112 | Loop 113 | End Sub 114 | 115 | 116 | End Class 117 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.239 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes, 18 | ' or if you encounter build errors in this file, go to the Project Designer 19 | ' (go to Project Properties or double-click the My Project node in 20 | ' Solution Explorer), and make changes on the Application tab. 21 | ' 22 | Partial Friend Class MyApplication 23 | 24 | _ 25 | Public Sub New() 26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) 27 | Me.IsSingleInstance = true 28 | Me.EnableVisualStyles = true 29 | Me.SaveMySettingsOnExit = true 30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses 31 | End Sub 32 | 33 | _ 34 | Protected Overrides Sub OnCreateMainForm() 35 | Me.MainForm = Global.Code_Injector.Code_Injector 36 | End Sub 37 | End Class 38 | End Namespace 39 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | true 4 | Code_Injector 5 | true 6 | 0 7 | true 8 | 0 9 | true 10 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Resources.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.239 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | Imports System 15 | 16 | Namespace My.Resources 17 | 18 | 'This class was auto-generated by the StronglyTypedResourceBuilder 19 | 'class via a tool like ResGen or Visual Studio. 20 | 'To add or remove a member, edit your .ResX file then rerun ResGen 21 | 'with the /str option, or rebuild your VS project. 22 | ''' 23 | ''' A strongly-typed resource class, for looking up localized strings, etc. 24 | ''' 25 | _ 29 | Friend Module Resources 30 | 31 | Private resourceMan As Global.System.Resources.ResourceManager 32 | 33 | Private resourceCulture As Global.System.Globalization.CultureInfo 34 | 35 | ''' 36 | ''' Returns the cached ResourceManager instance used by this class. 37 | ''' 38 | _ 39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager 40 | Get 41 | If Object.ReferenceEquals(resourceMan, Nothing) Then 42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Code_Injector.Resources", GetType(Resources).Assembly) 43 | resourceMan = temp 44 | End If 45 | Return resourceMan 46 | End Get 47 | End Property 48 | 49 | ''' 50 | ''' Overrides the current thread's CurrentUICulture property for all 51 | ''' resource lookups using this strongly typed resource class. 52 | ''' 53 | _ 54 | Friend Property Culture() As Global.System.Globalization.CultureInfo 55 | Get 56 | Return resourceCulture 57 | End Get 58 | Set 59 | resourceCulture = value 60 | End Set 61 | End Property 62 | End Module 63 | End Namespace 64 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Settings.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.239 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | 15 | Namespace My 16 | 17 | _ 20 | Partial Friend NotInheritable Class MySettings 21 | Inherits Global.System.Configuration.ApplicationSettingsBase 22 | 23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) 24 | 25 | #Region "My.Settings Auto-Save Functionality" 26 | #If _MyType = "WindowsForms" Then 27 | Private Shared addedHandler As Boolean 28 | 29 | Private Shared addedHandlerLockObject As New Object 30 | 31 | _ 32 | Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) 33 | If My.Application.SaveMySettingsOnExit Then 34 | My.Settings.Save() 35 | End If 36 | End Sub 37 | #End If 38 | #End Region 39 | 40 | Public Shared ReadOnly Property [Default]() As MySettings 41 | Get 42 | 43 | #If _MyType = "WindowsForms" Then 44 | If Not addedHandler Then 45 | SyncLock addedHandlerLockObject 46 | If Not addedHandler Then 47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings 48 | addedHandler = True 49 | End If 50 | End SyncLock 51 | End If 52 | #End If 53 | Return defaultInstance 54 | End Get 55 | End Property 56 | End Class 57 | End Namespace 58 | 59 | Namespace My 60 | 61 | _ 64 | Friend Module MySettingsProperty 65 | 66 | _ 67 | Friend ReadOnly Property Settings() As Global.Code_Injector.My.MySettings 68 | Get 69 | Return Global.Code_Injector.My.MySettings.Default 70 | End Get 71 | End Property 72 | End Module 73 | End Namespace 74 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/My Project/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/RuleFromFileForm.Designer.vb: -------------------------------------------------------------------------------- 1 |  _ 2 | Partial Class RuleSelectorForm 3 | Inherits System.Windows.Forms.Form 4 | 5 | 'Form overrides dispose to clean up the component list. 6 | _ 7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean) 8 | Try 9 | If disposing AndAlso components IsNot Nothing Then 10 | components.Dispose() 11 | End If 12 | Finally 13 | MyBase.Dispose(disposing) 14 | End Try 15 | End Sub 16 | 17 | 'Required by the Windows Form Designer 18 | Private components As System.ComponentModel.IContainer 19 | 20 | 'NOTE: The following procedure is required by the Windows Form Designer 21 | 'It can be modified using the Windows Form Designer. 22 | 'Do not modify it using the code editor. 23 | _ 24 | Private Sub InitializeComponent() 25 | Me.Label1 = New System.Windows.Forms.Label() 26 | Me.RulefromFileButton = New System.Windows.Forms.Button() 27 | Me.CancelRuleButton = New System.Windows.Forms.Button() 28 | Me.ListBox1 = New System.Windows.Forms.ListBox() 29 | Me.Label2 = New System.Windows.Forms.Label() 30 | Me.OpenRuleFromFileDialog = New System.Windows.Forms.OpenFileDialog() 31 | Me.BrowseSingleFileButton = New System.Windows.Forms.Button() 32 | Me.SingleFileTextBox = New System.Windows.Forms.TextBox() 33 | Me.SuspendLayout() 34 | ' 35 | 'Label1 36 | ' 37 | Me.Label1.AutoSize = True 38 | Me.Label1.Location = New System.Drawing.Point(29, 78) 39 | Me.Label1.Name = "Label1" 40 | Me.Label1.Size = New System.Drawing.Size(66, 13) 41 | Me.Label1.TabIndex = 0 42 | Me.Label1.Text = "Select a rule" 43 | ' 44 | 'RulefromFileButton 45 | ' 46 | Me.RulefromFileButton.Location = New System.Drawing.Point(32, 284) 47 | Me.RulefromFileButton.Name = "RulefromFileButton" 48 | Me.RulefromFileButton.Size = New System.Drawing.Size(75, 23) 49 | Me.RulefromFileButton.TabIndex = 1 50 | Me.RulefromFileButton.Text = "Apply" 51 | Me.RulefromFileButton.UseVisualStyleBackColor = True 52 | ' 53 | 'CancelRuleButton 54 | ' 55 | Me.CancelRuleButton.Location = New System.Drawing.Point(170, 284) 56 | Me.CancelRuleButton.Name = "CancelRuleButton" 57 | Me.CancelRuleButton.Size = New System.Drawing.Size(75, 23) 58 | Me.CancelRuleButton.TabIndex = 2 59 | Me.CancelRuleButton.Text = "Continue" 60 | Me.CancelRuleButton.UseVisualStyleBackColor = True 61 | ' 62 | 'ListBox1 63 | ' 64 | Me.ListBox1.FormattingEnabled = True 65 | Me.ListBox1.Location = New System.Drawing.Point(32, 107) 66 | Me.ListBox1.Name = "ListBox1" 67 | Me.ListBox1.Size = New System.Drawing.Size(213, 160) 68 | Me.ListBox1.TabIndex = 3 69 | ' 70 | 'Label2 71 | ' 72 | Me.Label2.AutoSize = True 73 | Me.Label2.Location = New System.Drawing.Point(32, 23) 74 | Me.Label2.Name = "Label2" 75 | Me.Label2.Size = New System.Drawing.Size(134, 13) 76 | Me.Label2.TabIndex = 4 77 | Me.Label2.Text = "Select a single Inventor file" 78 | ' 79 | 'OpenRuleFromFileDialog 80 | ' 81 | Me.OpenRuleFromFileDialog.FileName = "OpenFileDialog" 82 | ' 83 | 'BrowseSingleFileButton 84 | ' 85 | Me.BrowseSingleFileButton.Location = New System.Drawing.Point(212, 40) 86 | Me.BrowseSingleFileButton.Name = "BrowseSingleFileButton" 87 | Me.BrowseSingleFileButton.Size = New System.Drawing.Size(60, 20) 88 | Me.BrowseSingleFileButton.TabIndex = 5 89 | Me.BrowseSingleFileButton.Text = "Browse..." 90 | Me.BrowseSingleFileButton.UseVisualStyleBackColor = True 91 | ' 92 | 'SingleFileTextBox 93 | ' 94 | Me.SingleFileTextBox.Location = New System.Drawing.Point(35, 40) 95 | Me.SingleFileTextBox.Name = "SingleFileTextBox" 96 | Me.SingleFileTextBox.Size = New System.Drawing.Size(171, 20) 97 | Me.SingleFileTextBox.TabIndex = 6 98 | ' 99 | 'RuleSelectorForm 100 | ' 101 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 102 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font 103 | Me.ClientSize = New System.Drawing.Size(284, 333) 104 | Me.Controls.Add(Me.SingleFileTextBox) 105 | Me.Controls.Add(Me.BrowseSingleFileButton) 106 | Me.Controls.Add(Me.Label2) 107 | Me.Controls.Add(Me.ListBox1) 108 | Me.Controls.Add(Me.CancelRuleButton) 109 | Me.Controls.Add(Me.RulefromFileButton) 110 | Me.Controls.Add(Me.Label1) 111 | Me.Name = "RuleSelectorForm" 112 | Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show 113 | Me.Text = "Use existing rule from file" 114 | Me.ResumeLayout(False) 115 | Me.PerformLayout() 116 | 117 | End Sub 118 | Friend WithEvents Label1 As System.Windows.Forms.Label 119 | Friend WithEvents RulefromFileButton As System.Windows.Forms.Button 120 | Friend WithEvents CancelRuleButton As System.Windows.Forms.Button 121 | Friend WithEvents ListBox1 As System.Windows.Forms.ListBox 122 | Friend WithEvents Label2 As System.Windows.Forms.Label 123 | Friend WithEvents OpenRuleFromFileDialog As System.Windows.Forms.OpenFileDialog 124 | Friend WithEvents BrowseSingleFileButton As System.Windows.Forms.Button 125 | Friend WithEvents SingleFileTextBox As System.Windows.Forms.TextBox 126 | End Class 127 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/RuleFromFileForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/RuleFromFileForm.vb: -------------------------------------------------------------------------------- 1 |  2 | Imports Inventor 3 | Imports Autodesk.iLogic.Automation 4 | Imports Autodesk.iLogic.Interfaces 5 | Public Class RuleSelectorForm 6 | Dim iLogicObject As Object 7 | Dim activedoc As Inventor.Document = Nothing 8 | 9 | Private Sub BrowseSingleFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BrowseSingleFileButton.Click 10 | 'Check to make sure that the iLogic addin for Inventor is currently running 11 | iLogicObject = GetiLogicAddin(Code_Injector.openInventorApp) 12 | 13 | With (OpenRuleFromFileDialog) 14 | .Title = "Specify Inventor file containing a rule" 15 | .Filter = "Inventor Part files (*.ipt)|*.ipt|Inventor Assembly files (*.iam)|*.iam|Inventor Drawing files (*.idw)|*.idw|Other drawing files (*.dwg)|*.dwg|All files|*.*" 16 | .FilterIndex = 0 17 | .Multiselect = False 18 | .FileName = "" 19 | End With 20 | 21 | Try 22 | OpenRuleFromFileDialog.ShowDialog() 23 | SingleFileTextBox.Text = OpenRuleFromFileDialog.FileName 24 | SingleFileTextBox.Select(SingleFileTextBox.Text.Length, 0) 25 | 26 | activedoc = Code_Injector.openInventorApp.Documents.Open(SingleFileTextBox.Text) 27 | ListBox1.Items.Clear() 28 | 29 | Me.RulefromFileButton.Enabled = False 30 | DisplayExistingRules(activedoc, iLogicObject) 31 | 32 | Catch 33 | End Try 34 | End Sub 35 | 36 | Private Sub DisplayExistingRules(ByVal activeDoc As Inventor.Document, ByVal iLogicAuto As Object) 37 | Dim rules As IEnumerable 38 | Try 39 | Dim rule As Object 40 | rules = iLogicAuto.Rules(activeDoc) 41 | If (rules Is Nothing) Then Return 42 | For Each rule In rules 43 | ListBox1.Items.Add(rule.name) 44 | Next rule 45 | Catch 46 | End Try 47 | End Sub 48 | 49 | Function GetiLogicAddin(ByVal oApplication As Inventor.Application) As Object 50 | Dim addIns As ApplicationAddIns 51 | addIns = oApplication.ApplicationAddIns 52 | 53 | Dim addIn As ApplicationAddIn 54 | On Error GoTo NotFound 55 | addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}") 56 | 57 | If (addIn Is Nothing) Then 58 | Return Nothing 59 | Exit Function 60 | End If 61 | 62 | addIn.Activate() 63 | GetiLogicAddin = addIn.Automation 64 | Exit Function 65 | NotFound: 66 | End Function 67 | 68 | Private Sub RulefromFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RulefromFileButton.Click 69 | Dim rules As IEnumerable 70 | Dim rule As Object 71 | rules = iLogicObject.Rules(Code_Injector.openInventorApp.ActiveDocument) 72 | If (rules Is Nothing) Then Return 73 | For Each rule In rules 74 | If ListBox1.SelectedItem.ToString() = rule.name Then 75 | Code_Injector.Rule_Contents_TextBox.Text() = rule.Text 76 | Return 77 | End If 78 | Next rule 79 | End Sub 80 | 81 | Public Sub New() 82 | 83 | ' This call is required by the designer. 84 | InitializeComponent() 85 | 86 | ' Add any initialization after the InitializeComponent() call. 87 | Me.RulefromFileButton.Enabled = False 88 | Me.MaximumSize = Me.Size 89 | Me.MinimumSize = Me.Size 90 | End Sub 91 | 92 | Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged 93 | Me.RulefromFileButton.Enabled = True 94 | End Sub 95 | 96 | Private Sub CancelRuleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelRuleButton.Click 97 | Me.Hide() 98 | 99 | End Sub 100 | 101 | Private Sub RuleSelectorForm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed 102 | If Not activedoc Is Nothing Then activedoc.Close() 103 | End Sub 104 | End Class -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/net-transport.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/net-transport.ico -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code Injector.exe -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code Injector.pdb -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.vbproj.ResolveComReference.cache 2 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\bin\Release\Code Injector.exe 3 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\bin\Release\Code Injector.pdb 4 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\bin\Release\Code Injector.xml 5 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.vbprojResolveAssemblyReference.cache 6 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code_Injector.Code_Injector.resources 7 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code_Injector.RuleSelectorForm.resources 8 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code_Injector.Resources.resources 9 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.vbproj.GenerateResource.Cache 10 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.exe 11 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.xml 12 | C:\Users\Noah\Documents\GitHub\Code Injector\Code Injector\obj\x86\Release\Code Injector.pdb 13 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbproj.GenerateResource.Cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbproj.GenerateResource.Cache -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbproj.ResolveComReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbproj.ResolveComReference.cache -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbprojResolveAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code Injector.vbprojResolveAssemblyReference.cache -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code Injector.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CodeInjector 6 | 7 | 8 | 9 | 10 | 11 | This tries to set the active Inventor project to the specified project file (full path name). 12 | 13 | 14 | 15 | 16 | Returns the cached ResourceManager instance used by this class. 17 | 18 | 19 | 20 | Overrides the current thread's CurrentUICulture property for all 21 | resource lookups using this strongly typed resource class. 22 | 23 | 24 | 25 | A strongly-typed resource class, for looking up localized strings, etc. 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.Code_Injector.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.Code_Injector.resources -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.Resources.resources -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.RuleSelectorForm.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/Code_Injector.RuleSelectorForm.resources -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /Code Injector Project/Code Injector/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MegaJerk/iLogicCodeInjector/76971218286ff2a859fd02f8b67dc39547c034d4/Code Injector Project/Code Injector/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # The Real Very Final Update (10/22/2021) 2 | 3 | I received some notifications that a few users were posting on the original Autodesk forum thread in which I started this CodeInjetor project. It would seem that Autodesk has finally taken the time to create a more modern tool that does much of what this does, and more! You can find it on Autodesk's App Store [here](https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=7381718697722491251)! 4 | 5 | Unfortunately you will need a Subscription / License in order to download it, but Students / Educators can grab that for free. 6 | 7 | Though it certainly doesn't mean that this software is no longer needed (for earlier versions or for learning), it does mean that there will be less need for it going forward, which is fine. 8 | 9 | Thank you to everyone who has ever posted about how much this tool has helped them to work. I never would have thought that such a niche thing could be so readily used by an entire community, but I'm happy to see that it was helpful. 10 | 11 | ~~Until next time...~~ 12 | 13 | Keep Making! 14 | 15 | 16 | --- 17 | 18 | # Clarification Update! (11/2/2020) 19 | 20 | This project has long been mothballed by myself and serves only as a guide to anyone who is in search of some specific answers. That said, there are a few things that have changed in Inventor / Community knowledge that warrent me to update some of the information here. 21 | 22 | My previous table of the iProperty names and ID ranges is now out of date. Thanks to the work of Autodesk Community member WCrihfield (who created a new list of Property Names and ID Ranges alongside many other fixes and informative posts regarding Event Triggers), I am updating this Readme with their new values, which are as follows: 23 | 24 | |Name (Name Shown in Dialog)|Property Name (& DisplayName)|PropId Range|Doc Types Available In| 25 | |--- |--- |--- |--- | 26 | |After Open Document|AfterDocOpen|400 to 499|Assembly, Part, Drawing| 27 | |Close Document|DocClose|500 to 599|Assembly, Part, Drawing| 28 | |Before Save Document|BeforeDocSave|700 to 799|Assembly, Part, Drawing| 29 | |After Save Document|AfterDocSave|800 to 899|Assembly, Part, Drawing| 30 | |After Model Parameter Change|AfterAnyParamChange|1000 to 1099|Assembly, Part| 31 | |Part Geometry Change|PartBodyChanged|1200 to 1299|Part| 32 | |Material Change|AfterMaterialChange|1400 to 1499|Part| 33 | |iProperty Change|AfterAnyiPropertyChange|1600 to 1699|Assembly, Part, Drawing| 34 | |Drawing View Change|AfterDrawingViewsUpdate|1800 to 1899|Drawing| 35 | |Feature Suppression Change|AfterFeatureSuppressionChange|2000 to 2099|Part| 36 | |Component Suppression Change|AfterComponentSuppressionChange|2200 to 2299|Assembly| 37 | |iPart or iAssembly Change Component|AfterComponentReplace|2400 to 2499|Assembly| 38 | |New Document|AfterDocNew|2600 to 2699|Assembly, Part, Drawing| 39 | 40 | **Please remember that** 41 | 42 | 1. None of the comments in the code contained within this progam has been updated to reflect this new table of information! 43 | 2. Older versions of Inventor may actually use the old table of ID ranges! 44 | 45 | So. That's it! This is likely the last update unless Inventor updates something else and I have to make another update like this one! 46 | 47 | Until next time! 48 | 49 | (**PS**: Check out WCrihfield's awesome Autodesk Community Articles [here](https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles)) 50 | 51 | 52 | --- 53 | 54 | # iLogicCodeInjector - UPDATE! (12/10/2015) 55 | 56 | I have taken some time to fix a few problems that existed in previous versions of the Code Injector. 57 | This should now create iLogic Event Triggers correctly across new and old Inventor documents. 58 | 59 | Because the Autodesk - Being Inventive blog no longer seems to be updated, this repository will serve 60 | as the (new?) home to this project. 61 | 62 | Though I do plan on completely remaking / re-imagining the Code Injector in the future, this will be the 63 | **last update** that this particular iteration receives. 64 | 65 | As always, I have included all of the code files / Visual Studios solution for everyone who wants to 66 | learn the deeper mysteries of how iLogic Event Triggers are being created, or who just wants to 67 | laugh at my terrible 'Fisher Price - My First Software' code. 68 | 69 | ## *If you're just interested in the updated executable (.exe) [go here](../master/Code%20Injector%20Project/Code%20Injector/obj/x86/Release/Code%20Injector.exe), and then click on the 'View Raw' link in the center of the page. It should start the download.* 70 | 71 | 72 | ## List of Changes 73 | 74 | **1.** Fixed an error that would occur when the iProperty Set that contains Event Trigger information was formatted differently 75 | using the original (old) format, subsequently hiding itself from Inventor. 76 | 77 | **2.** Fixed the anchors on the applications main dialog box to prevent buttons from drifting into the text editing area. 78 | 79 | **3.** Corrected the value for iProperties controlling the On Drawing View event triggers. 80 | 81 | ### Special Thanks 82 | 83 | Special thanks to Bob Van der Donck and the crew (defunct or not) over at beinginventive.typepad.com. He made some wonderful contributions to this project after its initial debut, and was the person responsible for sparking the initial idea in the first place. 84 | 85 | Props! 86 | --------------------------------------------------------------------------------