Vytisknout stránku | Zavřít okno

iLogic Dialog dll

Vytištěno z: CAD Fórum
Kategorie: Autodesk - stavebnictví, strojírenství, CAD/GIS
Název fóra: iLogic a ETO
Popis fóra: Funkce a makra iLogic, Inventor Engineering to Order (ETO), automatizace a konfigurace výrobků
URL: https://www.cadforum.cz/forum/forum_posts.asp?TID=31220
Datum vytištění: 30.kvě.2026 v 03:08


Téma: iLogic Dialog dll
Odeslal: PopelkaM
Předmět: iLogic Dialog dll
Datum odeslání: 03.lis.2020 v 06:48
Dobrý den,mám vytvořený dialog (*.dll ve Visual Studiu) propojený se součástí prostřednictvím
iLogicu v Inventoru.
Dialog slouží na editaci součásti.
Lze do dialogu doplnit i možnost vybrat materiál součásti (ComboBox),nebo některé iVlastnosti?
Poradíte mě jak?
Dialog vytvořený v iLogicu má omezené možnosti použití.

Děkuji PopelkaSmile



Odpovědi:
Odeslal: Navara
Datum odeslání: 04.lis.2020 v 00:27
Udělat se to dá. Smile
Ale je to spíš na konzultaci, než na jednoduchou odpověď. Ale jedno minimalistické řešení je zde:

AddReference "System.Drawing.dll"
Imports System.Windows.Forms


Sub Main

   Dim part As PartDocument = ThisDoc.Document
   Dim materialDlg As MaterialDialog = New MaterialDialog()
   materialDlg.Part = part
   materialDlg.ShowDialog()

End Sub

Public Class MaterialDialog
   Inherits Form

   Public Sub New()
      InitializeComponent()
   End Sub

   Property Part As PartDocument
      Get
         Return _part
      End Get
      Set
         _part = value
         PopulateMaterialCombo()
      End Set
   End Property

   Private Sub PopulateMaterialCombo()
      ComboBox1.Items.Clear()
      Dim app As Inventor.Application = Part.Parent
      For Each material As MaterialAsset In app.ActiveMaterialLibrary.MaterialAssets
         ComboBox1.Items.Add(material.DisplayName)
      Next
   End Sub

   Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
      Dim app As Inventor.Application = Part.Parent

      Dim material As MaterialAsset = app.ActiveMaterialLibrary.MaterialAssets(ComboBox1.SelectedItem.ToString())

      Part.ActiveMaterial = material
   End Sub
   
   Friend WithEvents ComboBox1 As ComboBox
   Private _part As PartDocument

   Private Sub InitializeComponent()
      Me.ComboBox1 = New System.Windows.Forms.ComboBox()
      Me.SuspendLayout()
      '
      'ComboBox1
      '
      Me.ComboBox1.FormattingEnabled = True
      Me.ComboBox1.Location = New System.Drawing.Point(12, 12)
      Me.ComboBox1.Name = "ComboBox1"
      Me.ComboBox1.Size = New System.Drawing.Size(121, 21)
      Me.ComboBox1.TabIndex = 0
      '
      'MaterialDialog
      '
      Me.ClientSize = New System.Drawing.Size(284, 261)
      Me.Controls.Add(Me.ComboBox1)
      Me.Name = "MaterialDialog"
      Me.ResumeLayout(False)

   End Sub

End Class




Odeslal: PopelkaM
Datum odeslání: 09.lis.2020 v 06:15
Dobrý den,
děkuji za tip...

Zkouším to takto níže ,ale vyskakuje tato hláška.
Poradíte mi co je špatně ?

Děkuji Popelka


...

Imports System.Windows.Forms
Imports Autodesk.iLogic.Interfaces

Public Class Dialog1
    Public SrazeniZavit As Double
    Public MPrumer As Double
    Public DelkaZavit As Double
    Public SRazeniValec As Double
    Public SPrumer As Double
    Public DelkaValce As Double
    Public ZaobleniUHlavy As Double
    Public iLogicVB As ILowLevelSupport
    Public iProperties As IiProperties



    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        SrazeniZavit = TextBox1.Text
        MPrumer = TextBox2.Text
        DelkaZavit = TextBox3.Text
        SRazeniValec = TextBox4.Text
        SPrumer = TextBox5.Text
        DelkaValce = TextBox6.Text
        ZaobleniUHlavy = TextBox7.Text
        iProperties.Material = ComboBox1.Text


        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub Dialog1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.Text = SrazeniZavit
        TextBox2.Text = MPrumer
        TextBox3.Text = DelkaZavit
        TextBox4.Text = SRazeniValec
        TextBox5.Text = SPrumer
        TextBox6.Text = DelkaValce
        TextBox7.Text = ZaobleniUHlavy
        ComboBox1.Text = iProperties.Material


        For Each material In iProperties.Materials
            ComboBox1.Items.Add(material)
        Next



    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged

        'iProperties.Value("Design Tracking Properties", "Material") = ComboBox1.Text
        iProperties.Material = ComboBox1.Text
        ILogicVB.DocumentUpdate()

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub
End Class

---------------------------------------------------------------------------------

AddReference "iLogic Osazeny Šroub Dialog.dll"


localTrigger = iTrigger0
 Using dlg As New iLogic_Osazeny_Šroub_Dialog.Dialog1
  dlg.SrazeniZavit = SrazeniZavit
  dlg.MPrumer = MPrumer
  dlg.DelkaZavit = DelkaZavit
  dlg.SRazeniValec = SRazeniValec
  dlg.SPrumer = SPrumer
  dlg.DelkaValce = DelkaValce
  dlg.ZaobleniUHlavy = ZaobleniUHlavy
  dlg.iProperties = iProperties
  Dim i As Integer = dlg.ShowDialog()
  If i <> vbOK Then Return
  SrazeniZavit =  dlg.SrazeniZavit
  MPrumer =  dlg.MPrumer
  DelkaZavit =  dlg.DelkaZavit
  SRazeniValec =  dlg.SRazeniValec
  SPrumer =  dlg.SPrumer
  DelkaValce =  dlg.DelkaValce
  ZaobleniUHlavy = dlg.ZaobleniUHlavy
  End Using
 iLogicVb.UpdateWhenDone = True




Odeslal: Navara
Datum odeslání: 09.lis.2020 v 09:23
Těžko říct. Ten kód pro Dialog1 je sice nekompletní, ale to nemusí být příčina, zbytek může být v jiném souboru.
Bez toho, abych si to pustil nedokážu poradit. Takhle na první pohled to vypadá v pořádku.



Odeslal: PopelkaM
Datum odeslání: 09.lis.2020 v 10:47
Dobrý den,
v Dialog1 je pouze ten kód.
V součásti je v pravidle iLogic reference na dll soubor a automaticky vygenerovaný kód.
Říkáte,že kód pro Dialog1 je nekompletní - možná je to ta příčina.....

Popelka





Vytisknout stránku | Zavřít okno