CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 3738

CAD tip CAD tip # 10114:

   
Question CAD 
 %  platform  category 
Q - question

iLogic tip: returning a value on the True and False conditions.

A - answer Using the following variants of iLogic code you can return different values for the "True" and "False" conditions in your macros - i.e. if a given condtion is met or not met:

'Input data

Dim msg as String = ""

Dim condition As Boolean = True

'Variant #1

If condition Then

msg = "Truth"

Else

msg = "Lie"

End If

MsgBox(msg)

'Variant #2

msg = If(condition, "Truth", "Lie")

MsgBox(msg)

'Variant #3

MsgBox(If(condition, "Truth", "Lie"))

Inventor
100% *  CAD 
27.11.2014    4823×  
applies to: Inventor ·

See also:
Tip 12697:Opposite angle for angular dimensions in Inventor drawings (iLogic).
Tip 12644:How to identify parts and assemblies imported from STEP/IGES?
Tip 12508:How to assign an expression (not value) to a user parameter with iLogic?
Tip 12462:Mass- (table-) rename parameters in Inventor.
Tip 12432:Parse/replace Inventor iProperties using regular expressions.


Back   All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Publish interactive 3D PDF models from AutoCAD, Inventor or Revit with Share3D More info


Please use these tips at your own risk.
CAD Studio is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist