Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic drawing rule

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Molly15
671 Views, 6 Replies

ilogic drawing rule

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.

6 REPLIES 6
Message 2 of 7
Curtis_Waguespack
in reply to: Molly15

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

Message 3 of 7
Molly15
in reply to: Curtis_Waguespack

That worked great!! Thanks so much for your help!

Message 4 of 7
naresh_kalyan
in reply to: Molly15

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

 

 

Message 5 of 7
ewiggers
in reply to: Molly15

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

Message 6 of 7
naresh_kalyan
in reply to: ewiggers

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

Message 7 of 7
ewiggers
in reply to: naresh_kalyan

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums