3 ms·
I'm the main author of libfive, happy to answer any questions. The site isn't totally up to date – the Python bindings + API are brand new, and need some examp
by mkeeter 5y ago
I'm the main author of libfive, happy to answer any questions.
The site isn't totally up to date – the Python bindings + API are brand new, and need some examples, but they work great if you know how to use them!
- traverseda 5y agoAre the python bindings part of core, or are they third party? Either way I should probably close https://github.com/libfive/libfive/issues/206 https://github.com/libfive/libfive/issues/206 ? Surprised to be hearing about this here instead of via that issue closing :p
- mkeeter 5y agoSurprise! :D Yes, these are now part of libfive's core – Python is an important-enough language that having canonical, first-party bindings seems important. There was a bunch of infrastructure work to get to this point: the standard library was ported from Scheme to C++, so the shape bindings are now autogenerated for both target languages and use FFI to call into a dynamic library (with a C API).
- leokeba 5y agoHello, thanks for your work, this seems very promising and I am very eager to push it a bit to see if it addresses the shortcomings of OpenSCAD, which I am using right now. However, when downloading the MacOS release of the Studio app and running it on my intel MBP, it seems that it cannot open the examples correctly. When opening the files with a text editor, I get the full content, but when opening them with Studio, only the last three lines (set-bounds, set-quality and set-resolution) are loaded into the text editor. I can copy and paste from my text editor and then it works like expected, but it's a bit tedious. Am I missing something or is this a bug ? I can open a ticket on github and provide more information if necessary. :)
- mkeeter 5y agoI appreciate you downloading it and testing it out! This sounds like a bug, please open a Github issue and I'll investigate.
- zyang 5y agoI found it's really cool how you can prefix any variable with # and makes it interactivee. How do you map variables to draggable surface in studio?
- mkeeter 5y agoGuile supports custom readers through read-hash-extend [1]: this lets you associate specific syntax with a custom reader, triggered by a '#' character. For example, this is how comments are implemented with #! ...multiline comment... !#: the first "#!" triggers a custom reader which reads until the termination. libfive installs custom readers for #0, #1, #2, and so on, which all do the same thing: store the syntax position (row/column/span), then create a free variable with a particular id that's associated with that syntax position. When pushing and pulling on the surface, it's solving for free variables values that put the surface at your mouse cursor's position. Then, it can splice those values back into the original script using the row/column/span data from before. Python does the same thing with a magic `var(...)` function, which is used as the target for an AST transform here: https://github.com/libfive/libfive/blob/master/libfive/bind/python/libfive/runner.py#L13-L63 https://github.com/libfive/libfive/blob/master/libfive/bind/... [1] http://www.gnu.org/software/guile/manual/guile.html#Reader-Extensions http://www.gnu.org/software/guile/manual/guile.html#Reader-E...