[OpenSCAD] evenly cutting two curves to make surfaces

Neon22 mschafer at wireframe.biz
Sun Sep 6 23:00:36 EDT 2015


I am sorry I cannot make myself understood. I am prepared to make the curve
in any way at all if I can get the end result.
In the interests of continued discussion here is a sample below.
Two curves exported from Inkscape and - here - shown as rotate_extrudes.

However the result I am looking for would have these two curves alternating
around the circumference of the rotated volume. Wavy, then smooth, then
wavy, then smooth, etc...
The resulting volume would have smooth and wavy sections in a single volume.

//
wavy_points =
[[-74.350520,-315.826595],[-66.629180,-315.108485],[-61.646323,-314.561548],[-56.010858,-313.760231],[-49.794423,-312.607689],[-43.068656,-311.007077],[-35.905194,-308.861551],[-28.375676,-306.074266],[-24.496033,-304.409701],[-20.551740,-302.548378],[-16.551752,-300.478194],[-12.505023,-298.187043],[-8.420509,-295.662818],[-4.307163,-292.893415],[-0.173942,-289.866728],[3.970201,-286.570651],[8.116311,-282.993078],[12.255433,-279.121905],[16.378612,-274.945025],[20.476893,-270.450334],[24.541322,-265.625724],[28.562945,-260.459092],[32.532806,-254.938330],[36.441950,-249.051335],[38.136582,-246.692439],[40.156640,-244.292852],[44.695745,-239.372400],[46.976145,-236.851932],[49.104680,-234.291568],[50.962026,-231.691506],[52.428860,-229.051945],[52.935914,-227.717414],[53.243471,-226.373083],[53.378838,-225.018977],[53.369319,-223.655120],[53.024847,-220.898253],[52.428500,-218.102681],[51.798722,-215.268603],[51.353956,-212.396217],[51.312648,-209.485722],[51.511553,-208.016245],[51.893240,-206.537315],[52.456864,-205.096561],[53.168470,-203.733329],[54.946167,-201.189858],[57.047401,-198.807760],[59.293245,-196.487887],[61.504769,-194.131098],[63.503043,-191.638245],[65.109140,-188.910186],[65.709206,-187.426971],[66.144130,-185.847775],[66.370434,-184.202428],[66.379413,-182.530689],[66.200854,-180.835068],[65.864548,-179.118072],[64.837849,-175.629992],[63.537629,-172.086515],[62.202199,-168.507710],[61.069872,-164.913643],[60.378962,-161.324382],[60.273510,-159.537825],[60.367780,-157.759995],[60.700666,-155.944968],[61.268016,-154.051793],[62.966968,-150.070833],[65.186366,-145.896786],[67.647938,-141.609328],[70.073410,-137.288129],[72.184513,-133.012864],[73.035215,-130.917354],[73.702973,-128.863205],[74.153003,-126.860375],[74.350520,-124.918825],[74.281851,-123.007120],[73.978027,-121.087203],[73.471320,-119.159099],[72.794003,-117.222834],[71.056629,-113.325916],[69.024086,-109.396649],[66.954556,-105.435230],[65.106219,-101.441860],[64.345680,-99.433254],[63.737257,-97.416735],[63.313223,-95.392327],[63.105850,-93.360055],[63.165211,-91.300901],[63.493360,-89.199163],[64.050548,-87.059833],[64.797023,-84.887903],[66.698828,-80.466208],[68.880766,-75.974016],[71.024828,-71.451262],[72.813004,-66.937882],[73.474257,-64.697187],[73.927284,-62.473811],[74.132336,-60.272746],[74.049660,-58.098985],[73.719394,-55.955863],[73.223069,-53.840094],[71.821592,-49.670846],[70.023938,-45.551701],[68.008811,-41.443121],[65.954920,-37.305567],[64.040970,-33.099501],[62.445667,-28.785383],[61.823355,-26.575449],[61.347720,-24.323675],[57.874046,-5.905632],[53.765900,12.950570],[49.016170,32.232222],[43.617744,51.926614],[37.563509,72.021035],[30.846353,92.502776],[23.459165,113.359128],[15.394831,134.577379],[6.646241,156.144820],[-2.793720,178.048741],[-12.932161,200.276433],[-23.776197,222.815185],[-35.332938,245.652287],[-47.609498,268.775029],[-60.612988,292.170702],[-74.350520,315.826595]];

