<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[SoliForum - 3D Printing Community — Problem using SCAD file]]></title>
	<link rel="self" href="https://www.soliforum.com/feed/atom/topic/13726/" />
	<updated>2016-02-14T16:34:28Z</updated>
	<generator>PunBB</generator>
	<id>https://www.soliforum.com/topic/13726/problem-using-scad-file/</id>
		<entry>
			<title type="html"><![CDATA[Problem using SCAD file]]></title>
			<link rel="alternate" href="https://www.soliforum.com/post/116489/#p116489" />
			<content type="html"><![CDATA[<p>I am having a problem trying to gett a scad file to work</p><p>I have a directory on my desktop named SCAD that I put all the scad files in for easy access.<br />I am trying to use a lithophane scad file but I can not get the photo to load in it.<br />I put the photo in the scad directory</p><p>here is the scad file.<br />use &lt;utils/build_plate.scad&gt;<br />use &lt;write/Write.scad&gt;</p><p>// preview[view:south, tilt:top]</p><p>/* [Image] */</p><p>// Standard is 4:3 aspect ratio, HD is 16:9<br />picture_shape = &quot;standard&quot;; // [square:Square, standard:Standard Photo, hd:HD Wide]</p><p>picture_orientation = &quot;horizontal&quot;; // [horizontal, vertical]</p><p>// Chose small for a quick, less detailed print<br />pane_size = &quot;large&quot;; // [large, small]</p><p>// Simple photos with many shades of light/dark areas work best. Don&#039;t forget to click the Invert Colors checkbox!<br />image_file = &quot;image-surface.dat&quot;; // [image_surface:100x100]</p><p>/* [Adjustments] */</p><p>include_hole = &quot;yes&quot;; // [yes, no]<br />hole_diameter = 10;</p><p>// What layer height will you slice this at?&nbsp; The thinner the better.<br />layer_height = 0.2;</p><p>// The lower the layer height, the more layers you can use.<br />number_of_layers = 12; // [8:20]</p><p>/* [Text] */</p><p>text_line_1 = &quot;&quot;;<br />text_line_2 = &quot;&quot;;<br />text_line_3 = &quot;&quot;;<br />text_line_4 = &quot;&quot;;<br />text_line_5 = &quot;&quot;;</p><p>text_size = 10;<br />text_vertical_position = 0; // [-80:80]</p><p>// In case you like viewing the lithopane from the other side<br />text_reverse = &quot;no&quot;; // [no, yes]</p><p>/* [Hidden] */</p><p>// base (white) will always be 2 layers thick<br />min_layer_height = layer_height*2;<br />hole_radius = hole_diameter/2;<br />height = layer_height*number_of_layers;</p><p>//for display only, doesn&#039;t contribute to final object<br />build_plate_selector = 0; //[0:Replicator 2, 1:Replicator, 2:Thingomatic, 3:Manual]</p><p>//when Build Plate Selector is set to &quot;manual&quot; this controls the build plate x dimension<br />build_plate_manual_x = 100; //[100:400]</p><p>//when Build Plate Selector is set to &quot;manual&quot; this controls the build plate y dimension<br />build_plate_manual_y = 100; //[100:400]</p><p>preview_tab = &quot;&quot;;</p><p>build_plate(build_plate_selector,build_plate_manual_x,build_plate_manual_y);</p><p>if (picture_shape == &quot;square&quot;) {<br />&nbsp; if (pane_size == &quot;large&quot;) {<br />&nbsp; &nbsp; lithopane(100, 100, 1, 1);<br />&nbsp; } else {<br />&nbsp; &nbsp; lithopane(50, 50, 0.5, 0.5);<br />&nbsp; }<br />} else if (picture_shape == &quot;standard&quot;) {<br />&nbsp; if (picture_orientation == &quot;horizontal&quot;) {<br />&nbsp; &nbsp; if (pane_size == &quot;large&quot;) {<br />&nbsp; &nbsp; &nbsp; lithopane(133, 100, 4/3, 1);<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; lithopane(133/2, 100/2, (4/3)/2, 1/2);<br />&nbsp; &nbsp; }<br />&nbsp; } else {<br />&nbsp; &nbsp; if (pane_size == &quot;large&quot;) {<br />&nbsp; &nbsp; &nbsp; rotate([0,0,90]) lithopane(100, 133, 1, 4/3);<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; rotate([0,0,90]) lithopane(100/2, 133/2, 1/2, (4/3)/2);<br />&nbsp; &nbsp; }<br />&nbsp; }<br />} else if (picture_shape == &quot;hd&quot;) {<br />&nbsp; if (picture_orientation == &quot;horizontal&quot;) {<br />&nbsp; &nbsp; if (pane_size == &quot;large&quot;) {<br />&nbsp; &nbsp; &nbsp; lithopane(177, 100, 16/9, 1);<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; lithopane(177/2, 100/2, (16/9)/2, 1/2);<br />&nbsp; &nbsp; }<br />&nbsp; } else {<br />&nbsp; &nbsp; if (pane_size == &quot;large&quot;) {<br />&nbsp; &nbsp; &nbsp; rotate([0,0,90]) lithopane(100, 177, 1, 16/9);<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; rotate([0,0,90]) lithopane(100/2, 177/2, 1/2, (16/9)/2);<br />&nbsp; &nbsp; }<br />&nbsp; }<br />}</p><p>module lithopane(length, width, x_scale, y_scale) {<br />&nbsp; union() {<br />&nbsp; &nbsp; // take just the part of surface we want<br />&nbsp; &nbsp; difference() {<br />&nbsp; &nbsp; &nbsp; translate([0, 0, min_layer_height]) scale([x_scale,y_scale,height]) surface(file=image_file, center=true, convexity=5);<br />&nbsp; &nbsp; &nbsp; translate([0,0,-(height+min_layer_height)]) linear_extrude(height=height+min_layer_height) square([length, width], center=true);<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; linear_extrude(height=layer_height*2) square([length+4, width+4], center=true);</p><p>&nbsp; &nbsp; linear_extrude(height=height+min_layer_height) {<br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;difference() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;union() {<br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;square([length+4, width+4], center=true);<br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (include_hole == &quot;yes&quot;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; translate([0, width/2+hole_radius+2, 0]) circle(r=hole_radius+5);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp; union() {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square([length, width], center=true);<br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (include_hole == &quot;yes&quot;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; translate([0, width/2+hole_radius+2, 0]) circle(r=hole_radius);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;}<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; // add optional text<br />&nbsp; &nbsp; rotate_text() translate([0, text_vertical_position, height/2]) union() {<br />&nbsp; &nbsp; &nbsp; translate([0, 30, 0])&nbsp; write(text_line_1, t=height, h=text_size, center=true);<br />&nbsp; &nbsp; &nbsp; translate([0, 15, 0])&nbsp; write(text_line_2, t=height, h=text_size, center=true);<br />&nbsp; &nbsp; &nbsp; translate([0, 0, 0])&nbsp; &nbsp;write(text_line_3, t=height, h=text_size, center=true);<br />&nbsp; &nbsp; &nbsp; translate([0, -15, 0]) write(text_line_4, t=height, h=text_size, center=true);<br />&nbsp; &nbsp; &nbsp; translate([0, -30, 0]) write(text_line_5, t=height, h=text_size, center=true);<br />&nbsp; &nbsp; }<br />&nbsp; }<br />}</p><p>module rotate_text() {<br />&nbsp; if (text_reverse == &quot;yes&quot;) {<br />&nbsp; &nbsp; translate([0, 0, height]) rotate([0, 180, 0]) child(0);<br />&nbsp; } else {<br />&nbsp; &nbsp; translate([0, 0, 0]) rotate([0, 0, 0]) child(0);<br />&nbsp; }<br />} here is a copy of the .Jpg file I am trying to print</p>]]></content>
			<author>
				<name><![CDATA[dubbsd]]></name>
				<uri>https://www.soliforum.com/user/187/</uri>
			</author>
			<updated>2016-02-14T16:34:28Z</updated>
			<id>https://www.soliforum.com/post/116489/#p116489</id>
		</entry>
</feed>
