Software that makes placemats

Organise events to meet up and drink Port.
PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 13:20 Mon 25 Feb 2013

pseudo-code of intended suggestion:

Change code from:

Code: Select all

/GlassesOnSheets [
 [ 0 Titles length 1 sub /e exch def /s exch def s 1 e {dup e lt e s sub 6 ge and {dup s sub e s sub 1 add dup 6 div ceiling cvi 3 -1 roll 3 copy mul exch idiv 4 1 roll 1 add mul exch idiv ne {][} if} if} for ]
] def % /GlassesOnSheets
To:

Code: Select all

/MaxGlassesOnSheets [
  page_height_in_mm page_width_in_mm mul 12000 div
] def % /MaxGlassesOnSheets

/GlassesOnSheets [
 [ 0 Titles length 1 sub /e exch def /s exch def s 1 e {dup e lt e s sub /MaxGlassesOnSheets ge and {dup s sub e s sub 1 add dup /MaxGlassesOnSheets div ceiling cvi 3 -1 roll 3 copy mul exch idiv 4 1 roll 1 add mul exch idiv ne {][} if} if} for ]
] def % /GlassesOnSheets
No other changes (no /Multiple etc), but solves Glenn's original issue of max per page for variety of page sizes.

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 13:46 Mon 25 Feb 2013

That almost works for me. Alas we don’t know the paper size (/A4 and other cases needs converting) but that can be kludged.

Next table shows paper size, (Height”“2×30pt) × (Width”“2×30pt) in pt², and this divided by 64k.
/A4    419,482   6.55
/USL   404,064   6.31
/A3    885,928  13.84
/USL2  852,048  13.31

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 14:33 Mon 25 Feb 2013

So a new parameter and better commenting:

Code: Select all

/GlassesOnSheetsMaxGlassesPerSheetInDefault  6  /PaperType load dup /A3 eq exch /USL2 eq or {pop 13} if  /PaperType load /USLegal eq {pop 9} if  def  % 6 default, USLegal => 9; A3 or USL2 => 13. For all on one sheet replace with "/GlassesOnSheetsMaxGlassesPerSheetInDefault 9999 def".

/GlassesOnSheets [

	% For a custom arrangement delete the next line and replace with the likes of [0 1 2 3] [4 5 6 7 8 9] [10 11 12 13]

	[ 0  Titles length 1 sub  /e exch def /s exch def  s 1 e {dup e lt e s sub GlassesOnSheetsMaxGlassesPerSheetInDefault ge and {dup s sub e s sub 1 add dup GlassesOnSheetsMaxGlassesPerSheetInDefault div ceiling cvi 3 -1 roll 3 copy mul exch idiv 4 1 roll 1 add mul exch idiv ne {][} if} if} for ]

] def  % /GlassesOnSheets
(I’ve added extra line breaks here for better reading with browser wrapping.)

Objections?

And yes, I need a hard think about TN-sheet arrangements.

PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 11:01 Tue 26 Feb 2013

No objection; just one further thought. You could separate the user-specified version, so that all of the 'code' stays in the main untouched sections, by doing something like:

Code: Select all

% For a custom arrangement, modify the /UserGlassesOnSheets defintion below
%   e.g.  /UserGlassesOnSheets [ [0 1 2 3] [4 5 6 7 8 9] [10 11 12 13] ] def
/UserGlassesOnSheets [] def

/GlassesOnSheetsMaxGlassesPerSheetInDefault  6  /PaperType load dup /A3 eq exch /USL2 eq or {pop 13} if  /PaperType load /USLegal eq {pop 9} if  def  % 6 default, USLegal => 9; A3 or USL2 => 13. For all on one sheet replace with "/GlassesOnSheetsMaxGlassesPerSheetInDefault 9999 def".

/GlassesOnSheets [
  % PSEUDO-CODE!
  IF /UserGlassesOnSheets != [] THEN
    /UserGlassesOnSheets
  ELSE
    [ 0  Titles length 1 sub  /e exch def /s exch def  s 1 e {dup e lt e s sub GlassesOnSheetsMaxGlassesPerSheetInDefault ge and {dup s sub e s sub 1 add dup GlassesOnSheetsMaxGlassesPerSheetInDefault div ceiling cvi 3 -1 roll 3 copy mul exch idiv 4 1 roll 1 add mul exch idiv ne {][} if} if} for ]
  ENDIF
] def  % /GlassesOnSheets
Then for a user-specific defined layout, they just edit/move /UserGlassesOnSheets to the top and leave all the hidden workings untouched below.

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 11:17 Tue 26 Feb 2013

