Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Well the process of turning a very simple Inventor macro into a registry free addin has been a painfully slow and complicated process but I've finally got the Addin to load through an StandardAddInServer.vb file.
Now Im stuck at what I thought would be simple:
My OnExecute sub associated with my ribbon button is running and I can sucessfully test it with a Msgbox ("Hooray"), but I cannot simply now load my form (called FrmPointsHarvest) with FrmPointsHarvest.Show or anything like it.
My form is a seperate FrmPointsHarvest.vb file containing basic code and with a header like this :
Public Class FrmPointsHarvest Private InvApp As Inventor.Application Dim oDoc As Document Dim oPartDoc As PartDocument Dim oDef As PartComponentDefinition Dim oAssyDoc As AssemblyDocument Dim oAsmDef As AssemblyComponentDefinition Dim oLeafOccs As ComponentOccurrencesEnumerator Dim Part_Type As String Dim oExcelApplication As Excel.Application 'Create a new Excel instance Dim oBook As Excel.Workbook 'An excel workbook object Dim oSheet As Excel.Worksheet 'An Excel worksheet object Dim OutputFile As String 'name of Excel File Public debugAddIn As PointsHarvester.StandardAddInServer Public Sub New(InvApp As Inventor.Application) ' Этот вызов является обязательным для конструктора. InitializeComponent() Me.InvApp = InvApp Dim Doc As Inventor.Document = InvApp.ActiveDocument Select Case Doc.DocumentType Case Inventor.DocumentTypeEnum.kPartDocumentObject Dim PartDoc As Inventor.PartDocument = DirectCast(Doc, Inventor.PartDocument) Case Inventor.DocumentTypeEnum.kAssemblyDocumentObject Dim AssDoc As Inventor.AssemblyDocument = DirectCast(Doc, Inventor.AssemblyDocument) End Select End Sub Private Sub FrmPointsHarvest_Load(sender As Object, e As EventArgs) Handles MyBase.Load LblDetails.Text = "" ' Set a reference to the active document. This assumes a document is open. oDoc = InvApp.ActiveDocument '.activedocument 'if a part or assembly Select Case oDoc.DocumentType Case 12290 Part_Type = "IPT" oPartDoc = oDoc BtnHarvest.Enabled = True Case 12291 Part_Type = "IAM" oAssyDoc = oDoc BtnHarvest.Enabled = True Case Else Part_Type = "Other" BtnHarvest.Enabled = False MsgBox(oDoc.DocumentType & " is Open. You must open an Inventor Part (.IPT) or Assembly (.IAM) file.", vbOKOnly, "FORTIS 3D Point Harvester") Me.Close() End Select LblDetails.Text = oDoc.DisplayName & " (" & Part_Type & ")" & " is Open with " & oDoc.ReferencedDocuments.Count & " References" End Sub '....etc.etc
How on earth do I get this form to load?
Thanks
Solved! Go to Solution.