<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Jan 26, 2014]]></title><description><![CDATA[<p dir="auto">Roger Clark<br />
Hi I'm a complete noob to OpenJSCad but am quite familiar with OpenSCad.</p>
<p dir="auto">Anyway, can someone explain to me why I can't use 2D primitives like Circle with solidFromSlices</p>
<p dir="auto">e.g. This demo generates a polygon inside the callback</p>
<p dir="auto">var thing = flatBottom.solidFromSlices({<br />
numslices: height<br />
,callback: function(t) {<br />
var coef = t;<br />
var h = height * t;<br />
return CSG.Polygon.createFromPoints([<br />
[-radius, -radius, h],<br />
[radius, -radius, h],<br />
[radius * coef, radius, h],<br />
[-radius * coef, radius, h]<br />
]).rotate([0,0,0], [0,0,1], 0);<br />
}<br />
});</p>
<p dir="auto">and it works fine</p>
<p dir="auto">but I can't replace the</p>
<p dir="auto">CSG.Polygon.createFromPoints([<br />
[-radius, -radius, h],<br />
[radius, -radius, h],<br />
[radius * coef, radius, h],<br />
[-radius * coef, radius, h]<br />
]).rotate([0,0,0], [0,0,1], 0);</p>
<p dir="auto">with<br />
CAG.circle({center: [0,0], radius: 20, resolution: 50});</p>
<p dir="auto">well, if I do, I don't get anything in the render <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--disappointed" title=":-(" alt="😞" /></p>
<p dir="auto">I actually want to dynamically create each slice based on an algorithm, but I prefer to understand the basics before attempting anything complex <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--wink" title=";-)" alt="😉" /></p>
]]></description><link>https://openjscad.nodebb.com/topic/15/jan-26-2014</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Mar 2026 15:09:46 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/15.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Apr 2019 06:21:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Jan 26, 2014 on Sat, 06 Apr 2019 06:24:13 GMT]]></title><description><![CDATA[<p dir="auto">Roger Clark<br />
Thanks Eduard for the link to the voronoi sphere</p>
<p dir="auto">I've been looking at stuff like <a href="http://toxiclibs.org/2011/12/metworks-workshop-facade/" rel="nofollow ugc">http://toxiclibs.org/2011/12/metworks-workshop-facade/</a><br />
and also Radiolarians<br />
e.g.<br />
<a href="http://i.materialise.com/gallery/radiolarian-lamp" rel="nofollow ugc">http://i.materialise.com/gallery/radiolarian-lamp</a></p>
<p dir="auto">which can be generated proceduarlly</p>
]]></description><link>https://openjscad.nodebb.com/post/41</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/41</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 06 Apr 2019 06:24:13 GMT</pubDate></item><item><title><![CDATA[Reply to Jan 26, 2014 on Sat, 06 Apr 2019 06:23:53 GMT]]></title><description><![CDATA[<p dir="auto">Roger Clark's profile photo<br />
Roger Clark<br />
Thanks Eduard</p>
<p dir="auto">Sorry about the typo on CAG.Circle rather than CSG.Circle</p>
<p dir="auto">OK about slices not all needing to be in the same XY (etc)  plane.</p>
<p dir="auto">Re: Difference 2 shapes created by solidFromSlices</p>
<p dir="auto">I was just coming to that conclusion myself <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--wink" title=";-)" alt="😉" /></p>
<p dir="auto">Currently I'm still trying to work out the correct tools for the job, as I want to create organic looking shapes, so was hoping to build them from procedural generated shapes, which includes having holes in them.</p>
<p dir="auto">I was going to use OpenSCAD, but it doesnt let you get at the mesh and also doesn't do smoothing AFIK.</p>
<p dir="auto">I've also looked at "Processing" the Java based IDE system that has a lot of 3D libraries.</p>
<p dir="auto">But I'm still not sure which system is most applicable.</p>
<p dir="auto">In terms of using OpenJSCad I think I'll have  ago at unioning some slices (of objects with holes in them)</p>
<p dir="auto">Thanks</p>
<p dir="auto">Roger</p>
]]></description><link>https://openjscad.nodebb.com/post/40</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/40</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 06 Apr 2019 06:23:53 GMT</pubDate></item><item><title><![CDATA[Reply to Jan 26, 2014 on Sat, 06 Apr 2019 06:23:18 GMT]]></title><description><![CDATA[<p dir="auto">Roger Clark<br />
Thanks Eduard</p>
<p dir="auto">What I'd actually like to do is create a polygon with a hollow center, i.e tube in cross section.</p>
<p dir="auto">Then create an object by lofting the tube down a path, which is basically what solidfromslices does.</p>
<p dir="auto">However I'm not entirely sure how to create the slices like this.</p>
<p dir="auto">I was initially hoping I could do it by taking a large circle and subtracting a small circle from inside it, to form the tube like cross section, but solidfromslices doesn't seem to accept a ploygon other than one made of distinct points e.g. using CSG.Polygon.createFromPoints</p>
<p dir="auto">I'm going to download the source code for openjscad and look at the class heirarchy to work out why solidfromslices accepts a poly created with CSG.Polygon.createFromPoints and not from CSG.Circle</p>
<p dir="auto">Perhaps there is a CSG.Circle.getPolygon etc, however I've not come across any API docs that list all the methods on all objects<br />
Do you know if full API docs exist ??</p>
<p dir="auto">Thanks</p>
<p dir="auto">Roger</p>
]]></description><link>https://openjscad.nodebb.com/post/39</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/39</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 06 Apr 2019 06:23:18 GMT</pubDate></item><item><title><![CDATA[Reply to Jan 26, 2014 on Sat, 06 Apr 2019 06:22:30 GMT]]></title><description><![CDATA[<p dir="auto">Roger Clark<br />
Thanks Eduard</p>
<p dir="auto">I took another look in my code and there was a bug in the for loop that generated the points.</p>
<p dir="auto">It now works OK.</p>
<p dir="auto">Its just a hacked version of the "three to four" example (I've pasted the code below)</p>
<p dir="auto">What I was hoping to do was to generate much more complex slices, based  no normal 2D primitives, and use union and subtraction etc,<br />
but as even the basic circle, doesn't seem to work, its going to be a load of extra coding if I have to do everything at the vertex level in the code, (and beyond my math's ability <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--wink" title=";-)" alt="😉" /></p>
<p dir="auto">// title: Three to four (sides)<br />
// author: Eduard Bespalov<br />
// license: MIT License<br />
// description: testing solidFromSlices()</p>
<p dir="auto">function getParameterDefinitions() {<br />
return [<br />
{ name: 'radius', caption: 'Radius:', type: 'float', default: 10 },<br />
{ name: 'height', caption: 'Height:', type: 'float', default: 35 },<br />
{ name: 'twist', caption: 'Twist:', type: 'int', default: 90}<br />
];<br />
}</p>
<p dir="auto">function main(params) {<br />
var thing = thingTwisted(params.radius, params.height, params.twist);<br />
return thing;<br />
}</p>
<p dir="auto">function thingTwisted(radius, height, twistangle) {<br />
twistangle = twistangle || 0;</p>
<pre><code>    var flatBottom = CSG.Polygon.createFromPoints([
            [-radius, -radius, 0],
    [radius, -radius, 0],
    [radius, radius, 0]
    ]);

    var glob=3;// hack to see if we can change the number of points per slice
var thing = flatBottom.solidFromSlices({
    numslices: height
    ,callback: function(t) {
            var coef = t;
            var h = height * t;

            var circ = [];
            var circ2 = [];
            for(var i=0;i&lt;2*Math.PI;i+=Math.PI/Math.floor(glob))
            {
                circ.push([Math.sin(i)*10,Math.cos(i)*10,h]);
                circ2.push([Math.sin(i)*9,Math.cos(i)*9,h]);
                
            }
            glob+=1;//0.5;
            /* NOT USED
            var retval1=CSG.Polygon.createFromPoints([
                    [-radius, -radius, h],
                    [radius, -radius, h],
                     [radius * coef, radius, h],
                    [-radius * coef, radius, h]
            ]);
            */
            
            retval = CSG.Polygon.createFromPoints( circ);
            
            //DOESNT WORK --  retval = CAG.circle({center: [0,0], radius: 3, resolution: 32}).translate([0,0,h]);// Doesnt work
            
            return retval;
    }
</code></pre>
<p dir="auto">});<br />
return thing;<br />
}</p>
]]></description><link>https://openjscad.nodebb.com/post/38</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/38</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 06 Apr 2019 06:22:30 GMT</pubDate></item><item><title><![CDATA[Reply to Jan 26, 2014 on Sat, 06 Apr 2019 06:21:50 GMT]]></title><description><![CDATA[<p dir="auto">Roger Clark<br />
Thanks Derrick,</p>
<p dir="auto">It works if I generate the polygon of a circle in code e.g using sin and cos.</p>
<p dir="auto">I've not looked at the class hierarchy but I presumed that circle was a type of polygon, so I couldn't see why it wouldn't work, but perhaps its not.</p>
<p dir="auto">I was also hoping that each slice didn't need to have the same number of vertices, but if I change the number of vertices in each slice, it doesn't work either <img src="https://openjscad.nodebb.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=k4h1pp0pk3c" class="not-responsive emoji emoji-android emoji--disappointed" title=":-(" alt="😞" /></p>
<p dir="auto">To be honest, it looks like openscad isn't suited for what I'm trying to achieve, and I may try Processing 3D instead</p>
]]></description><link>https://openjscad.nodebb.com/post/37</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/37</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Sat, 06 Apr 2019 06:21:50 GMT</pubDate></item></channel></rss>