PaperModelers.com

Go Back   PaperModelers.com > Designers Corner > Software

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2011, 01:11 PM
papersmithforge's Avatar
papersmithforge papersmithforge is offline
Member
 
Join Date: Feb 2011
Posts: 90
Total Downloaded: 0
Universal Printable Area

This stems from the thread titled:
A4 and US Letter PDF Compatibility?

I've developed a small script for Rhino 4 (using Rhinoscript) that will create two rectangles, one nested within the other. The outer rectangle is the paper size, the inner rectangle represents the maximum boundary where model parts should be located.

In case 1, the script detects you're working in inches. So it will draw a rectangle that is 8.5 x 11 inches (US Letter) with an interior rectangle that specifies the offsets from the aforementioned thread.

In case 2, the script ASSUMES you're working in millimeters (the script ONLY bothers to detect inches so if you were working in centimeters it would assume millimeters regardless). Therefore, it draws a rectangle that is 210 x 297 (A4) with the proper marginal offsets. Keeping in mind that if you work in something other than inches or millimeters it will use THOSE units so your rectangle would be drawn improperly.

After loading the script it can be called by typing in "UniversalPrintableArea" (minus quotes). Then it will ask you to place the upper left corner of the INNER rectangle. It will draw the shape and group all lines together. The orientation of the grouped lines will vary based on which viewport you click within. If you click on a viewport other than the Top, Front, and Right, it will draw the box in the default orientation (assumes you are viewing from the Top viewport, as this is where developable surfaces are unrolled).