smooth_points =
[[-71.899238,-315.826600],[-64.177899,-315.108490],[-59.195041,-314.561553],[-53.559576,-313.760236],[-47.343141,-312.607694],[-40.617373,-311.007082],[-33.453912,-308.861556],[-25.924393,-306.074271],[-22.044750,-304.409706],[-18.100457,-302.548383],[-14.100468,-300.478199],[-10.053739,-298.187048],[-5.969224,-295.662823],[-1.855879,-292.893420],[2.277343,-289.866733],[6.421487,-286.570656],[10.567597,-282.993083],[14.706720,-279.121910],[18.829899,-274.945030],[22.928181,-270.450339],[26.992612,-265.625729],[31.014235,-260.459097],[34.984096,-254.938335],[38.893242,-249.051340],[41.813186,-244.292856],[44.603850,-239.372404],[47.264346,-234.291572],[49.793783,-229.051949],[52.191273,-223.655124],[54.455927,-218.102685],[56.586856,-212.396222],[58.583171,-206.537323],[60.443983,-200.527576],[62.168403,-194.368571],[63.755541,-188.061896],[65.204509,-181.609141],[66.514418,-175.011893],[67.684378,-168.271741],[68.713501,-161.390275],[69.600898,-154.369082],[70.345679,-147.209752],[70.946956,-139.913874],[71.403839,-132.483036],[71.715440,-124.918827],[71.899238,-109.396651],[71.491238,-93.360055],[70.484328,-76.821750],[68.871394,-59.794445],[66.645326,-42.290851],[63.799010,-24.323678],[60.325335,-5.905634],[56.217189,12.950569],[51.467458,32.232221],[46.069031,51.926613],[40.014796,72.021035],[33.297641,92.502777],[25.910452,113.359129],[17.846119,134.577381],[9.097528,156.144823],[-0.342432,178.048745],[-10.480874,200.276437],[-21.324910,222.815189],[-32.881653,245.652291],[-45.158213,268.775034],[-58.161704,292.170707],[-71.899238,315.826600]];

profile_scale = 25.4/90; //made in inkscape in mm
Faceted = 42;
Delta = 0.1;
//
function min_x(shape_points) = min([ for (x = shape_points) min(x[0])]);
function max_x(shape_points) = max([ for (x = shape_points) max(x[0])]);
function min_y(shape_points) = min([ for (x = shape_points) min(x[1])]);
function max_y(shape_points) = max([ for (x = shape_points) max(x[1])]);

//
echo(str("wavy=",len(wavy_points)));
echo(str("smooth=",len(smooth_points)));

module build_rotated(shape_points, new_height, new_width)  {
	minx = min_x(shape_points)* profile_scale;
	maxx = max_x(shape_points)* profile_scale;
	p_width = (maxx - minx);
	miny = min_y(shape_points) * profile_scale;
	maxy = max_y(shape_points) * profile_scale;
	p_height = maxy-miny;
	y_scale = new_height/p_height;
	x_scale = new_width /(p_width*2);
	rotate_extrude($fn=Faceted, convexity = 8) {
		scale([x_scale,y_scale])
		// add 0.1 so there is tiny hole in middle so F6 works
		translate([-minx+Delta, maxy]) // scale profile
		scale([profile_scale, -profile_scale])
			polygon(shape_points);
		
	}
	// fill in tiny offset hole to ensure F6 works
	fix_start = shape_points[0][1] * profile_scale;
	fix_end = shape_points[len(shape_points)-1][1] * profile_scale;
	echo(shape_points[0],fix_start, fix_end);
	translate([0,0,y_scale*(-fix_end+maxy)])
		cylinder(h=y_scale*(fix_end-fix_start), r=0.2+Delta*y_scale, $fn=Faceted);
// 
}

// shown here two rotate_extrudes , one of each shape_points
// However we want to make a surface with alternating vertical profiles of
the two polygons.
build_rotated(wavy_points, 100, 30);
translate([40,0,0])
	build_rotated(smooth_points, 100, 30);
	




--
View this message in context: http://forum.openscad.org/evenly-cutting-two-curves-to-make-surfaces-tp13702p13720.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list