Hi,
Is there à way to 'drive' an OpenSCAD design from an external application,
throught an API or a socket or so?
I designed a 3D printed hexapod, and I'm also working on a python framework
to control it, and I'm looking for a solution to simulate the hexapod
without hardware; being able to use my OpenSCAD design would be really
great!
Thank's
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 21. feb. 2016 10:22, fma wrote:
Hi,
Is there à way to 'drive' an OpenSCAD design from an external application,
throught an API or a socket or so?
You could generate an OpenSCAD .csg file from your application, it is
essentially a much simplified "compiled" version of the .scad language.
This is what AngelScript CSG is currently doing.
Carsten Arnholm
http://arnholm.org/
Le dimanche 21 février 2016, cacb a écrit :
You could generate an OpenSCAD .csg file from your application, it is
essentially a much simplified "compiled" version of the .scad language.
This is what AngelScript CSG is currently doing.
I see.
But what I want to do is just to move some already defined objects, and
have them rendered in OpenSCAD in real time¹ while my python framework
compute new positions; how can I do that with .csg file?
Thanks,
¹ as fast as the computer can render objects.
--
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203p16205.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 02/21/2016 12:24 PM, fma wrote:
But what I want to do is just to move some already defined objects, and
have them rendered in OpenSCAD in real time¹ while my python framework
compute new positions; how can I do that with .csg file?
With a .csg file, you can't.
However there might be a way that comes close to what you
describe. The $vpX variables that define the camera position
are writable on top-level .scad file.
So you could include a simple control file on top of your
model, e.g.
include</tmp/vpx.scad>
and write the values to that file, e.g.
$vpt = [ 1, 1, 10];
$vpr = [ 10, 0, 0 ];
$vpd = 100;
with "Automatic reload and preview" any change to that control
file will update the display.
To make it "realtime", you probably also need to add some
tweaks to the model to make maximum use of caching. Just
simple preview of a complex model is probably too slow.
Of cause you can also put additional things into the control
file, like simulating the animation feature.
ciao,
Torsten.
OpenScad doesn't really do real time rendering, other than for changes in
the camera position.
I think the best you can do is write your equations of motion in OpenScad
instead of Python and base them on $t. Then you can generate an animation
as fast as OpenScad can manage. If you save the images of each frame you
can make a movie that does play in real time.
On 21 February 2016 at 11:24, fma fma@gbiloba.org wrote:
Le dimanche 21 février 2016, cacb a écrit :
You could generate an OpenSCAD .csg file from your application, it is
essentially a much simplified "compiled" version of the .scad language.
This is what AngelScript CSG is currently doing.
I see.
But what I want to do is just to move some already defined objects, and
have them rendered in OpenSCAD in real time¹ while my python framework
compute new positions; how can I do that with .csg file?
Thanks,
¹ as fast as the computer can render objects.
--
Frédéric
View this message in context: Re: Driving OpenSCAD
http://forum.openscad.org/Driving-OpenSCAD-tp16203p16205.html
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 21. feb. 2016 12:24, fma wrote:
Le dimanche 21 février 2016, cacb a écrit :
You could generate an OpenSCAD .csg file from your application, it is
essentially a much simplified "compiled" version of the .scad language.
This is what AngelScript CSG is currently doing.
I see.
But what I want to do is just to move some already defined objects, and
have them rendered in OpenSCAD in real time¹ while my python framework
compute new positions; how can I do that with .csg file?
You could update the .csg file frequently and it would work in a way by
OpenSCAD auto-reloading it, but it would be far too slow for your
expectations. I don't think OpenSCAD is the right tool for something
like that, unless you find some way to use the animation mode (I have
not used it)
http://kitwallace.tumblr.com/post/85663417144/openscad-animation-view
Perhaps what you want is to define your objects and export each as STL.
Then find an application or API somewhere able to read/display those
STLs and dynamically apply different transformations to each. If this
does not already exist, it would be a useful project for someone with
the right OpenGL knowledge.
Carsten Arnholm
http://arnholm.org/
Le dimanche 21 février 2016, tp3 a écrit :
However there might be a way that comes close to what you
describe. The $vpX variables that define the camera position
are writable on top-level .scad file.
[...]
Thank's for the suggestion!
--
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203p16209.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Le dimanche 21 février 2016, nophead a écrit :
I think the best you can do is write your equations of motion in OpenScad
instead of Python and base them on $t. Then you can generate an animation
as fast as OpenScad can manage. If you save the images of each frame you
can make a movie that does play in real time.
I thought to use that solution, but there are too much maths in the python
framework.
And I would like to be able to react on user inputs.
I'll give a try to Torsten's solution, using the auto-reload feature.
--
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203p16210.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Le dimanche 21 février 2016, tp3 a écrit :
However there might be a way that comes close to what you
describe. The $vpX variables that define the camera position
are writable on top-level .scad file.
So you could include a simple control file on top of your
model, e.g.
include</tmp/vpx.scad>
and write the values to that file, e.g.
$vpt = [ 1, 1, 10];
$vpr = [ 10, 0, 0 ];
$vpd = 100;
with "Automatic reload and preview" any change to that control
file will update the display.
In fact, that solution works with any included file! So, all I have to do
is:
include <vars.scad>
translate([X, Y, Z]) {
shpere();
}
X = 1;
Y = 2;
Z = 3;
My python script just have to generate the vars.scad file, with all my
maths results, and that's it!
Yeah, OpenSCAD is not really fast, but it is mainly for debug purpose, and
I don't need 24fps ;o)
Thanks you all for your help.
--
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203p16211.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Le dimanche 21 février 2016, cacb a écrit :
Perhaps what you want is to define your objects and export each as STL.
Then find an application or API somewhere able to read/display those
STLs and dynamically apply different transformations to each. If this
does not already exist, it would be a useful project for someone with
the right OpenGL knowledge.
Well, I think pygame could be used that way...
--
Frédéric
--
View this message in context: http://forum.openscad.org/Driving-OpenSCAD-tp16203p16212.html
Sent from the OpenSCAD mailing list archive at Nabble.com.