Hello all,
I need to create an iLogic assembly like a train track, each piece of the rail butted against the next up to a desired overall length of track. The desired length of each rail would be no longer than 129 inches, and used as may times as possible, and then at the end of the track the last rail would be whatever is needed in length, but no longer than the maximum length. I am not sure if this can be sketch driven or if it is better to use iparts, constraints and overall length to drive the assembly. The overall length of the track would never be greater than 635 inches. I want to use as many of the same length rails as any difference in rail length would caused the need to create a new part number for that length rail.
Regards, Scott
Hi Scott,
This is doable. I'd start with the assembly and write a rule to calculate the quantities and lengths of each piece of your track, including the minimum length in the calcs if that's a requirement.
I see two different methods you could do for insertion of the parts:
Sound fun? 🙂
Randy,
I am very new to iLogic and still getting the hang of the code and what I am having prolems with is digging down to the individual tack to change the lenght while in the assembly. I have been trying your first suggestion for some time, but when I change the lenght in the individual track through iLogic code it does not change in the assembly, even after hitting upate or adding the update code at end of program.
Thank you for your help,
Scott
'Database units are always cm so you may need to convert units to what you want to work with (as done in the line below)
oPatternOccurrenceNumber = Math.Floor( oDoc.UnitsOfMeasure.ConvertUnits(oDoc.ComponentDefinition.Parameters.Item("THICKNESS").Value, "cm", "mm") / 10) 'for 10 mm spacing
oPatternSpacing = 10 'mm
oDrivenDoc.ComponentDefinition.Parameters.Item("PatternOccurenceCount").Value = oPatternOccurrenceNumber
oDrivenDoc.ComponentDefinition.Parameters.Item("PatternSpacing").Value = oDrivenDoc.UnitsOfMeasure.ConvertUnits(oPatternSpacing, "mm", "cm")
USE BELOW HERE; ABOVE IS AN EXAMPLE OF CHANGING UNITS AND DOING MATH THINGS
Dim oDoc As Document = ThisApplication.Documents.Open("C:\Backing Plate.ipt", False) ' Change this as req'd
Dim oDrivenDoc As Document = ThisApplication.Documents.Open("C:\Driven Doc.ipt", False) ' Change this as req'd
oDrivenDocParams = oDrivenDoc.ComponentDefinition.Parameters.
oDocParams = oDoc.ComponentDefinition.Parameters.
'To access parameter values within oDriven doc, use (after declaring as above):
'oDrivenDocParams.Item("PARAMETER_NAME_HERE").Value =
'To access parameter values within oDoc, use:
'oDocParams.Item("PARAMETER_NAME_HERE").Value =