How are these shapes useful? Well as far as myself, I lay out parts within Rhino as opposed to in a separate program. Then, I export them by creating a PDF printout. These "boxes" serve as a guide when defining the area I wish to print and scale to use. When I press Print in Rhino I redefine the printer area by constructing the printing rectangle from the upper left corner of the outer rectangle to the lower right corner of the outer rectangle. Rhino then typically asks if I want to adjust the scale (which I don't as I want it 1:1). With my printing area properly defined now I exit the Print dialog and hide the border shape group. Finally, I press Print again and save my PDF to my desktop.

Now I can import my PDF into a PDF editing program (I make use of Inkscape) and can rest assured that all the shapes are properly situated so that no printer cutoff will occur when the PDF is printed at 100% (regardless of A4 or Letter size paper). I can make color modifications or add part numbers or whatever else I might need to do.

If anyone is interested please let me know and I'll gladly provide the code here and make the *.rhvb file available. Or if you have suggestions for improving the script I'm open to those as well.
__________________
Papersmith Forge - Mig
Reply With Quote
Google Adsense
  #2  
Old 12-13-2011, 01:24 PM
Leif Ohlsson's Avatar
Leif Ohlsson Leif Ohlsson is offline
Member
 
Join Date: Jul 2007
Location: Göteborg, Sweden
Posts: 2,640
Total Downloaded: 54.96 MB
I applaud the effort, although I won't be able to use the result of it myself. Good job! - L.
Reply With Quote
  #3  
Old 12-18-2011, 04:20 PM
papersmithforge's Avatar
papersmithforge papersmithforge is offline
Member
 
Join Date: Feb 2011
Posts: 90
Total Downloaded: 0
Which software do you design in Leif (if any)?
__________________
Papersmith Forge - Mig
Reply With Quote
  #4  
Old 12-19-2011, 04:29 AM
Leif Ohlsson's Avatar
Leif Ohlsson Leif Ohlsson is offline
Member
 
Join Date: Jul 2007
Location: Göteborg, Sweden
Posts: 2,640
Total Downloaded: 54.96 MB
I draw, and edit existing downloaded vector models, in Adobe Illustrator. It works pretty well, since it displays the printable area for any given paper format & printer.

If I specify my own universal paper size, and my Epson printer, it will display printable area dotted lines some 3.5mm inside the actual paper format full lines.

In the few instances I have made something available I have let this guide my printing area, and stated that the resulting pdf is suitable for both A4 and Letter, if printed on ordinary inkjet printers (relying on Epson margins being equal to other similar printers).

I take it that laser printers will require wider margins but won't go into that, since few builders of paper models use laser printers.

Leif
Reply With Quote
  #5  
Old 12-19-2011, 10:52 AM
papersmithforge's Avatar
papersmithforge papersmithforge is offline
Member
 
Join Date: Feb 2011
Posts: 90
Total Downloaded: 0
Rhino does a similar thing Leif. I took a screenshot to demonstrate. The dark grey area in the second pic is the printable area and the light grey area is the non-printable area of my printer (I would infer it's determined codewise much as the program I uploaded in the other thread). The black box with the letters L4 (virtual page size) shows where our universally compatible virtual page would lie within my HP's printable area. The Print Preview makes it a little more apparent as it shows the dotted lines just like I imagine Adobe Illustrator does.

Since I print to a PDF printer, the light grey area and dotted line don't appear because a virtual printer doesn't have a non-printable area. The L4 rectangle helps me nest my parts accurately and efficiently.
Attached Thumbnails
Universal Printable Area-print_preview.jpg   Universal Printable Area-print_pane.jpg  
__________________
Papersmith Forge - Mig
Reply With Quote
Google Adsense
  #6  
Old 12-19-2011, 11:13 AM
Maltedfalcon Maltedfalcon is offline
Member
 
Join Date: Sep 2008
Posts: 516
Total Downloaded: 72.31 MB
I just make my designs within 7.56X10.5 inches
and it seems to print universally at 100% without scaling.
Reply With Quote
  #7  
Old 12-19-2011, 12:47 PM
Zathros Zathros is offline
Banned
 
Join Date: Jul 2007
Location: Earth
Posts: 5,159
Total Downloaded: 0
You can make a box like this in Rhino and "lock it". You can then center your print pane over it and it does the same thing without a script. The last model I designed I had 20 groups of parts and was able to print them in the time it took to move the pane and click print (to file) in my case.
Reply With Quote
  #8  
Old 12-19-2011, 12:57 PM
papersmithforge's Avatar
papersmithforge papersmithforge is offline
Member
 
Join Date: Feb 2011
Posts: 90
Total Downloaded: 0
The boundary rectangle this creates is approximately that size Maltedfalcon, a little bit wider (7.6875 in) and a little bit shorter (10.21875 in) offset 9/32 of an inch from the upper left corner both vertically and horizontally. Of course the script is simple enough to understand where you could modify it to work with values you choose. The ones used by default are those that were made available by the people who participated in the prior thread and by reading through some technical specs. The specifically generated rectangles save me the work of trying to remember the fractional parts and offsets.

Code:
Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version Sunday, December 11, 2011 10:52:20 AM

Sub UniversalPrintableArea()
    Rhino.EnableRedraw(False)
    
    'Declare variables
    Dim topMargin, leftMargin, rightMargin, bottomMargin
    Dim pageWidth, pageHeight, innerWidth, innerHeight
    Dim upperCorner, helpCorner(3)
    Dim boundaryLines
    Dim viewPort
    Dim unitSystem
    
    unitSystem = Rhino.UnitSystem
    
    'Prompt for upper left corner of printable area'
    upperCorner = Rhino.GetPoint("Corner of print area")
    If IsNull(upperCorner) Then Exit Sub
    
    Select Case unitSystem
        Case 8    'Inches
            topMargin = 9.0/32.0
            leftMargin = 9.0/32.0
            rightMargin = 17.0/32.0
            bottomMargin = 0.5
            pageWidth = 8.5
            pageHeight = 11
        Case Else    'Assumes millimeters
            topMargin = 7
            leftMargin = 8
            rightMargin = 7
            bottomMargin = 30
            pageWidth = 210
            pageHeight = 297
    End Select
    
    innerWidth = pageWidth - leftMargin - rightMargin
    innerHeight = pageHeight - topMargin - bottomMargin
    
    boundaryLines = Rhino.AddGroup()
    viewPort = Rhino.CurrentView()
    
    Select Case viewPort
        Case "Front"    ' X's are positive Z's are negative
            helpCorner(0) = Rhino.PointAdd(upperCorner, Array(innerWidth, 0, 0))
            helpCorner(1) = Rhino.PointAdd(upperCorner, Array(0, 0, -innerHeight))
            helpCorner(2) = Rhino.PointAdd(upperCorner, Array(innerWidth, 0, -innerHeight))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            upperCorner = Rhino.PointAdd(upperCorner, Array(-leftMargin, 0, topMargin))
            'Draw 1 inch scale box
            'helpCorner(0) = Rhino.PointAdd(helpCorner(2), Array(0, 0, 1))
            'helpCorner(1) = Rhino.PointAdd(helpCorner(2), Array(-1, 0, 0))
            'helpCorner(2) = Rhino.PointAdd(helpCorner(2), Array(-1, 0, 1))
        
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            helpCorner(0) = Rhino.pointAdd(upperCorner, Array(pageWidth, 0, 0))
            helpCorner(1) = Rhino.pointAdd(upperCorner, Array(0, 0, -pageHeight))
            helpCorner(2) = Rhino.pointAdd(upperCorner, Array(pageWidth, 0, -pageHeight))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        Case "Right"    ' Y's are positive Z's are negative
            helpCorner(0) = Rhino.PointAdd(upperCorner, Array(0, innerWidth, 0))
            helpCorner(1) = Rhino.PointAdd(upperCorner, Array(0, 0, -innerHeight))
            helpCorner(2) = Rhino.PointAdd(upperCorner, Array(0, innerWidth, -innerHeight))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            upperCorner = Rhino.PointAdd(upperCorner, Array(0, -leftMargin, topMargin))
            'Draw 1 inch scale box
            'helpCorner(0) = Rhino.PointAdd(helpCorner(2), Array(0, 0, 1))
            'helpCorner(1) = Rhino.PointAdd(helpCorner(2), Array(0, -1, 0))
            'helpCorner(2) = Rhino.PointAdd(helpCorner(2), Array(0, -1, 1))
        
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            helpCorner(0) = Rhino.pointAdd(upperCorner, Array(0, pageWidth, 0))
            helpCorner(1) = Rhino.pointAdd(upperCorner, Array(0, 0, -pageHeight))
            helpCorner(2) = Rhino.pointAdd(upperCorner, Array(0, pageWidth, -pageHeight))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        Case Else    ' X's are positive Y's are negative
            helpCorner(0) = Rhino.PointAdd(upperCorner, Array(innerWidth, 0, 0))
            helpCorner(1) = Rhino.PointAdd(upperCorner, Array(0, -innerHeight, 0))
            helpCorner(2) = Rhino.PointAdd(upperCorner, Array(innerWidth, -innerHeight, 0))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            upperCorner = Rhino.PointAdd(upperCorner, Array(-leftMargin, topMargin, 0))
            'Draw 1 inch scale box
            'helpCorner(0) = Rhino.PointAdd(helpCorner(2), Array(0, 1, 0))
            'helpCorner(1) = Rhino.PointAdd(helpCorner(2), Array(-1, 0, 0))
            'helpCorner(2) = Rhino.PointAdd(helpCorner(2), Array(-1, 1, 0))
        
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            'Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
        
            helpCorner(0) = Rhino.pointAdd(upperCorner, Array(pageWidth, 0, 0))
            helpCorner(1) = Rhino.pointAdd(upperCorner, Array(0, -pageHeight, 0))
            helpCorner(2) = Rhino.pointAdd(upperCorner, Array(pageWidth, -pageHeight, 0))
        
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(upperCorner, helpCorner(1)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(0)), boundaryLines)
            Call Rhino.AddObjectToGroup(Rhino.AddLine(helpCorner(2), helpCorner(1)), boundaryLines)
    End Select
    
Rhino.EnableRedraw(True)
End Sub

Rhino.AddAlias "UniversalPrintableArea", "_NoEcho _-RunScript (UniversalPrintableArea)"
You could modify the topMargin, leftMargin, rightMargin, bottomMargin, pageHeight, and pageWidth values to suit your specifications though. I added it as a default script to load on Rhino startup, that way the command is always available to me regardless of what I'm working on.
__________________
Papersmith Forge - Mig
Reply With Quote
Reply

Tags
pdf, printer, rhino, rhinoscript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)
Copyright © 2007-2023, PaperModelers.com