As an exercise I've created some rows boxes that would fit 8.5 x 11 inch paper
My issue is that when I open the svg in Illustrator the scaling is way down very small.(Illustrator art board set to 8.5 x 11 inches)
In the hip I set up preference to inches and create the boxes accordingly.
I changed the python from the tut to be ‘hardwired’ for 8.5 x 11.
So I am wondering if someone that's good with python could show me what I did wrong, or suggest how to get the scaling?
I can do a manual scaling to get it to fit, but would like to be able to code it.
node = hou.pwd() geo = node.geometry() # Add code to modify contents of geo. # Use drop down menu to select examples. filename = node.evalParm('file_name') stroke_width = node.evalParm('stroke_width') box = geo.boundingBox() minv = box.minvec() size = box.sizevec() width = 8.5 height = 11 def write_path(fp, points): if not points: return data = 'M{} {} '.format(points[0].x(), points[0].y()) for p in points[1:]: data += 'L{} {} '.format(p.x(), p.y()) fp.write('<path d="{}" stroke="black" stroke-width="{}pxy" fill="none"/>\n'.format(data, stroke_width)) with open(filename, 'w') as fp: fp.write('<?xml version="1.0" standalone="no"?>\n') fp.write('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n') fp.write('<svg width="8.5in" height="11in" version="1.1" xmlns="http://www.w3.org/2000/svg">\n') for prim in geo.iterPrims(): if prim.type() != hou.primType.Polygon: continue points = [v.point().position() for v in prim.vertices()] write_path(fp, points) fp.write('</svg>')