I see what you’re doing, but occasionally I actually want /GlassesOnTastingNotePages [] def.

PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 16:19 Tue 26 Feb 2013

jdaw1 wrote:I see what you’re doing, but occasionally I actually want /GlassesOnTastingNotePages [] def.
Could be handled:

Code: Select all

%!PS

%% --- user section
%
% uncomment this line for manual definition; leave commented for auto definition
/userValue (red) def

%% -- main "do not touch" section
%
/autoValue (blue) def
/Value {
  currentdict /userValue known {userValue} {autoValue} ifelse
} def
%
/Courier findfont
20 scalefont
setfont
72 500 moveto
Value show
showpage

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 16:37 Tue 26 Feb 2013

New version went on website earlier today. I’ll re-peruse PW’s post tomorrow.

Whilst I was at it, I looked at he code Glenn E. hadn’t liked, and no longer understood it. :oops: And then I realised that it could be done more legibly and more concisely, and in a way that allowed there to be some slight further control. Whoopee!

Glenn E.
Quinta do Vesuvio 1994
Posts: 3358
Joined: 22:27 Wed 09 Jul 2008
Location: Seattle, WA, USA

Re: Software that makes placemats

Post by Glenn E. » 00:49 Wed 27 Feb 2013

jdaw1 wrote:New version went on website earlier today. I’ll re-peruse PW’s post tomorrow.
Splendid.

Question re:

Code: Select all

% GlassesOnSheetsMaxPerSheet: 6 default, USLegal => 9; A3 or USL2 => 13. For all on one sheet replace with "/GlassesOnSheetsMaxGlassesPerSheetInDefault 999 def".
/GlassesOnSheetsMaxPerSheet  6  /PaperType load dup /A3 eq exch /USL2 eq or {pop 13} if  /PaperType load /USLegal eq {pop 9} if  def
Are these instructions correct? /GlassesOnSheetsMaxGlassesPerSheetInDefault does not appear to be used anywhere else in the program, so setting it to 999 seems like it would have no effect.
jdaw1 wrote:Whilst I was at it, I looked at he code Glenn E. hadn’t liked, and no longer understood it. :oops:
I'm somewhat relieved to know that it wasn't just me.
Glenn Elliott

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 10:28 Wed 27 Feb 2013

You quoted my draft from this thread, rather than that in the code.

Code: Select all

% GlassesOnSheetsMaxPerSheet: 6 default, USLegal => 9; A3 or USL2 => 13. For all on one sheet replace with "/GlassesOnSheetsMaxGlassesPerSheetInDefault 999 def".
/GlassesOnSheetsMaxPerSheet  6  /PaperType load dup /A3 eq exch /USL2 eq or {pop 13} if  /PaperType load /USLegal eq {pop 9} if  def
/GlassesOnSheets [
	% For a custom arrangement replace the next line  with something of the form "[0 1 2 3] [4 5 6 7 8 9] [10 11 12 13]"
	% The code below spreads glasses evenly over the sheets, the one-larger sheets being last. For them to be early replace "floor" with "ceiling"; for them to be evenly distributed with "round".
	<< /p Titles length GlassesOnSheetsMaxPerSheet div ceiling cvi  /g 0 >> begin 0 1 p 1 sub {[exch p sub g Titles length sub exch div floor cvi {g /g g 1 add def} repeat]} for end
] def  % /GlassesOnSheets
[/size]There are three relevant changes to the default definition of GlassesOnSheets.

1. The default used to be take-it-or-leave-it. Now it has a parameter, GlassesOnSheetsMaxPerSheet, which itself has a useful default. E.g., /GlassesOnSheetsMaxPerSheet 8 def, makes the default GlassesOnSheets as few pages as possible, subject to the limit of ≤8 glasses per sheet ⇒ ⌈ (Titles length) ÷ 8 ⌉ sheets). So /GlassesOnSheetsMaxPerSheet 999 def will put all on ⌈ ε ⌉ = 1 sheet.

2. There is comment to help use or replace the default.

3. The code is less cryptic, and admits of (slight) alteration, as described in the comments.

The manual will be updated soon.

Glenn E.
Quinta do Vesuvio 1994
Posts: 3358
Joined: 22:27 Wed 09 Jul 2008
Location: Seattle, WA, USA

