{"id":11,"date":"2016-08-04T20:00:50","date_gmt":"2016-08-04T20:00:50","guid":{"rendered":"http:\/\/r.jander.me.uk\/?p=11"},"modified":"2016-08-04T20:00:50","modified_gmt":"2016-08-04T20:00:50","slug":"text-per-page-for-lpub4","status":"publish","type":"post","link":"https:\/\/r.jander.me.uk\/index.php\/2016\/08\/04\/text-per-page-for-lpub4\/","title":{"rendered":"Text per-page for LPub4"},"content":{"rendered":"<p>LPub4 offers a way to add text to a page, but no option for text to appear on every page. Whilst working on the BIs for the DuckToppl3r I had a need to put a disclaimer on each page. I am lead to believe that LPub3D can do this, but that is <em>currently<\/em> a Windows-only program. Since LDraw and LPub4 use text and I&#8217;m no stranger to Perl I figured a quick script would come to my rescue \ud83d\ude42<\/p>\n<p>LPub4 produces a new page on each STEP or ROTSTEP statement when not in a multi-step page, or on a &#8220;MULTI_STEP END&#8221; statement. So, all I needed to was to output the same &#8220;INSERT TEXT&#8221; statement above one of those three where relevant. The code used is as below if this proves to be useful to anyone:<\/p>\n<pre>#!\/usr\/bin\/perl\r\n\r\nuse Getopt::Long;\r\n\r\n$first = 'The MINDSTORMS\u00ae Community Partners present ROBOTREMIX3 [31313 + 42050] Community Challenge 2016. DUCK TOPPL3R Design &amp; Building Instructions by Jerry Nicholls.';\r\n$second = 'MINDSTORMS is a registered trademark of The LEGO Group. This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. August 2016';\r\n\r\nGetOptions( 'first=s' =&gt; \\$first, 'second=s' =&gt; \\$second );\r\n\r\n$multi = 0;\r\nwhile(&lt;&gt;) {\r\n $multi = 1 if \/MULTI_STEP\\s+BEGIN\/;\r\n\r\n if ((!$multi &amp;&amp; \/^0\\s+(?:ROT)?STEP\\s\/) ||\r\n     (\/MULTI_STEP\\s+END\/)) {\r\n     $multi = 0;\r\n     print &lt;&lt;\"TEXT\";\r\n0 !LPUB INSERT TEXT \"$first\" \"Helvetica,18,-1,5,75,0,0,0,0,0\" \"Black\" OFFSET 0.06 0.935\r\n0 !LPUB INSERT TEXT \"$second\" \"Helvetica,18,-1,5,75,0,0,0,0,0\" \"Black\" OFFSET 0.06 0.95\r\nTEXT\r\n  }\r\n print;\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>LPub4 offers a way to add text to a page, but no option for text to appear on every page. Whilst working on the BIs for the DuckToppl3r I had a need to put a disclaimer on each page. I am lead to believe that LPub3D can do this, but that is currently a Windows-only &hellip; <a href=\"https:\/\/r.jander.me.uk\/index.php\/2016\/08\/04\/text-per-page-for-lpub4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Text per-page for LPub4&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,6],"tags":[7],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-lego","category-perl","tag-lpub4"],"_links":{"self":[{"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":1,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":12,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions\/12"}],"wp:attachment":[{"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/r.jander.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}