Message 1 of 4
iLogic Replacing Components With Multiple Different Components In Patterns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I wrote the following program to replace a component in a greenhouse. It works fine when I make the greenhouse bigger. But when the greenhouse is made smaller it replaces the wrong component. Can someone please help with this?
My_Variable = ThisDoc.Document.ComponentDefinition.Occurrences.Item(12*(1+Number_of_Bays)+((Nominal_Length/12 ft)-5)*(1+Number_of_Bays)*2+1).Name Select Case Width Case 18 ft If Crosstie_Depth_10 = True Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_18ft_10(3x3)_Crosstie.iam", True) End If If Crosstie_Depth_10 = False Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_18ft_14(3x3)_Crosstie.iam", True) End If Case 21 ft If Crosstie_Depth_10 = True Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_21ft_10(3x3)_Crosstie.iam", True) End If If Crosstie_Depth_10 = False Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_21ft_14(3x3)_Crosstie.iam", True) End If Case 24 ft If Crosstie_Depth_10 = True Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_24ft_10(3x3)_Crosstie.iam", True) End If If Crosstie_Depth_10 = False Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_24ft_14(3x3)_Crosstie.iam", True) End If Case 27.5 ft If Crosstie_Depth_10 = True Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_27ft 6in_10(3x3)_Crosstie.iam", True) End If If Crosstie_Depth_10 = False Then Component.Replace(My_Variable, "Y:\Workshare\Inventor Standards\Gutter Connect\Crossties\ML3010_27ft 6in_14(3x3)_Crosstie.iam", True) End If End Select InventorVb.DocumentUpdate()