tag:support.nodebox.net,2012-11-01:/discussions/show-your-work/434-paper-size-node-for-penplottersNodeBox: Discussion 2024-03-14T19:40:37Ztag:support.nodebox.net,2012-11-01:Comment/492327412021-06-05T10:17:44Z2021-06-05T10:17:44ZPaper size node for penplotters<div><p>Thanks, Floris. This looks quite useful.</p></div>johntag:support.nodebox.net,2012-11-01:Comment/492327412024-03-14T18:12:45Z2024-03-14T18:12:45ZPaper size node for penplotters<div><p>Does anyone know whether changing the paper size in a Node like aforementioned or another number that is used as a variable within the network can be used to automatically change the canvasHeight and canvasWidth in the Document Properties?</p></div>florisdejongetag:support.nodebox.net,2012-11-01:Comment/492327412024-03-14T19:17:41Z2024-03-14T19:32:52ZPaper size node for penplotters<div><p>Floris,</p>
<p>I wish there was a way to programmatically update canvas size, but I don't see how. The canvas node in my Cartan Node Library can determine the current canvasHeight and CanvasWidth (using an external Python code library), but cannot set those values.</p>
<p>The canvas height and width are manually set in the document properties dialog and stored inside the .ndbx file as XML properties. A node which changed these values (using an external Python module) would have to overwrite and save these values in the ndbx file. For this to work, merely running a node (by rendering it or a node below it) would actually have to force a file save. I don't think that is possible, no matter what you do.</p>
<p>One thing you could do is to have your node display the required canvas height and width for a given paper size (maybe as a hideable option). Not at all ideal, but since you have to change these values manually it would be helpful for the node (which knows these values) to display them to the user.</p>
<p>One other improvement you could make to your paper size node would be to replace the fit_to node you use to resize the drawing with my new fit_true node. (You would no longer need to create a rect; just feed the width and height directly.). This way the scaling would preserve stroke widths without you having to ask the user to define a new stroke width explicitly.</p>
<p>Wish I had better news but I hope this helps a little.</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/492327412024-03-14T19:40:35Z2024-03-14T19:40:35ZPaper size node for penplotters<div><p>Thanks. Good suggestion. I'd already made some improvements since last time by preserving different stroke color and width. But maybe this is even better. So I'll look into it</p></div>florisdejonge