iLogic: Help With If Statements/Multiple Conditions

iLogic: Help With If Statements/Multiple Conditions

Anonymous
Not applicable
2,193 Views
2 Replies
Message 1 of 3

iLogic: Help With If Statements/Multiple Conditions

Anonymous
Not applicable

Hi,
 
I have some code written and I want to check to see if multiple conditions are met using "If" statements. If all six conditions are met, I want a message box to appear. (If any of the six conditions are NOT met, later on I might want to add a statement saying that not all of the conditions have been met). 
 
I included a view of my code below – is my iLogic code is set up correctly? If not, what do I need to change? I've already tested my code and it seems to work, but I'm wondering if there is a more correct/efficient way to set this up.
 
Thanks.
 
My code:

Code for forum post (3rd).PNG

0 Likes
Accepted solutions (1)
2,194 Views
2 Replies
Replies (2)
Message 2 of 3

philip1009
Advisor
Advisor
Accepted solution

"And" and "Or" statements can help with checking multiple statements at once:

If oBodies.Count = 1 And blnPlanarFaceCheck = True And oSketch.PlanarEntity.Name = "XY Plane" And ThisDoc.Document.ComponentDefinition.Material.Name <> "Generic" And oFace.Type = ObjectTypeEnum.kFaceObject And Round(iProperties.Volume / (dArea/6.452)) = 12 Then
	MessageBox.Show("Calculations Made.  No Errors Found.", "iLogic Message", MessageBoxButtons.OK)
	Exit Sub
End If

Or this way if you don't want it all in one line:

If oBodies.Count = 1 And
	blnPlanarFaceCheck = True And
	oSketch.PlanarEntity.Name = "XY Plane" And
	ThisDoc.Document.ComponentDefinition.Material.Name <> "Generic" And
	oFace.Type = ObjectTypeEnum.kFaceObject And Round(iProperties.Volume / (dArea/6.452)) = 12 Then
		MessageBox.Show("Calculations Made.  No Errors Found.", "iLogic Message", MessageBoxButtons.OK)
		Exit Sub
End If

Here's a YT playlist that I've found useful for learning VB (Visual Basic), it's not exactly the same way iLogic works, but it will show you all the tips and tricks to fully write your logic code the best way possible:  https://www.youtube.com/playlist?list=PLC601DEA22187BBF1

Message 3 of 3

Anonymous
Not applicable

Thank you! I'll have to check out that playlist.

0 Likes