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: 

MOD Operator Syntax

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
brad.jackson
767 Views, 2 Replies

MOD Operator Syntax

Can anyone give me some examples of how to set up the syntax for the MOD Operator in iLogic?

 

As an example, I would hope to get the remainder of a length divided by a set value of 95".

120.4375" / 95" = 1.xxx-xxxxxxxx

I would like to know if and how I might use the MOD operator in the iLogic code to get the remainder rounded to the nearest 16th (which in this case should be 25.4375").

I have used the % in the parameters to accomplish this in the past, but I am not sure how to set it up in code.

2 REPLIES 2
Message 2 of 3
J-Camper
in reply to: brad.jackson

Here is a sample:

Dim inputVar As Double = 120.4375 in
Dim TOL As Double = 1 in  / 16 ul
Dim MODvalue As Double = 95 in

Dim Output1 As Double = Math.Round((inputVar Mod MODvalue) / TOL) * TOL

Logger.Trace(Output1)

 

 

Message 3 of 3
brad.jackson
in reply to: J-Camper

Thank you very much

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report