Message 1 of 6
Create parameters that exists
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all.
I have been looking for some time to get iLogic to create me some parameters, but only if the don't exists already. I had a version working with try-catch, but it fel ... wrong to use that method. All the searches i made came close, but didn't give me any cigarrs. I came up with this, maybe someone has a similar problem and can put it to some use.
I'm no programmer so any bad methods is mea culpa. It works through all my test trials, though and I'm happy with it so far. Any addition input is of course welcome.
Come to think of it - maybe should add a test for proper file type...
'Creates parameters from a list 'It works with most ordinary units 'set up variables Dim myArray As New ArrayList oMyParam = ThisDoc.Document.ComponentDefinition.Parameters Parameter.Quiet = True 'Parameters list, change the habitants, but keep the system. myArray.Add("p1") myArray.Add("10") myArray.Add("mm") myArray.Add("p2") myArray.Add("20") myArray.Add("deg") myArray.Add("p3") myArray.Add("30") myArray.Add("in") myArray.Add("p4") myArray.Add("40") myArray.Add("ul") myArray.Add("p5") myArray.Add("50") myArray.Add("kg") For j = 0 To myArray.Count - 1 Step 3 If Parameter.Value(myArray(j)) Is Nothing Then oMyParam.UserParameters.AddByExpression(myArray(j), myArray(j + 1), myArray(j + 2)) Parameter.Param(myArray(j)).ExposedAsProperty=True End If Next