forked from Codered741/iLogic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUniversal Prop Add.iLogicVB
More file actions
89 lines (76 loc) · 2.56 KB
/
Universal Prop Add.iLogicVB
File metadata and controls
89 lines (76 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Sub Main()
SharedVariable("LogVar") = "Universal Prop Add"
iLogicVB.RunExternalRule("Write SV to Log.iLogicVB")
Dim UNVSTDProps As New List(of String)
Dim UNVStrParams As New List(of String)
UNVSTDProps.Add("NextAssy")
UNVSTDProps.Add("UsedOn")
UNVSTDProps.Add("Project Number")
UNVSTDProps.Add("Material")
UNVSTDProps.Add("Building Number")
PropAdd(UNVSTDProps)
'Parameter Setup
UNVStrParams.Add("ProjectNum")
ParamAdd(UNVStrParams, "TXT")
'MultiValue.SetList(UNVStrParams(0), "Collapsing Tower", "Mariner", "Jetski Launcher", "Masking Curtain", "Seaplane Launcher")
iProperties.Value("Project", "Vendor") = "TAIT"
End Sub
Public Sub PropAdd(Props as List(Of String))
'Init
Dim oDoc As Document = ThisApplication.ActiveDocument
customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")
For Each prop In Props
Try
iprop = customPropertySet.Item(prop)
Catch
' Assume error means not found
customPropertySet.Add("Custom", prop)
iProperties.Value("Custom", prop) = ""
End Try
Next
End Sub
Public Sub ParamAdd(Params As List(Of String), UnitType As String)
'Init
Dim oPartDoc As Document = ThisApplication.ActiveDocument
Dim oCompDef As ComponentDefinition = oPartDoc.ComponentDefinition
oMyParameter=oCompDef.Parameters.UserParameters
'Main
If UnitType = "BOOL" Then
For Each pmtr In Params
Try
param = Parameter.Param(pmtr)
Catch
oMyParameter=oCompDef.Parameters.UserParameters
oParameter=oMyParameter.AddByValue(pmtr, True, "BOOLEAN")
End Try
Next
Else If UnitType = "IN" Then
For Each pmtr In Params
Try
param = Parameter.Param(pmtr)
Catch
oMyParameter=oCompDef.Parameters.UserParameters
oParameter=oMyParameter.AddByValue(pmtr, 0 in, UnitsTypeEnum.kInchLengthUnits)
End Try
Next
Else If UnitType = "TXT"
For Each pmtr In Params
Try
param = Parameter.Param(pmtr)
Catch
oMyParameter=oCompDef.Parameters.UserParameters
oParameter=oMyParameter.AddByValue(pmtr, " ", UnitsTypeEnum.kTextUnits)
MultiValue.SetList(pmtr, "Collapsing Tower", "Mariner", "Jetski Launcher", "Masking Curtain", "Seaplane Launcher", "Lakitu Marquee", "Hovering Propeller", "Chain Chomp", "Chandelier", "Airship Propeller", "Small Piranha Plant", "Side Thwomp", "Bounce Pad w/Props")
End Try
Next
Else If UnitType = "UL" Then
For Each pmtr In Params
Try
param = Parameter.Param(pmtr)
Catch
oMyParameter=oCompDef.Parameters.UserParameters
oParameter=oMyParameter.AddByValue(pmtr, 0 , UnitsTypeEnum.kUnitlessUnits)
End Try
Next
End If
End Sub