I am looking at trying to make a .ipt for tape. I want to use a standard file for all assemblies. The problem is getting custom lengths into the assemblies that the part is used in. I do not want a virtual component I see a file working better in my case. I have a file made up with a "Length" in the parameters. My idea was to us ilogic to go thru a list of assemblies in a folder and ask if my IPT for tape should be included. Again the .ipt is just a place holder for the description and length and width. I have started with the following:
'Adds T_Length to Assembly file and defines with in custom Iproperties for BOM
'Starts the deletion of T_Length if it already exists in Assembly
'Name of user parameters to suppress "T_Length"
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim Length As String = "T_Length"
'suppress user parameters
Dim oDef as ComponentDefinition = oDoc.ComponentDefinition
Try
Dim oParL As UserParameter = oDef.Parameters.UserParameters.item(Length)
oParL.Delete
oDoc.update
Catch
'MessageBox.Show("User parameter don't exist", "iLogic rule")
'Return 'exit rule
End Try
'Prompted box for length of tape needed in assembly default is 1800 inches of 50 yards which is standard roll length.
myparam = InputBox("Enter it in Inches", "Length of tape needed", "1800")
oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
'Setting an userParameter in inchs as T_Lenght and using myparam as entry value
oParameter=oMyParameter.AddByExpression("T_Length", myparam, UnitsTypeEnum.kInchLengthUnits)
Parameter.Param(docFName, "T_Length") .ExposedAsProperty = True
'Pushes T_length to Length in 4 WIDE FSK TAPE x 150FT.ipt from Assembly file
Parameter("4 WIDE FSK TAPE x 150FT.ipt", "Length")=T_Length
'iProperties.Value("Custom", "T_Length") =T_length
My hope was that this would check for the value "T_Length" in the assembly if there delete it and prompt for a new value of "T_Length". T_Length then would be pushed to the .ipt of the tape part file and show in the BOM as the entered value. Updated 9/26/2016 figured out how to remove / delete the property "T_Length" so as not have repeated entry's. Adjusted code above. Woudl be nice to see if i could capture the entered length and reused if run again.
PS Had to remove image file in P&G to upload.