Jump to content

StartNewStack()


carlm

Recommended Posts

We have a template with 4 pages: MasterFront, MasterBack, SpacerFront, SpacerBack.

 

In OnRecordStart, we turn these On/Off as needed based on column/field values coming thru the record.

 

Before running any of the above rules we have as the very first rule in OnRecordStart..the following

 

if (FieldChanged("NewStackTrigger")) FusionPro.Composition.StartNewStack();

 

Everything works normally but we do not generate the start of a new stack when the field changes. The PDF is imposed sheet-wise...left to right, top to bottom and then down to the next sheet (this is what we want so far)

 

Example: We run some data that fits on a single sheet (front and back) but the data DOES have values that should kick off a new sheet..we should generate 2 sheets front and back even if the sheets are not "filled" up w/imposed records

 

Any ideas? IsStartNewStack() 2side aware? Are there composing errors that could prevent this?

 

Thank you!

Link to comment
Share on other sites

Update: In OnRecordStart, when I replace the FusionPro.Composition.StartNewStack() with ReportWarning("Detected Change");

 

I'm getting the change detected properly and it shows up in the MSG log just fine. I'm missing something about what it takes to truly trigger the new stack.

Link to comment
Share on other sites

Everything works normally but we do not generate the start of a new stack when the field changes. The PDF is imposed sheet-wise...left to right, top to bottom and then down to the next sheet (this is what we want so far)

This may be a silly question, but are you actually doing stacking in your imposition? In other words, is one of the three "Step and Repeat" drop-downs in FP Imposer set to "Stack?" If not, then you're just doing horizontal and vertical repeats, without stacking, so telling FusionPro to start a new stack means nothing.

Link to comment
Share on other sites

Added/Updated my signature so you can see what I'm running...sorry.

 

I found the definition of the function in the RulesSystemGuide.pdf. It states that "If imposing by stacks, this will trigger a new stack..." Since we are imposing by sheet and did NOT select STACK from the dropdown in the FPIImposer tool, this might turn the function OFF.

 

If this is the problem, how can we start a new imposition page if we do not use the STACK dropdown?

Link to comment
Share on other sites

I found the definition of the function in the RulesSystemGuide.pdf. It states that "If imposing by stacks, this will trigger a new stack..." Since we are imposing by sheet and did NOT select STACK from the dropdown in the FPIImposer tool, this might turn the function OFF.

Yes, if you're not doing stacking, there's no new stack to start.

If this is the problem, how can we start a new imposition page if we do not use the STACK dropdown?

I'm not sure why you want to start a new imposed sheet. But you should be able to just set the third "Step and Repeat" setting to Stack, with a Count of 1.

Link to comment
Share on other sites

Purpose is two-fold.

First: The product shipped must be perfed sheets of imposed pages Left to Right, Top to Bottom (and break into next press sheet as needed).

 

Second: When the shipping destination changes, we want to stop imposing on the current sheet and immediately start a new press sheet so that the new store info starts on a new sheet.

 

I tried setting the last dropdown to stack w/count of 1 w/o any luck.

..Simplex Horz 14, Vertical 10, Stack 1

 

OnRecordStart...StartNewStack()...no change.

OnRecordStart...StartNewSheet()...complains about a non-assigned body page.

Link to comment
Share on other sites

Purpose is two-fold.

First: The product shipped must be perfed sheets of imposed pages Left to Right, Top to Bottom (and break into next press sheet as needed).

 

Second: When the shipping destination changes, we want to stop imposing on the current sheet and immediately start a new press sheet so that the new store info starts on a new sheet.

The only way I know of to force a new imposed output sheet is to start a new output file (chunk), by calling FusionPro.Composition.OpenNewOutputFile().

I tried setting the last dropdown to stack w/count of 1 w/o any luck.

..Simplex Horz 14, Vertical 10, Stack 1

You could try Infinite Stack instead, but I'm not sure that will do what you want either. I'm pretty sure you have to open a new output file.

OnRecordStart...StartNewStack()...no change.

OnRecordStart...StartNewSheet()...complains about a non-assigned body page.

There's no StartNewSheet() function.

Link to comment
Share on other sites

This is kind of a hacky solution but basically when the field changes indicating you'd like to start a new sheet, you repeat that record the number of positions left on the imposed sheet + 1 to put that record on the sheet. You'll need to create 2 new pages (BlankFront & BlankBack) and set them both to "unused" in the "Manage Pages" dialog box.

 

For example: if you have a 20up imposition and you'd like to start a new sheet after record 10, you'd set record 10 to repeat 11 times. Once to put it on the sheet, and 10 times to fill the imposition with 10 blanks which will force record 11 to start on a new sheet.

 

I should also preface this with the fact that I haven't actually tried to run this code myself but the logic seemed sound and I tried to comment the code to the best of my ability so hopefully it will get you on the right track.

 

OnRecordStart():

function blankCount(){
	// Get the name of the FPI file from the cfg file
	var fpiFile = FusionPro.Composition.JobOptions["ImpositionDefFileName"];

	// Import the .fpi file as an external data file delimited by returns (\n)
	var ex = new ExternalDataFileEx(fpiFile,'\n');

	// Print Error if the template can't link to the fpi file
	if(ex.valid != true) {
		Print('Failed to link to the FPI file in OnJobStart');
	}

	// Create an object with all of the properties on the fpi document
	var fpi = new Object();
	for (var i=0; i<=ex.recordCount; i++){
	    var rec = ex.GetFieldValue(i,0).split("=");
	    var prop = rec[0];
	    var val = rec[1];
	    fpi[prop] = val;
	}

	// Get the values of the 3 columns in the imposition setting and put them
       // in "array"
	var array = [[fpi.PrimaryRepeatDirection,fpi.PrimaryRepeatCount],[fpi.SecondaryRepeatDirection,fpi.SecondaryRepeatCount],[fpi.TertiaryRepeatDirection,fpi.TertiaryRepeatCount]];
       // Remove the "Stack" Column and "None" Column
       array = array.filter(function(m){ return (m[0] != "Stack" && m[0] != "None");})

       // Assign the Vertical & Horizontal values to a & b (default to 1)
       try { var a = array[0][1];} catch(e) {var a = 1;}
       try { var b = array[1][1];} catch(e) {var b = 1;}
       // Multiply a and b to get the number up 
       var impo = a*b;
       var rec = FusionPro.Composition.ProcessedRecordNumber;

       // Return the number of positions left on the imposed sheet + 1 to include the current record
       return (rec%impo == 0) ? 1 : impo-(rec%impo) + 1;
}

   if (FieldChanged("NewStackTrigger")){
   // Repeat the current record the number of blanks positions on the sheet + 1 for the current record
   FusionPro.Composition.repeatRecordCount = blankCount();
   // If it's the first time repeating the record, pull in the master front & back
   FusionPro.Composition.SetBodyPageUsage("MasterFront",FusionPro.Composition.repeatRecordNumber==1);
   FusionPro.Composition.SetBodyPageUsage("MasterBack",FusionPro.Composition.repeatRecordNumber==1);
   // All subsequential times repeating the record, pull in the blank front & back
   FusionPro.Composition.SetBodyPageUsage("BlankFront",FusionPro.Composition.repeatRecordNumber!=1);
   FusionPro.Composition.SetBodyPageUsage("BlankBack",FusionPro.Composition.repeatRecordNumber!=1);
   }

Edited by step
syntax
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...