Message 1 of 18
Ilogic two condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having an issue with my iLogic code. In assembly could exist two subassemblies. One or the other. In ilogic I'am trying to choose between this two. If one exist it should change to other, and also change dimensions of some parts that are included in the subassembly. But when I'm trying to switch in the created form one subassembly to another Inventor give me message saying there are no components with this name. Any help will be appreciate 🙂
Dim oDoc As AssemblyDocument = ThisDoc.Document Dim oComps As ComponentOccurrences = oDoc.ComponentDefinition.Occurrences Dim AssemblyExists As Boolean = True For Each oComp As ComponentOccurrence In oComps If oComp.Name.Contains("ZRĘBNICA PROSTA SPAW.iam") Then AssemblyExists = True Exit For End If Next If Typ_zrębnicy = "PROSTA" And AssemblyExist = True Then Zrębnica = False Parameter("Czolo zrębnicy:1", "Grubość") = Zrębnica_grubość Parameter("Bok zrębnicy:1", "Grubość") = Zrębnica_grubość Parameter("Czolo zrębnicy:1", "d2") = Zrębnica_szerokość - 2 * Zrębnica_grubość Parameter("Bok zrębnicy:1", "d0") = Zrębnica_długość Parameter("Czolo zrębnicy:1", "d4") = Zrębnica_wysokość Parameter("Czolo zrębnicy:1", "Średnica") = Średnica_Dnom Else If Typ_zrębnicy = "PROSTA" And AssemblyExist = False Then Zrębnica = False Component.Replace("ZRĘBNICA PODCIETA SPAW:1", "ZRĘBNICA PROSTA SPAW.iam", True) Parameter("Czolo zrębnicy:1", "Grubość") = Zrębnica_grubość Parameter("Bok zrębnicy:1", "Grubość") = Zrębnica_grubość Parameter("Czolo zrębnicy:1", "d2") = Zrębnica_szerokość - 2 * Zrębnica_grubość Parameter("Bok zrębnicy:1", "d0") = Zrębnica_długość Parameter("Czolo zrębnicy:1", "d4") = Zrębnica_wysokość Parameter("Czolo zrębnicy:1", "Średnica") = Średnica_Dnom Else If Typ_zrębnicy = "GIĘTA" And AssemblyExist = True Then Zrębnica = True Component.Replace("ZRĘBNICA PROSTA SPAW:1", "ZRĘBNICA PODCIETA SPAW.iam", True) Parameter("Czolo zrębnicy podcięte:1", "Grubość") = Zrębnica_grubość Parameter("Bok zrębnicy zagięty:1", "Grubość") = Zrębnica_grubość Parameter("Czolo zrębnicy podcięte:1", "d2") = Zrębnica_szerokość - 2 * Zrębnica_grubość Parameter("Bok zrębnicy zagięty:1", "d8") = Zrębnica_długość Parameter("Czolo zrębnicy podcięte:1", "d4") = Zrębnica_wysokość Parameter("Czolo zrębnicy podcięte:1", "Średnica") = Średnica_Dnom Parameter("Czolo zrębnicy podcięte:1", "Dlugość_prostej") = Zrębnica_prosta Parameter("Czolo zrębnicy podcięte:1", "Rozstaw_dół") = Zrębnica_rozstaw Else If Typ_zrębnicy = "GIĘTA" And AssemblyExist = False Then Zrębnica = True Parameter("Czolo zrębnicy podcięte:1", "Grubość") = Zrębnica_grubość Parameter("Bok zrębnicy zagięty:1", "Grubość") = Zrębnica_grubość Parameter("Czolo zrębnicy podcięte:1", "d2") = Zrębnica_szerokość - 2 * Zrębnica_grubość Parameter("Bok zrębnicy zagięty:1", "d8") = Zrębnica_długość Parameter("Czolo zrębnicy podcięte:1", "d4") = Zrębnica_wysokość Parameter("Czolo zrębnicy podcięte:1", "Średnica") = Średnica_Dnom Parameter("Czolo zrębnicy podcięte:1", "Dlugość_prostej") = Zrębnica_prosta Parameter("Czolo zrębnicy podcięte:1", "Rozstaw_dół") = Zrębnica_rozstaw End If