Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm trying to make an external rule that doesn't allow saving a part until the material and treatment have been set.
The problem is that I want to avoid this happening in some cases...
If it has "Bosch Profile" in the description
If iProperties.Value("Custom", "IsPurchased") = True
But the problem is that some older parts do not have "iProperties.Value("Custom", "IsPurchased") "
and I would like this parts to be excluded as well, how can I do that?
That is what I have done so far.
Dim oDoc As Document = ThisDoc.Document
oNr = iProperties.Value("Project", "Part Number")
If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
If Left(iProperties.Value("Project", "Description"), 13) = "Bosch Profile"
Else If iProperties.Value("Custom", "IsPurchased") = False
again :
'[''''''''''''''''''''''''''''''''''''''MATERIAL'''''''''''''''''''''''''''''
If iProperties.Material = "" Or iProperties.Material = "-"
Dim oValueList1 As New ArrayList
oValueList1.Add("Aluminium - EN AW-2007/2011")
oValueList1.Add("Aluminium - EN AW-5005 - Natural Anodised")
oValueList1.Add("Aluminium - EN AW-6082")
oValueList1.Add("Brass")
oValueList1.Add("Bronze")
oValueList1.Add("Copper")
oValueList1.Add("Generic")
oValueList1.Add("POM-C - Black (Ertacetal)")
oValueList1.Add("POM-C - Nature (Ertacetal)")
oValueList1.Add("Stainless Steel - AISI 304")
oValueList1.Add("Stainless Steel - AISI 316 (EN 1.4404)")
Dim oValue1 As String = InputListBox(oNr & " Material it is MANDATORY", oValueList1)
If String.IsNullOrEmpty(oValue1) Then
GoTo again
End If
iProperties.Material= oValue1
End If
']
'[''''''''''''''''''''''''''ADD iProperties if does not exist''''''''''''''''
Dim Doc As Document= ThisApplication.ActiveDocument
Dim oTreatment As PropertySet = Doc.PropertySets.Item("Inventor User Defined Properties")
' Attempt to get an existing custom property named "Treatment".
On Error Resume Next
Dim Part_Treatment As PropertySet = oTreatment.Item("Treatment")
If Err.Number <> 0 Then
' Property does not exist -> Add the property.
Dim textValue As String
textValue = "Treatment"
Call oTreatment.Add(textValue, "")
End If
']
'[''''''''''''''''''''''''''''''''''''TREATMENT''''''''''''''''''''''''''''''
If iProperties.Value("Custom", "Treatment") = "" Or iProperties.Value("Custom", "Treatment") = "-"
Dim oValueList1 As New ArrayList
'oValueList1.Add("-")
oValueList1.Add("None")
oValueList1.Add("Anodizing - Hard")
oValueList1.Add("Anodizing - Precision")
oValueList1.Add("Assembled before painting")
oValueList1.Add("Browning")
oValueList1.Add("Welding Part")
Dim oValue1 As String = InputListBox(oNr & " Treatment it is MANDATORY", oValueList1)
If String.IsNullOrEmpty(oValue1) Then
GoTo again
End If
iProperties.Value("Custom", "Treatment")= oValue1
End If
End If
End If
Solved! Go to Solution.