teepee changed the topic of #openscad to: OpenSCAD - The Programmers Solid 3D CAD Modeller | This channel is logged! | Website: http://www.openscad.org/ | FAQ: https://goo.gl/pcT7y3 | Request features / report bugs: https://goo.gl/lj0JRI | Tutorial: https://bit.ly/37P6z0B | Books: https://bit.ly/3xlLcQq | FOSDEM 2020: https://bit.ly/35xZGy6 | Logs: https://bit.ly/32MfbH5
<InPhase> I'm not sure what you picture for "objects that describe CSG trees".
<JordanBrown> I'm not exactly, either; I was just about to start trying to write that out.
<JordanBrown> But the idea would be an object structure that would be interpreted as a CSG tree.
<JordanBrown> Perhaps, for instance, a typical node would look like
<JordanBrown> { op = "square"; arguments={ size = [10,10]; center=false } }
<JordanBrown> and a more complex structure might look like
<JordanBrown> { op = "linear_extrude"; arguments={ height=10; center=true}; children=[ { op = "square"; arguments={ size = [10,10]; center=false } } ] }
<JordanBrown> That is, the general form of a node would be an object with three members: op, the operation name, arguments, the object describing the arguments to the operation, and children, an array containing child nodes.
<JordanBrown> I'd like to figure out how to make it a little less verbose, but I haven't really tried yet.
<JordanBrown> If you had o = { cube(10); };
<JordanBrown> then maybe the result would be
<JordanBrown> { op = "cube"; args= {size=[10,10,10]; center=false;}}
<JordanBrown> or maybe it would always have an explicit union node at the top
<JordanBrown> or maybe the top would be an array that would be an implicit union.
<JordanBrown> I think not the last, because I think you'd want to be able to construct one of these and use a previously-created one as one of the children.
<JordanBrown> sq = { square(10); };
<JordanBrown> le = { op = "linear_extrude"; args = {...}; children=[sq] };
<JordanBrown> Hypothesizing an add() operation that adds the specified CSG-tree-object to the current CSG tree (which might or might not be the CSG tree that is the final model), you might also say:
<JordanBrown> le = { linear_extrude() add(sq); };
<JordanBrown> I should note that some of this I've thought about over time, and some of it is design-on-the-fly right now.
<JordanBrown> Does that all sort of make sense?
<teepee> no, what is that supposed to do?
ur5us has quit [Ping timeout: 244 seconds]
<JordanBrown> It allows you to use a bunch of geometry construction operations to build up a data structure that you could introspect.
<teepee> and how is: cube(10); wrong?
<JordanBrown> cube(10) doesn't yield a data item.
<JordanBrown> cube(10) always adds to the model.
<JordanBrown> (Today, that is.)
<JordanBrown> And then as a second step, you could call render(o) on one of them, and it would yield some sort of structure that would described the rendered output. Perhaps it would be triangle soup, but preferably it would be something that describes vertexes and faces and maybe colors.
<JordanBrown> So render({cube(10);}) would yield a data structure that describes eight vertexes and six faces.
Furor is now known as Colere
Colere has quit [Remote host closed the connection]
<JordanBrown> Note, for instance, that one of the questions we get asked is "how do I have a module return not just geometry but also some information about the geometry?".
<JordanBrown> { size = [10,10,10]; cube(size); } would be a data item that has both some information about the cube and the cube itself.
<JordanBrown> And, remembering that a lot of this is design-on-the-fly rather than fully thought out, I don't yet know how the object returned would include *both* the values *and* the geometry. Perhaps there is a reserved element for containing the geometry, so that that example would have o.size and
<JordanBrown> o.geometry.
<JordanBrown> where o.geometry is a CSG tree as described above.
LordOfBikes has quit [Ping timeout: 268 seconds]
J1A8412 has joined #openscad
LordOfBikes has joined #openscad
J1A84 has quit [Ping timeout: 252 seconds]
noonien has quit [Ping timeout: 260 seconds]
ur5us has joined #openscad
Colere has joined #openscad
gunnbr_ has joined #openscad
othx has quit [Ping timeout: 252 seconds]
othx has joined #openscad
gunnbr has quit [Ping timeout: 268 seconds]
sinned69152 has joined #openscad
sinned6915 has quit [Ping timeout: 264 seconds]
sinned69152 is now known as sinned6915
gunnbr__ has joined #openscad
gunnbr_ has quit [Ping timeout: 260 seconds]
teepee has quit [*.net *.split]
TheAssassin has quit [*.net *.split]
fling has quit [*.net *.split]
aiyion has quit [*.net *.split]
califax has quit [*.net *.split]
fling has joined #openscad
aiyion has joined #openscad
TheAssassin has joined #openscad
califax has joined #openscad
teepee has joined #openscad
TheAssassin has quit [Ping timeout: 258 seconds]
fling has quit [Ping timeout: 258 seconds]
fling_ has joined #openscad
TheAssassin has joined #openscad
fling_ is now known as fling
fling_ has joined #openscad
fling has quit [Ping timeout: 258 seconds]
fling_ is now known as fling
<gbruno> [github] revarbat opened pull request #4337 (Added object() function to make an object from arguments.) https://github.com/openscad/openscad/pull/4337
aiyion has quit [Remote host closed the connection]
aiyion has joined #openscad
ur5us has quit [Ping timeout: 255 seconds]
ecraven- is now known as ecraven
lastrodamo has joined #openscad
la1yv_j has quit [Read error: Connection reset by peer]
la1yv_j has joined #openscad
teepee has quit [Remote host closed the connection]
teepee has joined #openscad
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
ur5us has joined #openscad
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
TheAssass1n has joined #openscad
TheAssassin has quit [Remote host closed the connection]
la1yv has joined #openscad
qeed has joined #openscad
qeed__ has quit [Ping timeout: 260 seconds]
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
teepee_ has joined #openscad
teepee has quit [Ping timeout: 258 seconds]
teepee_ is now known as teepee
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] Parkinbot opened issue #4338 (Hide Viewport-Control checkmark not maintained when closing float window) https://github.com/openscad/openscad/issues/4338
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
<gbruno> [github] kwikius edited issue #4336 (Feature request: alias-module) https://github.com/openscad/openscad/issues/4336
TheAssass1n has quit [Remote host closed the connection]
TheAssassin has joined #openscad
ur5us has quit [Ping timeout: 244 seconds]
<gbruno> [github] Parkinbot opened issue #4339 (Animation window: several issues) https://github.com/openscad/openscad/issues/4339
ghee has joined #openscad
<InPhase> JordanBrown: So that notion is actually somewhat limiting on future development.
<InPhase> JordanBrown: Part of the lazy union work was based on the notion that we could go ahead and rearrange geometries with equivalent output transformations and get some optimization that way. Also the CSG product that we get displayed is doing the same sort of thing, rearranging content from its original syntactic form. I'm not sure if we want to preserve a CSG tree for reflection perusal to that detail.
<InPhase> I kind of like the notion that a geometry is an output produced by a black box, and there's a wall there where you can see the output, but the black box can be refactored.
<InPhase> Currently the exception to that is children() which provides a one-layer deep syntactic perusal, but it fails immediately at for loops. However we're already on path to fix that, as for example you could replace a geometric for loop with a list comprehension for loop with N geometries in it when you want to explicitly expose that list of components.
<InPhase> So we don't really need to add in syntax and semantics for browsing an entire syntactically matched CSG tree when we're empowering the code writer to expose structures of geometry with a clean implementer-chosen API like this, where they can structure the exposed elements into lists or as render() generated object values.
teepee has quit [Ping timeout: 258 seconds]
teepee has joined #openscad
TheAssassin has quit [Remote host closed the connection]
fling has quit [Remote host closed the connection]
TheAssassin has joined #openscad
fling has joined #openscad
othx has quit [Read error: Connection reset by peer]
othx has joined #openscad
teepee_ has joined #openscad
teepee has quit [Ping timeout: 258 seconds]
teepee_ is now known as teepee
epony has quit [Remote host closed the connection]
snaked has quit [Ping timeout: 268 seconds]
qeed_ has joined #openscad
qeed has quit [Ping timeout: 268 seconds]
rvt has quit [Ping timeout: 268 seconds]
rvt has joined #openscad
aisa has joined #openscad
lastrodamo has quit [Quit: Leaving]
<aisa> hi all! first time openscad user here -- I'm trying to model a ring, like one cut from a pipe, but I want the cut to be sine wave that goes around the circumference, if that makes sense
<aisa> I've looked into building a polyhedron with a for loop, but that seems to be rather tedius
<J1A8412> hi aisa
<aisa> any idea if there's an easier way to do this?
<aisa> J1A8412: hi :-)
<J1A8412> there are some libs that can help you .. or you like to learn
<aisa> both :-)
<J1A8412> a beginners approach  would be a chained hull
<aisa> yeah, I thought hull might do the trick
<aisa> I'm not exactly sure though, what objects I should input
<J1A8412> or lets start without the hull .. just arranging   cylinders around and move them sinoidal up and down
<J1A8412> if you want a round finish you may need to  use  spheres
<aisa> I wrote something that basically does this, but with union()
<aisa> it produces a non-smooth surface though
<aisa> using hull, however, seems to remove the hole from the ring
<J1A8412> now lets use the hull https://bpa.st/MVPA
<aisa> https://bpa.st/BNSA this is what I came up with
<J1A8412> that looks promising  so just try to apply the hull from the last to the next cylinder
<J1A8412> your   i advances by 1  so  the hull is made with the transformation  i+1
<aisa> one sec, shouldn't be too hard
<J1A8412> when using a hull you can reduce n to like 100
<J1A8412> if you want  waves that are phase shifted (180) on both sides  so your ring getting smaller and wider  you either use the spheres in my example and create a second sphere in the hull .. or in yours you can alter the cylinder height with a centered cylinder (without the translate)
<aisa> got it
<aisa> I just realized that I don't really want a sine wave, but a zig-zag
<aisa> using the hull method in this case produces some "artifacts" that wouldn't appear in the sine case
<J1A8412> here https://bpa.st/DKPA
<J1A8412> if you  use  max=4*waves;  you get the zig-zag
<aisa> I see. I need a non-rounded version, however :x
<aisa> but then the hull approach stops working
<J1A8412> just replace the sphere with a cube(center=true);
<J1A8412> or cylinder if only top sides should be flat
<aisa> that isn't producing the result I'm looking for
<J1A8412> .. a different approach would be using a tube and cutting with a  zigzag polyhedron or just overlapping  cylinders with $fn=3 or 4  that are rotated [90]
<aisa> I think for the hull approach I need objects that are placed edge-up, instead of face-up
<aisa> and rotated correctly
<J1A8412> https://pasteboard.co/gGxajq0bKyyI.png   this is not what you want?  .. what is wrong?
<aisa> the top points should be sharp, not flat
<J1A8412> just use a cube that is flat  size=[2, .1 , .1]
<J1A8412> or use a cylinder ( d1=2, d2=0);
<J1A8412> .. this looks hurtful .. Ü
<J1A8412> you can also use the spheres (.5) and place another sphere in the middle that is thicker
<aisa> the previous one with the flat cubes seems best
<J1A8412> or https://pasteboard.co/2BFfB0NSFKqZ.png  with less waves
<J1A8412> if you  create a module  Object(){cube()};   which replaces the sphere()  you can easier try different  objects by replacing them just within the module
<J1A8412> that was  a cube (size = [d,.1,.1],center=true);  instead of the sphere();
<aisa> very handy :-)
<aisa> so what if I wanted to make an analytical version of this? or this is generally not how it's done?
<J1A8412> not sure what you mean
<aisa> like my idea with a polyhedron that is essentially constructed by a formula
<aisa> this would yield ideal results
<aisa> the hull approach only produces ideal results in the limit
<J1A8412> no it doesn't .. the hull is just a way to let the polyhedron be constructed  for you
<aisa> but the hull approach has still mitered edges on top
<J1A8412> but if you like to build this  .. you use the same loop but  generate  points
<aisa> unless the cube is rotated edge-up, I assume
<J1A8412> you can  use  2 dimensional objects instead  so there would be only one edge
<aisa> can hull produce 3d objects from 2d objects?
<J1A8412> or rotate  and scale a cube so it is like a diamond shape
<J1A8412> no  but you can construct a  2D   3D polyhedron Ü
<J1A8412> however for using points you need to generate affine transformations
<J1A8412> or at least  to get the  points around a center you need to use   [cos(a)*r,sin(a)*r, z] in the loop  (where z would be your zig zag steps)
<aisa> yeah. that's what my initial code is basically doing
<J1A8412> so you create outside points and inside points .. then  you need to create the faces  and  feed that into the polyhedron
<aisa> creating faces seems tedious >:D
<J1A8412> much more work .. if you do  F12 can show you wrong aligned faces as they turn magenta
<aisa> I see
<aisa> I think I'll try hull with correctly rotated tetrahedrons
<aisa> that should produce the same result as constructing the polyhedron manually
<J1A8412> the faces will be constructed in a way hull does .. so you use 2 points from "now" and 1 point from the next step ..  (or 2 for quads)
<aisa> presummably the polyhedron would be faster than hull, right?
<J1A8412> just use the hull with  cylinder (2,d1=d,d2=0);
<J1A8412> yes and no  .. if only the polyhedron is used in render then the render is instantly but the calculation for points take longer than the internal math would need.
<J1A8412> but  if you are using  less than 500 zig-zags  it will not matter
<J1A8412> the rounded wave (not zig-zag) version with 120 steps Total rendering time: 0:00:00.054
<J1A8412> so  you really need to use this very very often to get the time for making the polyhedron back
<J1A8412> but it will be a good learning experience for other projects
<aisa> I see
foul_owl has quit [Ping timeout: 244 seconds]
<aisa> openscad has definitely a learning curve, but very much worth it :-)
* J1A8412 agrees
<J1A8412> it is math which is logical thinking of abstracts .. and programming is sort of  math on steroids
<J1A8412> if your render time is much longer you can use the  nightly versions (2022) and activate fast CSG in preferences features
<J1A8412> even with super detailed spheres the preview took 15seconds .. but the render just .176
<aisa> will do
<aisa> also, thanks for your help! :-)
<J1A8412> you are welcome ..  and if you build the polyhedron .. just build a tube and then move every %2  point  down
foul_owl has joined #openscad
<aisa> https://bpa.st/JDXA this is what I came up with, in case you're interested, J1A8412
<aisa> thanks again!
<J1A8412> looks great
<aisa> indeed :-)
<J1A8412> having the long side at the base might not be ideal
ghee has quit [Quit: EOF]
<J1A8412> if you use a smaller version for the base the edge will not over lap with the next and make a blunt end https://pasteboard.co/o6RfkEW3OrrZ.png
epony has joined #openscad
<aisa> hm. I don't follow
<J1A8412>  your object  has a 10 edge that is radial at the top but at the base tangential
gunnbr has joined #openscad
<J1A8412> if you  change the  two last points z  value to  both [… , … , height/2]
othx has quit [Ping timeout: 248 seconds]
gunnbr__ has quit [Ping timeout: 252 seconds]
othx has joined #openscad
<J1A8412> or something  height*.7  ..   bit strange to construct a polyhedron  and then rotate and translate it
<aisa> I've just added a 180deg rotation to the base object, now it's like being cut by a plane
<aisa> which is basically what I wanted :-)
<aisa> but yeah, using a hull definitely makes much more sense than constructing a polyhedron
<J1A8412>               points=   [   [0, 0, 0],   [length, 0, 0],     [length/2,0, -height],   [length/2, 0,-height]]
<J1A8412> you rotate that by 125.264.. °
snaked has joined #openscad
<InPhase> aisa: An alternative approach: https://bpa.st/DH4A
<InPhase> aisa: Then it's all one polyhedron. :)
J1A84 has joined #openscad
J1A8412 has quit [Ping timeout: 252 seconds]
<InPhase> aisa: There, simplified another step: https://bpa.st/FHAA
<InPhase> The output is as identical to yours as I could get from visual comparison.
<J1A84> InPhase .. i think you are not aware that this would be very confusing for someone that is not familiar with your lib  - Ü
<InPhase> And I left a stray echo in there.
<InPhase> J1A84: Of course. But that's to be motivation to get familiar with it. :)
<J1A84> guerilla marketing for libraries Ü
<InPhase> It is after all built for exactly this sort of use case. :)
<J1A84> yes  it is
<InPhase> This model is almost identical to one of the demo cases. I started by copying and pasting from it. :)
<J1A84> however  i think a hull with  a linear_extruded(.1,scale=0)polygon  rotated around the center would also be a good option
<InPhase> aisa: After removing the echo I left on line 14 (oops), the interesting difference is that yours completes the render in 30 seconds, and my version of the same design completes the render in 0.1 seconds.
<InPhase> That and well the compactness.
<J1A84> aisas version renders Total rendering time: 0:00:00.182    .. what did you do the other 29.878 seconds ?
<InPhase> design / flush cache
<J1A84> Total rendering time: 0:00:00.257
<InPhase> I get 3.5 seconds on the master branch with fast-csg, but nothing sub-second.
<J1A84> hm must be lazy U then Ü
<InPhase> Well, that makes it much faster.
<J1A84> oh great with a union i get lo ERROR: [fast-csg-remesh] Failed to collect path around patch faces, invalid mesh!
<InPhase> What did you do with a union to trigger that?
<J1A84> put i union() in front of the loop
<InPhase> Oh. :(
<J1A84> probably because there is no overlap
<InPhase> I'm generally wary of the hull and loop strategy because of those overlap issues.
<InPhase> I spent a lot of time doing those in my prior OpenSCAD life and kept hitting issues.
<InPhase> It's all tricky.
<J1A84> but in that case there should be overlaps
<J1A84> looks nice renders nice  .. no lib .. under 15 lines of code
<J1A84> w=18 for  edgy
<J1A84> guess i made a crown https://pasteboard.co/Q5GoM7R6Ji2p.png
<aisa> ah. crown seems to be the correct term for this shape! XD
<aisa> what you did there is a hull of 2d rectangles to produce a polyhedron, right?
<aisa> *is use
<aisa> ah, no you didn't
<J1A84> i extruded the square  to make it 3D  but with scale =0  so it only has an edge
<J1A84> if you use  square (center=true);   it will be on both sides
<J1A84> and the offset rounded the corners of the square  ↦ offset(2) square([.1,y],center=true);
<J1A84> you sure could use any polygon ();  for this  .. just was lazy as usual
<InPhase> J1A84: Nicely compact. But those corners...
<J1A84> corners?
<InPhase> Soom in at the right angle parts at the dip on the top.
<InPhase> Zoom
<InPhase> On the outside.
<J1A84> i have no idea what you mean
<J1A84> there are no right angles
<J1A84> ah you don't have the offset
<J1A84> InPhase how did you make that ?  https://pasteboard.co/LutJBci6fkWm.png  i have clean edges
<InPhase> On the outside of the dip part.
<InPhase> You're looking at the inside of the high part.
<InPhase> I habitually zoom in at the edges on models that flicker at me, so I spotted it right away. Although obviously it's sub-printing resolution in scale, so inconsequential as long as everything is manifold.
<J1A84> you have changed something on the code .. else this is not there
<J1A84> maybe you have using a different advance without correcting j for that
<InPhase> I copied and pasted your 67GQ?
<InPhase> Oh wait, I also changed :5: to :1:
<InPhase> But it's still there in the 5 just not as pronounced.
<J1A84> it can't be
<J1A84> use j =i+1;
<InPhase> Where'd it go. I saw them a second ago.
<J1A84> it is mathematically not possible as  there are no overlaps if  j is i+advance  .. and 360 is reached
<InPhase> Okay, now I don't see them. I guess that was an artifact of me not noticing the other 5, so it ended up with a 5x overlap. :)
<InPhase> My bad. :)
<InPhase> I walked away from the desk in the middle, and forgot I swapped it from 5 to 1.
fling has quit [Ping timeout: 258 seconds]
<InPhase> Looks clean now with both 5's as 1's.
<J1A84> but  the code wasn't made for resolution change . was just a poc   .. else i would loop the steps not angle
<J1A84> should also only loop to 360-advance  so there is no overlap
<J1A84> ( what is what learned from you some years ago)
peepsalot has quit [Read error: Connection reset by peer]
peepsalot has joined #openscad
qeed_ has quit [Read error: Connection reset by peer]
qeed_ has joined #openscad
qeed_ has quit [Quit: qeed_]
qeed has joined #openscad
snaked has quit [Remote host closed the connection]
snaked has joined #openscad
califax has quit [Remote host closed the connection]
califax has joined #openscad
lastrodamo has joined #openscad
<linext> is it possible to run the web assembly port on a windows server running apache?
ur5us has joined #openscad
snaked has quit [Ping timeout: 252 seconds]
<linext> does the web assembly port run entirely on the client?
fling has joined #openscad
epony has quit [Remote host closed the connection]
TheAssassin has quit [Ping timeout: 258 seconds]
TheAssassin has joined #openscad
gunnbr has quit [Quit: Leaving]
teepee_ has joined #openscad
teepee has quit [Ping timeout: 258 seconds]
teepee_ is now known as teepee
epony has joined #openscad
Guest46 has joined #openscad
<Guest46> Hello all. Can anyone offer advice on getting preview to work on Toshiba Satellite laptop with 1280x800 ATI display adapter?
Guest46 has quit [Quit: Client closed]
lastrodamo has quit [Quit: Leaving]
<teepee> linext: yes, it should just require any web server method that can host files
<linext> teepee, seems like the github repos require make and deno'
<linext> and docker
<teepee> linext: yes, it should just require any web server method that can host files
<linext> so i need to build from the source files and then copy those files to my web serve?
<teepee> the release from dschroer schould be easy to use too
<teepee> ochafik has some extra stuff integrated, depends on what you want to achieve
<linext> is it better to build on a linux virtual machine, instead of windows?
<teepee> the build is docker anyway. that probably works on windows too
<linext> ah
<teepee> but like I said, you don't really need to build if you just want to use the thing
<linext> i have docker installed on my windows server already
<linext> can i just copy all the files used from the playground page
<teepee> uses deno for hosting examples
<linext> can i just save the assets that are pre-built?
<linext> i don't know how to embed them into a test web page
<teepee> there's an example included
<linext> is Deno required?
<teepee> no, it's just an easy way to provide a server
<linext> i get a 404 for openscad.js
<linext> maybe i need to save openscad.js to the same folder?
<teepee> I would assume it expects the layout as checked in
<linext> yes, i got it working by saving the files from the release into example/www/
<teepee> yep, cube.stl
<linext> now can i do anything with cube.stl besides downloading the file?
<teepee> sure, push it into threejs for example
<linext> such as upload the contents of the STL to a database
<teepee> that's really just javascript at this point
<linext> i'll try to console.log output
<linext> yes, it appears to print out the byte array
<teepee> if your database has an api for that, yes, I think the file ends up in the browser memory file system
<linext> well remember the idea of a cloud for rendering openscad files
<linext> i want a client to be able to fetch an OpenSCAD, render the STL, and upload it to a central website
<linext> with anyone on the website being a client
<linext> well so far so good, thanks
<linext> i'll have to write some code for jobs
<teepee> and I'm overdue for some sleep :)
<teepee> good night
<linext> good night
snaked has joined #openscad