Replies: 7 comments 20 replies
-
@hrddavor thanks for the new idea. i can see advantage of having a simple way to describe the parameters, but parsing code is probably the wrong direction. Even simple parsing soon becomes complex. And there's all kinds of hooks that will have to be implemented as well. Remember, JSCAD is about the 'core' pieces. We want to create the pieces for others to assemble into different applications, libraries, etc. having said that, there may be other options.
By the way, the OpenSCAD parser does something similar, parsing the code. And it was never completed, tested, etc. And unsupported at this time. |
Beta Was this translation helpful? Give feedback.
-
Sorry to jump in when I've been so detached lately. My initial reaction to this is to bristle at comments being parsed into code. In my head, code comments should be non-functional, non-impactful. That said, I'm trying to be open minded and hip :p ok, so what I like:
My concerns:
Possible enhancements:
function main(params = {
// @jscad-magic-params
// # size
radius = 22, // Radius {type:'slider', live:1}
// # location (initially closed) {initial: 'closed'}
x = 0, // {type:'slider', live:1}
y = 0, // {type:'slider', live:1}
z = 0, // {type:'slider', live:1}
}) {
return translate([params.x, params.y, params.z], sphere({radius: params.radius, height: params.x}))
} |
Beta Was this translation helpful? Give feedback.
-
I like the direction for the marker that @SimonClark mentioned I like the use of There is plenty of time to decide for such detail but would like to start the brainstorm with proposing to go with one of these
|
Beta Was this translation helpful? Give feedback.
-
@z3dev add a pull request for this #891 please review when u got time :) |
Beta Was this translation helpful? Give feedback.
-
OK. I spent some time looking over the parameter definitions via comments. It's kind of cool. But let's get the syntax done before @hrgdavor does the final coding. I took the All Parameter Types Demo as the starting place, and converted to what we are discussing.
Notes on making definitions:
General comments:
Some discussion points:
@hrgdavor @SimonClark All thoughts are welcome. |
Beta Was this translation helpful? Give feedback.
-
@hrgdavor shall we close this discussion? If there’s more to discuss then it will probably be some enhancements. |
Beta Was this translation helpful? Give feedback.
-
My thought exactly, I see no other suitable. option. |
Beta Was this translation helpful? Give feedback.
-
The feature is now part of jscad. If you have more ideas or there is a bug please add a new issue.
Here is a presentation of a proposal for a new jscad feature: http://3d.hrg.hr/jscad/three/new_params_proposal/parameters.html#0
It is an additional syntax that can be used instead
getParameterDefinitions
to simplify writing scripts that use parameters.The intention is to keep
getParameterDefinitions
and have also this alternative way of defining parametersthe idea is allow developer to write the source source file like this:
and the script does not have to provide
getParameterDefinitions
The parser would internally generate this definition based on the source above
and the form would be something like this:
@z3dev please check it out fi you wish to discuss or propose changes. I would like a green light that this is something that would be accepted into jscad so I can start coding the PR
also, this demo uses a new worker implementation (with regl-renderer) that renders to offscreen canvas
transferControlToOffscreen
so both renderer and script execution are in the worker.Also, it is intention that this demo is somehow later integrated into openjscad ... and expanded as tutorial for scripts with parameters.
Beta Was this translation helpful? Give feedback.
All reactions