I have a rule setup for drawings. I need the rule to first determine if the there is a flat pattern view present. In other words, if there is no flat patter view, I want to the rule to stop.
I am very green to ilogic and VB. Running Inventor 2013.
Thanks in advance for any suggestions.
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi fitch,
Here's a quick example:
Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView
oSheets = ThisDoc.Document.Sheets
i = 0
For Each oSheet In oSheets
oViews = oSheet.DrawingViews
For Each oView In oViews
If oView.IsFlatPatternView = True Then
'count the view
i = i +1
Else
End if
Next
Next
If i > 0 Then
MessageBox.Show("This drawing contains a flat pattern view.", "iLogic")
'run additional rule
'iLogicVb.RunRule("ruleName")
Else
MessageBox.Show("This drawing does NOT contain a flat pattern view.", "iLogic")
End If
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi all,
I have created a simple configurator using iLogic. There are 5 to 6 Fx parameters which controls the model.
If a Combination is NOT available as per the indutrial specifications catalog. Then, that combination should not be configured. Though I select an Incorrect combination, Inventor prompting a Message Box (Incorrect Combination) as written in the Rule, But not Stopping the iLogic rules.
I'm comparing with VB or .NET coding like Exit Sub.
Precisely, my question is; Does iLogic contain any method which Stops or Exits from iLogic Rule, if any Incorrect selection has made in iLogicForm??
I searched almost entire the site last weekend but ended-up in vain. Conseder my request and anybody could guide me in correct direction.
Thanking you in advace.
Regards
NKalyan
Hello,
Here is an variant piece of code that achieves the same as the code above.
Code:
Option Explicit Dim bFound As Boolean = False For Each oSheet As Sheet In ThisApplication.ActiveDocument.Sheets For Each oView As DrawingView In oSheet.DrawingViews If oView.isFlatpatternView Then bFound = True Exit For End If Next oView If bFound Then Exit For Next oSheet If bFound Then MessageBox.Show("FlatPattern view found") ' Add additonal code here Else MessageBox.Show("FlatPattern view NOT found") ' Add addtional code here or remove the Else statement End If
Regards,
E. Wiggers
Wiggers,
Thank you for your reply. The example in which it is dis-countinuing the For-Next loop.
But, I'm looking a for segment by which all the Rules should Stop.
If Model_Number = "10" And Description = "Hydro" Then
i = MessageBox.Show("Selected model is not available in Hydro ", _
"Not available", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Else
Exit from Rule (This is what I'm looking for?) ' This line is just assumed & not part of the code.
End if
Regards
NKalyan
Hello NKalyan,
To exit a rule you can use simply Exit Sub.
You can use the Exit Sub statement at any place in your code, so no problem to use that in a For Next loop or in a If Then Else statement.
Regards,
Eelco Wiggers