Calculation Precission mm rounded no decimals

Post Reply
kumpelj
Newbie
Posts: 10
Joined: Thu Jun 16, 2011 9:18 am

Calculation Precission mm rounded no decimals

Post by kumpelj »

Hi,

If i convert the trimbox size by Switch Calculation (pt > mm), with a precision of 2
i do not wan't to see decimals if they there is not meaningful

For instance: 420.00 mm
Should be: 420 mm

Rounded by ceil expression does not work.

How can i fix this?
Switch Calculation Screen 2-1 Decimals.png
Switch Calculation Screen 2-1 Decimals.png (159.84 KiB) Viewed 8133 times
loicaigon
Advanced member
Posts: 363
Joined: Wed Jul 10, 2013 10:22 am

Re: Calculation Precission mm rounded no decimals

Post by loicaigon »

Don't think you can get this in one pass. I don't know what is the final intention but you might need the scripting module to implement such logic.
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Calculation Precission mm rounded no decimals

Post by Padawan »

You can also use the round function which is mentioned in the description on your screenshot.

For example, you can just place the round around the complete expression, for example like this:
[Switch.Calculation:Expression="round([Stats.MediaBoxHeight:Type="Defined"])"]

Edit: That will of course round the complete thing. If you only want to remove the obsolete zero's I also think you'll need the scripting module.
LasseThid
Advanced member
Posts: 353
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: Calculation Precission mm rounded no decimals

Post by LasseThid »

If you have the Switch Scripting module then this javascript will do what you ask for.
The resulting values can be accessed thru Job>PrivateData Key New_Height and New_Width.

Code: Select all

function jobArrived( s : Switch, job : Job )
{
	var width = job.getVariableAsNumber("[Stats.TrimboxWidth]"); 
	var height = job.getVariableAsNumber("[Stats.TrimboxHeight]");   
	var inputJob = job.getPath();
	var theFileName = job.getNameProper()
	New_Width = Math.floor((width/72)*25.4+0.5);
	New_Height	 = Math.floor((height/72)*25.4+0.5);			
	job.setPrivateData( ”New_Width", New_Width );
	job.setPrivateData( "New_Height", New_Height );
	job.sendToSingle( inputJob, theFileName );
}
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Post Reply