Imports System Imports System.Type Imports System.Activator Imports System.Runtime.InteropServices Imports Inventor Public Class frmEigenschaftenEintragen Private Sub btnEintragen_Click(sender As Object, e As EventArgs) Handles btnEintragen.Click Dim oDoc As Document, oDrawing As Object Dim oapp As Inventor.Application oapp = ThisApplication If oapp.ActiveDocument.DocumentType = kPartDocumentObject Then 'If ThisApplication.ActiveDocument.DocumentType = kPartDocumentObject Then oDoc = oapp.ActiveDocument ' Call DokumentBereinigen(oDoc) Else If oapp.ActiveDocument.ReferencedDocuments.Count = 1 Then For Each oObj In oapp.ActiveDocument.ReferencedDocuments If oObj.DocumentType = kPartDocumentObject Then oDoc = oObj ' Call DokumentBereinigen(oDoc) Else If oObj.DocumentType = kAssemblyDocumentObject Then oDoc = oObj ' Call DokumentBereinigen(oDoc) End If End If Next End If If oapp.ActiveDocument.DocumentType = kAssemblyDocumentObject Then oDoc = oapp.ActiveDocument ' Call DokumentBereinigen(oDoc) End If End If End If ' ********************************************** ' ** Parameter Ablesen und in Teil übertragen ** ' ********************************************** For Each oPropSet In oDoc.PropertySets For Each oProp In oPropSet If oProp.DisplayName = "Bezeichnung" Then oProp.value = frmEigenschaftenEintragen.txtBezeichnung_E.Text Else If oProp.DisplayName = "DESCRIPTION" Then oProp.value = frmEigenschaftenEintragen.txtDescription_E.Text Else If oProp.DisplayName = "Bestandsnummer" Then oProp.value = frmEigenschaftenEintragen.txtArtikelNr_E.Text Else If oProp.DisplayName = "ROHMATERIAL" Then oProp.value = frmEigenschaftenEintragen.txtRohMaterial_E.Text Else If oProp.DisplayName = "L1" Then oProp.value = frmEigenschaftenEintragen.txtL1_E.Text Else If oProp.DisplayName = "L2" Then oProp.value = frmEigenschaftenEintragen.txtL2_E.Text Else If oProp.DisplayName = "BESTELLANGABEN" Then oProp.value = frmEigenschaftenEintragen.txtBestellangaben_E.Text Else If oProp.DisplayName = "Material" Then If oDoc.DocumentType = kPartDocumentObject Then If frmEigenschaftenEintragen.cboMaterial_E.Text = "" Then frmEigenschaftenEintragen.cboMaterial_E.Text = "." End If oDoc.ComponentDefinition.Material.Name = frmEigenschaftenEintragen.cboMaterial_E.Text End If Else If oProp.DisplayName = "WERKSTOFF OBERFLÄCHE" Then oProp.value = frmEigenschaftenEintragen.txtWerkstoff_Oberflaeche_E.text Else If oProp.DisplayName = "Norm" Then oProp.value = frmEigenschaftenEintragen.txtNorm_E.Text Else If oProp.DisplayName = "Zulieferer" Then oProp.value = frmEigenschaftenEintragen.txtHersteller_E.Text Else If oProp.DisplayName = "Kommentare" Then oProp.value = frmEigenschaftenEintragen.txtKommentar_E.Text Else If oProp.DisplayName = "Erstellungsdatum" Then oProp.value = frmEigenschaftenEintragen.txtDatum_Gezeichnet_E.Text Else If oProp.DisplayName = "Konstrukteur" Then oProp.value = frmEigenschaftenEintragen.txtName_Gezeichnet_E Else If oProp.DisplayName = "Datum Überprüfung" Then If frmEigenschaftenEintragen.Datum_Geprueft_E.text <> "" Then oProp.value = frmEigenschaftenEintragen.Datum_Geprueft_E.text End If Else If oProp.DisplayName = "Kontrolliert von" Then oProp.value = frmEigenschaftenEintragen.cboName_Geprueft_E.Text Else If oProp.DisplayName = "Datum Fertigungsgenehmigung" Then If frmEigenschaftenEintragen.txtDatum_Freigegeben_E.Text <> "" Then oProp.value = frmEigenschaftenEintragen.Datum_Freigegeben_E.text End If Else If oProp.DisplayName = "Fertigung genehmigt von" Then oProp.value = frmEigenschaftenEintragen.txtName_Freigegeben_E.Text Else If oProp.DisplayName = "Revisionsnummer" Then oProp.value = frmEigenschaftenEintragen.txtRevision_E.text End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If End If Next Next oDoc.Update() ThisApplication.ActiveDocument.Update() End End Sub Private Sub txtBestellangaben_E_TextChanged(sender As Object, e As EventArgs) Handles txtBestellangaben_E.TextChanged If txtBestellangaben_E.Text <> "" Then txtL1_E.BackColor = Drawing.Color.Gray txtL2_E.BackColor = Drawing.Color.Gray txtRohMaterial_E.BackColor = Drawing.Color.Gray txtL1_E.Enabled = False txtL2_E.Enabled = False txtRohMaterial_E.Enabled = False Else txtL1_E.BackColor = Drawing.Color.White txtL2_E.BackColor = Drawing.Color.White txtRohMaterial_E.BackColor = Drawing.Color.White txtL1_E.Enabled = True txtL2_E.Enabled = True txtRohMaterial_E.Enabled = True End If End Sub Private Sub txtL1_E_TextChanged(sender As Object, e As EventArgs) Handles txtL1_E.TextChanged If txtL1_E.Text <> "" Or txtL2_E.Text <> "" Or txtRohMaterial_E.Text <> "" Then txtBestellangaben_E.BackColor = Drawing.Color.Gray txtBestellangaben_E.Enabled = False Else txtBestellangaben_E.BackColor = Drawing.Color.White txtBestellangaben_E.Enabled = True End If End Sub Private Sub txtL2_E_TextChanged(sender As Object, e As EventArgs) Handles txtL2_E.TextChanged If txtL1_E.Text <> "" Or txtL2_E.Text <> "" Or txtRohMaterial_E.Text <> "" Then txtBestellangaben_E.BackColor = Drawing.Color.Gray txtBestellangaben_E.Enabled = False Else txtBestellangaben_E.BackColor = Drawing.Color.White txtBestellangaben_E.Enabled = True End If End Sub Private Sub txtRohMaterial_E_TextChanged(sender As Object, e As EventArgs) Handles txtRohMaterial_E.TextChanged If txtL1_E.Text <> "" Or txtL2_E.Text <> "" Or txtRohMaterial_E.Text <> "" Then txtBestellangaben_E.BackColor = Drawing.Color.Gray txtBestellangaben_E.Enabled = False Else txtBestellangaben_E.BackColor = Drawing.Color.White txtBestellangaben_E.Enabled = True End If End Sub Private Sub frmEigenschaftenEintragen_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim oDoc As PropertySets oDoc = ThisApplication.ActiveDocument.PropertySets End Sub End Class