
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm having problems getting an iLogic rule to do what I'm telling it to do...
The rule is run once a part has been created and is ready for production.
It runs through all the processes that the part may go through on the workshop floor and then generates custom iProperties.
These custom iProperties then auto-generate a routing sheet on the back of the drawing.
The rule runs pretty well but I'm having an issue when prompted to enter a finish.
The user can leave the self-populated finish as is which works fine.
The user can enter ral, Ral, ral 5643 or something similar and this will tell the iProperties that the finish is painted. Again this works fine.
The issue arises when the user enters 'Natural' or 'natural' which is a term often use in our dept when no further finish is necessary. The rule sees 'ral' (contained within Natu'ral') and thinks the finish is painted and alters the wrong iProperty.
I have tried different approaches using .contains/inStr/ = but none of these solve the issue.
I think the best approach may be to use Regular Expressions to tightly define what part of the string I want to read but I have had little success getting any RegEx to run.
Any advice would be greatly appreiciated.
Laurence
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 62839 StartFragment: 314 EndFragment: 62807 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
Option Explicit Dim PRun As String PRun=MessageBox.Show("Update IProperties?", "Part Status",MessageBoxButtons.YesNo) If PRun= vbYes Then Goto Main: Else If PRun= vbNo Then Goto 2: 'If answered Yes then run program, else refresh document Main: Parameter.Quiet = True Start: Dim oCustomPropertySet As Object 'define custom property collection oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") For Each oCustProp In oCustomPropertySet 'look at each property in the collection oCustProp.Delete 'delete the custom iProperty Next Dim LaserR As String LaserR = MessageBox.Show("Is the Part Lasered?", "Laser Status",MessageBoxButtons.YesNo) 'Is the Part Lasered Yes/No? If LaserR=vbYes Then LaserR = "X" Else If LaserR=vbNo Then LaserR = "" iProperties.Value("Custom", "Laser") = LaserR Dim TurnedR As String TurnedR = MessageBox.Show("Is the Part Turned?", "Turned Status",MessageBoxButtons.YesNo) 'Is the Part Turned Yes/No? If TurnedR=vbYes Then TurnedR = "X" Else If TurnedR=vbNo Then TurnedR = "" iProperties.Value("Custom", "Turned") = TurnedR Dim MachinedR As String MachinedR = MessageBox.Show("Is the Part Machined?", "Machined Status",MessageBoxButtons.YesNo) 'Is the Part Machined Yes/No? If MachinedR=vbYes Then MachinedR = "X" Else If MachinedR=vbNo Then MachinedR = "" iProperties.Value("Custom", "Machined") = MachinedR Dim FoldR As String FoldR = MessageBox.Show("Is the Part Folded?", "Fold Status",MessageBoxButtons.YesNo) 'Is the Part Folded Yes/No? If FoldR=vbYes Then FoldR = "X" Else If FoldR=vbNo Then FoldR = "" iProperties.Value("Custom", "Fold") = FoldR Dim TapR As String TapR = MessageBox.Show("Is the Part Tapped?", "Tap Status",MessageBoxButtons.YesNo) 'Is the Part Tapped Yes/No? If TapR=vbYes Then TapR = "X" Else If TapR=vbNo Then TapR = "" iProperties.Value("Custom", "Tap") = TapR Dim CSKR As String CSKR = MessageBox.Show("Is the Part Countersunk?", "CSK Status",MessageBoxButtons.YesNo) 'Is the Part Countersunk Yes/No? If CSKR=vbYes Then CSKR = "X" Else If CSKR=vbNo Then CSKR = "" iProperties.Value("Custom", "CSK") = CSKR Dim InsertR As String InsertR = MessageBox.Show("Is the Part Inserted?", "Insert Status",MessageBoxButtons.YesNo) 'Is the Part Inserted Yes/No? If InsertR=vbYes Then InsertR = "X" Else If InsertR=vbNo Then InsertR = "" iProperties.Value("Custom", "Insert") = InsertR Dim WeldR As String WeldR = MessageBox.Show("Is the Part Welded?", "Weld Status",MessageBoxButtons.YesNo) 'Is the Part Welded Yes/No? If WeldR=vbYes Then WeldR = "X" Else If WeldR=vbNo Then WeldR = "" iProperties.Value("Custom", "Weld")=WeldR Dim DressR As String DressR = MessageBox.Show("Is the Part Dressed?", "Dress Status",MessageBoxButtons.YesNo) 'Is the Part Dressed Yes/No? If DressR=vbYes Then DressR = "X" Else If DressR=vbNo Then DressR = "" iProperties.Value("Custom", "Dress")=DressR Dim FlattenR As String FlattenR = MessageBox.Show("Is the Part Flattened?", "Flatten Status",MessageBoxButtons.YesNo) 'Is the Part Flattened Yes/No? If FlattenR=vbYes Then FlattenR = "X" Else If FlattenR=vbNo Then FLattenR = "" iProperties.Value("Custom", "Flatten")=FlattenR Dim WeldAssy As String WeldAssy = MessageBox.Show("Part of a Weld Assy?", "Weld Status",MessageBoxButtons.YesNo) 'Is it part of a welded Assy? If WeldAssy=vbYes Then WeldAssy = "X" Else If WeldAssy=vbNo Then WeldAssy = "" iProperties.Value("Custom", "Weld Assy")=WeldAssy Dim AssemblyR As String AssemblyR = MessageBox.Show("Is the Part Assembly Stock?", "Stock Status",MessageBoxButtons.YesNo) 'Is the Part Assembly Stock Yes/No? If AssemblyR=vbYes Then AssemblyR = "X" Else If AssemblyR=vbNo Then AssemblyR = "" iProperties.Value("Custom", "AssemblyS")=AssemblyR Dim FinishR As String FinishR = InputBox("What is the Parts Finish?", "Cost Centre", "Clear Zinc Plate Per ASTM B633 TYPEIII,Zn/Fe8") iProperties.Value("Project", "Cost Center")= FinishR Dim PlateR As String Dim PaintR As String If FinishR = "Clear Zinc Plate Per ASTM B633 TYPEIII,Zn/Fe8" Then PlateR = "X" Else PlateR = "" If FinishR.Contains ("Powdercoat") Or FinishR.Contains ("Powder") Or FinishR.Contains ("powder") Or FinishR.Contains ("powdercoat") Or FinishR.Contains ("Coat") Or FinishR.Contains ("coat") Or InStr(FinishR, "Ral") Then PaintR = "X" Else PaintR = "" 'Or FinishR.Contains ("ral") Or FinishR.Contains ("RAL") iProperties.Value("Custom", "Plate") = PlateR iProperties.Value("Custom", "Paint") = PaintR Dim docname As String docname=ThisDoc.FileName(False) Goto 2: 2: InventorVb.DocumentUpdate()
Solved! Go to Solution.