Re: Software that makes placemats

Post by Glenn E. » 00:57 Thu 28 Feb 2013

Hmm. Very strange, as I went to jdawiseman.com and checked the code there. Perhaps my browser had it cached? No matter.
Glenn Elliott

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 23:57 Tue 12 Mar 2013

[url=http://www.theportforum.com/viewtopic.php?p=53076#p53076]Here[/url] jdaw1 wrote:! Also the position of centre header needed to be changed, for which the code had been altered to add the parameter HeaderFooterCenterRelativeX. This was then assigned to some 132 characters of code, the complication of which might suggest that the form of this parameter was not optimally chosen. (See software thread.)
Using this again for the Taylor tasting, it was suddenly obvious that HeaderFooterCenterX, so not Relative, would be much easier to use. Change made.

Edit: also see parameters used for the Taylor tasting.

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 13:00 Thu 21 Mar 2013

[quote="In the thread entitled ‟Parameters for the placemat software", jdaw1"]• Because the T35 and TV70 appear on both glasses sheets, they have twice as many labels as the others. Error. What to do? This could have been fixed in the parameters by making StickyLabelsNumCopies much more complicated, but that would be nasty. Of course there can’t be a !StickyLabels! equivalent of GlassesClusteredOnVoteRecorders, so it can’t be fixed that way. So instead I will code StickyLabels! equivalents to PrePourRemoveDuplicatesByWithinTitles and PrePourSortByWithinTitles.[/quote]

PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 15:50 Thu 21 Mar 2013

jdaw1 wrote:[quote="In the thread entitled ‟Parameters for the placemat software", jdaw1"]• Because the T35 and TV70 appear on both glasses sheets, they have twice as many labels as the others. Error. What to do? This could have been fixed in the parameters by making StickyLabelsNumCopies much more complicated, but that would be nasty. Of course there can’t be a !StickyLabels! equivalent of GlassesClusteredOnVoteRecorders, so it can’t be fixed that way. So instead I will code StickyLabels! equivalents to PrePourRemoveDuplicatesByWithinTitles and PrePourSortByWithinTitles.
[/quote]
Perhaps early on in the page processing it might be worth creating/defining a UniqueGlasses from GlassesOnSheets, which could then be used by all such later processing?

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 17:53 Thu 21 Mar 2013

PhilW wrote:Perhaps early on in the page processing it might be worth creating/defining a UniqueGlasses from GlassesOnSheets, which could then be used by all such later processing?
Good idea.

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 23:59 Thu 21 Mar 2013

Extra settings, and their defaults:

Code: Select all

/StickyLabelsReverseOrder false def
/StickyLabelsRemoveDuplicatesByWithinTitles true def
/StickyLabelsSortByWithinTitles true def
PhilW wrote:Perhaps early on in the page processing it might be worth creating/defining a UniqueGlasses from GlassesOnSheets, which could then be used by all such later processing?
Not done, as the PrePour! and StickyLabels! settings might differ.

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 07:55 Sun 24 Mar 2013

In setting up the recent Taylor vertical, AHB was pouring and DRT and I were distributing. Naturally enough, the young vintages were pre-poured first, and soon enough the front rows were filled with glasses. Then the older glasses had to be lifted awkwardly behind the already-full first row. It was fiddly.

This problem could be solved by reversing the order of rows of on the sheet. AHB remarked that having the older vintages nearer would help his smelling of them.

There is already a parameter, very rarely changed, PackingDirectionVertical, which can take values /TopToBottom or /BottomToTop. So the change isn’t tricky.

However, doing this by default would rather conflict with my sense of natural order. Vintage lists start old, and have the new at the end, allowing the list to be extended with the passage of time. My sense of old-to-new / top-to-bottom natural order is quite strong is that just me?

User avatar
DRT
Fonseca 1966
Posts: 15253
Joined: 23:51 Wed 20 Jun 2007
Location: Chesterfield, UK
Contact:

Re: Software that makes placemats

Post by DRT » 08:21 Sun 24 Mar 2013

I had a similar thought while distributing the wines but either way the taster has to remove and replace glasses in the back row throughout the evening. For some inexplicable reason, this manoeuvre gets trickier as time goes by.

Perhaps a third parameter /TopLeftToBottomRight could be used so that the wines end up in columns of four working from left to right.
"The first duty of Port is to be red"
Ernest H. Cockburn

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 12:02 Sun 24 Mar 2013

There are currently two relevant settings.
PackingDirectionVertical, which can be /TopToBottom or /BottomToTop;
PackingDirectionHorizontal, which can be /LeftToRight or /LeftToRight.

DRT seems to be asking for another setting, PackingNestingOrder, with allowed values of /RowsThenColumns (current behaviour) and /ColumnsThenRows.

Let’s have some examples in mind.
Image Image Image Image
(These shown with glasses in current default order.)

For the first two examples, with an easy rectangular layout, any of the eight possibilities from these 2+1 parameters would make sense. So far, so good.

The third example can also cope with any of the eight parameter arrangements. But for the fourth, is the top-most glass (‘A0’) in a column of its own? Yes, I guess so. So that could work.

But what should be the default behaviour? Should it really be this:
/PackingNestingOrder /ColumnsThenRows def
/PackingDirectionVertical /BottomToTop def
/PackingDirectionHorizontal /LeftToRight def

Image
This order seems weird to me. Just me?

User avatar
DRT
Fonseca 1966
Posts: 15253
Joined: 23:51 Wed 20 Jun 2007
Location: Chesterfield, UK
Contact:

Re: Software that makes placemats

Post by DRT » 13:23 Sun 24 Mar 2013

The current default behaviour is perfect for smallish tastings so should remain the default. But the ability to produce the format that you find odd is useful for tastings where the tasting mats become elongated, such as was the case at the Taylor tasting on Friday.
"The first duty of Port is to be red"
Ernest H. Cockburn

PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 17:59 Sun 24 Mar 2013

DRT wrote:The current default behaviour is perfect for smallish tastings so should remain the default. But the ability to produce the format that you find odd is useful for tastings where the tasting mats become elongated, such as was the case at the Taylor tasting on Friday.
Agreed with preference for current behaviour as default; so if adding this extension, then defaults of:
/PackingNestingOrder /RowsThenColumns def
/PackingDirectionVertical /TopToBottom def
/PackingDirectionHorizontal /LeftToRight def

(though noting AHB's preference for BottomToTop).

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 20:37 Sun 24 Mar 2013

DRT, PhilW: assuming settings of /ColumnsThenRows, /TopToBottom, and /LeftToRight, in which order would the following two layouts be? (Your answer should be of the form ‟A0, D3, !”, though not necessarily starting with those two.)
Image Image

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 22:12 Sun 24 Mar 2013

I’m hoping the answers are:
• G6, A0, D3, H7, B1, E4, I8, C2, F5, J9;
• D3, H7, A0, E4, I8, B1, F5, J9, C2, G6, K10.

PhilW
Dow 1980
Posts: 2715
Joined: 14:22 Wed 15 Dec 2010
Location: Near Cambridge, UK

Re: Software that makes placemats

Post by PhilW » 22:56 Sun 24 Mar 2013

jdaw1 wrote:I’m hoping the answers are:
• G6, A0, D3, H7, B1, E4, I8, C2, F5, J9;
• D3, H7, A0, E4, I8, B1, F5, J9, C2, G6, K10.
I'd agree with both answers.

Glenn E.
Quinta do Vesuvio 1994
Posts: 3358
Joined: 22:27 Wed 09 Jul 2008
Location: Seattle, WA, USA

Re: Software that makes placemats

Post by Glenn E. » 23:20 Mon 25 Mar 2013

PhilW wrote:
jdaw1 wrote:I’m hoping the answers are:
• G6, A0, D3, H7, B1, E4, I8, C2, F5, J9;
• D3, H7, A0, E4, I8, B1, F5, J9, C2, G6, K10.
I'd agree with both answers.
+1

I'm also pleased to now know of the existence of /PackingDirectionVertical and /PackingDirectionHorizontal. This will save me from having to manually arrange the Ports in the various lists so that they come out with the oldest front left and the youngest back right! If I understand correctly, that would only require that I change /PackingDirectionVertical to /BottomToTop?

See, there really is a point to keeping up with this thread. :wink:
Glenn Elliott

User avatar
jdaw1
Cockburn 1900
Posts: 20530
Joined: 15:03 Thu 21 Jun 2007
Location: London
Contact:

Re: Software that makes placemats

Post by jdaw1 » 00:42 Tue 26 Mar 2013

Glenn E. wrote:I'm also pleased to now know of the existence of /PackingDirectionVertical and /PackingDirectionHorizontal.
Happiness. But PackingNestingOrder is, currently, only a planned parameter. It does not yet exist.

Post Reply