discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

export() function.

MV
Mihail Vasiliev
Sun, Jan 3, 2016 8:50 AM

Hello, everyone.
I've just created a pull request for export() function - lt was strange for
me that a language has import() and doesn't have an export() operation,
although it's available from GUI. So, I've extended export.cc module to make
it support calls for export(file="test.dxf") ....;

Example:

export(file="testcube.dxf") projection(cut=true)
translate([0,0,-1])
cube([2,2,2]);

There is a pull request on github on this topic -

https://github.com/openscad/openscad/pull/1534

--
View this message in context: http://forum.openscad.org/export-function-tp15428.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hello, everyone. I've just created a pull request for export() function - lt was strange for me that a language has import() and doesn't have an export() operation, although it's available from GUI. So, I've extended export.cc module to make it support calls for export(file="test.dxf") ....; Example: export(file="testcube.dxf") projection(cut=true) translate([0,0,-1]) cube([2,2,2]); There is a pull request on github on this topic - https://github.com/openscad/openscad/pull/1534 -- View this message in context: http://forum.openscad.org/export-function-tp15428.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jpmendes
Sun, Jan 3, 2016 6:26 PM

Hello,

I asked for such a functionality in a previous thread.
Now only a "function" to check for the existence of a file is missing.
Please note that the code I presented then did not intend to be exact, it
was only to express an idea.

And the idea was the capability of some automation from within the code to
achieve a fluid view and manipulation of complex multi-part objects.
Explaining briefly: rendering a multi-part complex object can make us loose
many minutes if not hours every time we start an editing session. When we
start assembling a multi-part object it happens frequently that some modules
are not at the right positions or that we forgot some details, so we need to
look to the object from several angles to understand better what to do. If
not rendered the set is almost impossible to move or rotate on the
view-port, the time lag is enormous.
My solution would be: the modules that are important for the assembly would
verify for a previously exported .stl file with the same name of the module.
If the file exist then that part is imported, else the code would be
compiled and exported as an .stl file. Since the code bellow is already
possible,

module ABC() {
import("ABC.stl");
}
ABC();

The only thing missing  after having the export functionality working would
be a function returning a flag signaling the existence of a file.

I know it is possible to have a fluid view  done from outside the script,
even to have a second instance of OpenSCAD open with all stls imported, but
it's not practical. It implies that the code is distributed into several
files and somehow the feel of unity of the object weakens.
Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the
SinWrite editor, we have already the facility to better navigate in a more
"complex" code  and we do not need to separate the code into several files
if we are not planning for code reuse, for that I would build a library.

I read this comment by doug.moen a few hours ago.

"An export command with a file name argument permits a malicious OpenSCAD
script to clobber any file in the file system for which it has write
permissions. OpenSCAD is intentionally designed so that it isn't a general
purpose language like Python, and it doesn't suffer from this kind of
security issue."

What if limiting the file name parameter to a couple of known pacific
extensions?

As I said in thread above I'm not a software guy nor an OpenSCAD expert and
I'm not a native english speaker either, so please understand that.

Happy new year

jpmendes
http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995

--
View this message in context: http://forum.openscad.org/export-function-tp15428p15437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hello, I asked for such a functionality in a previous thread. Now only a "function" to check for the existence of a file is missing. Please note that the code I presented then did not intend to be exact, it was only to express an idea. And the idea was the capability of some automation from within the code to achieve a fluid view and manipulation of complex multi-part objects. Explaining briefly: rendering a multi-part complex object can make us loose many minutes if not hours every time we start an editing session. When we start assembling a multi-part object it happens frequently that some modules are not at the right positions or that we forgot some details, so we need to look to the object from several angles to understand better what to do. If not rendered the set is almost impossible to move or rotate on the view-port, the time lag is enormous. My solution would be: the modules that are important for the assembly would verify for a previously exported .stl file with the same name of the module. If the file exist then that part is imported, else the code would be compiled and exported as an .stl file. Since the code bellow is already possible, module ABC() { import("ABC.stl"); } ABC(); The only thing missing after having the export functionality working would be a function returning a flag signaling the existence of a file. I know it is possible to have a fluid view done from outside the script, even to have a second instance of OpenSCAD open with all stls imported, but it's not practical. It implies that the code is distributed into several files and somehow the feel of unity of the object weakens. Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the SinWrite editor, we have already the facility to better navigate in a more "complex" code and we do not need to separate the code into several files if we are not planning for code reuse, for that I would build a library. I read this comment by doug.moen a few hours ago. "An export command with a file name argument permits a malicious OpenSCAD script to clobber any file in the file system for which it has write permissions. OpenSCAD is intentionally designed so that it isn't a general purpose language like Python, and it doesn't suffer from this kind of security issue." What if limiting the file name parameter to a couple of known pacific extensions? As I said in thread above I'm not a software guy nor an OpenSCAD expert and I'm not a native english speaker either, so please understand that. Happy new year jpmendes <http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995> -- View this message in context: http://forum.openscad.org/export-function-tp15428p15437.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Sun, Jan 3, 2016 6:54 PM

On 01/03/2016 07:26 PM, jpmendes wrote:

My solution would be: the modules that are important for the assembly would
verify for a previously exported .stl file with the same name of the module.
If the file exist then that part is imported, else the code would be
compiled and exported as an .stl file. Since the code bellow is already
possible,

A persistent cache (I think there's already an issue on github for that)
could solve this specific issue too and in a way that does not need much
user interaction.

Having scad code to check for files and then automatically use those will
cause lots of headaches with outdated files that need to be updated
manually. If you open the the scad file in two instances of OpenSCAD,
funny things will happen and there might also be cross-platform issues.

How is the difference between preview and render mode handled with
export()? Will that always force the mesh generation and export the
file on F5? How will that interact with animation?

In essence, my totally personal opinion is that OpenSCAD itself should
focus on the model description part and not try to become a general
programming language. There's a huge amount of improvements possible
for making the model generation easier and more powerful.

Note that my view of model description includes (not yet available)
markup to define such things a multiple objects from one script that
could be exported in one step. But that would be a feature of the
GUI, not the description language.

ciao,
Torsten.

On 01/03/2016 07:26 PM, jpmendes wrote: > My solution would be: the modules that are important for the assembly would > verify for a previously exported .stl file with the same name of the module. > If the file exist then that part is imported, else the code would be > compiled and exported as an .stl file. Since the code bellow is already > possible, > A persistent cache (I think there's already an issue on github for that) could solve this specific issue too and in a way that does not need much user interaction. Having scad code to check for files and then automatically use those will cause lots of headaches with outdated files that need to be updated manually. If you open the the scad file in two instances of OpenSCAD, funny things will happen and there might also be cross-platform issues. How is the difference between preview and render mode handled with export()? Will that always force the mesh generation and export the file on F5? How will that interact with animation? In essence, my totally personal opinion is that OpenSCAD itself should focus on the model description part and not try to become a general programming language. There's a huge amount of improvements possible for making the model generation easier and more powerful. Note that my view of model description includes (not yet available) markup to define such things a multiple objects from one script that could be exported in one step. But that would be a feature of the GUI, not the description language. ciao, Torsten.
DM
doug moen
Sun, Jan 3, 2016 8:26 PM

In https://github.com/openscad/openscad/issues/1437 clothbot and I propose
to add a persistent caching option to 'render'. This can address both
jpmendes and Mihail's problem.

If we add export and a function for testing file existence, then openscad
starts to become a scripting language for automating file management
workflow. The security problem becomes worse because now you can determine
what operating system is running, by testing for the existence of system
files, and now you know which files to clobber using 'export', for maximum
damage.

On Sunday, 3 January 2016, jpmendes <jpmendes54@gmail.com
javascript:_e(%7B%7D,'cvml','jpmendes54@gmail.com');> wrote:

Hello,

I asked for such a functionality in a previous thread.
Now only a "function" to check for the existence of a file is missing.
Please note that the code I presented then did not intend to be exact, it
was only to express an idea.

And the idea was the capability of some automation from within the code to
achieve a fluid view and manipulation of complex multi-part objects.
Explaining briefly: rendering a multi-part complex object can make us loose
many minutes if not hours every time we start an editing session. When we
start assembling a multi-part object it happens frequently that some
modules
are not at the right positions or that we forgot some details, so we need
to
look to the object from several angles to understand better what to do. If
not rendered the set is almost impossible to move or rotate on the
view-port, the time lag is enormous.
My solution would be: the modules that are important for the assembly would
verify for a previously exported .stl file with the same name of the
module.
If the file exist then that part is imported, else the code would be
compiled and exported as an .stl file. Since the code bellow is already
possible,

module ABC() {
import("ABC.stl");
}
ABC();

The only thing missing  after having the export functionality working would
be a function returning a flag signaling the existence of a file.

I know it is possible to have a fluid view  done from outside the script,
even to have a second instance of OpenSCAD open with all stls imported, but
it's not practical. It implies that the code is distributed into several
files and somehow the feel of unity of the object weakens.
Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the
SinWrite editor, we have already the facility to better navigate in a more
"complex" code  and we do not need to separate the code into several files
if we are not planning for code reuse, for that I would build a library.

I read this comment by doug.moen a few hours ago.

"An export command with a file name argument permits a malicious OpenSCAD
script to clobber any file in the file system for which it has write
permissions. OpenSCAD is intentionally designed so that it isn't a general
purpose language like Python, and it doesn't suffer from this kind of
security issue."

What if limiting the file name parameter to a couple of known pacific
extensions?

As I said in thread above I'm not a software guy nor an OpenSCAD expert and
I'm not a native english speaker either, so please understand that.

Happy new year

jpmendes
<
http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995

--
View this message in context:
http://forum.openscad.org/export-function-tp15428p15437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

In https://github.com/openscad/openscad/issues/1437 clothbot and I propose to add a persistent caching option to 'render'. This can address both jpmendes and Mihail's problem. If we add export *and* a function for testing file existence, then openscad starts to become a scripting language for automating file management workflow. The security problem becomes worse because now you can determine what operating system is running, by testing for the existence of system files, and now you know which files to clobber using 'export', for maximum damage. On Sunday, 3 January 2016, jpmendes <jpmendes54@gmail.com <javascript:_e(%7B%7D,'cvml','jpmendes54@gmail.com');>> wrote: > Hello, > > I asked for such a functionality in a previous thread. > Now only a "function" to check for the existence of a file is missing. > Please note that the code I presented then did not intend to be exact, it > was only to express an idea. > > And the idea was the capability of some automation from within the code to > achieve a fluid view and manipulation of complex multi-part objects. > Explaining briefly: rendering a multi-part complex object can make us loose > many minutes if not hours every time we start an editing session. When we > start assembling a multi-part object it happens frequently that some > modules > are not at the right positions or that we forgot some details, so we need > to > look to the object from several angles to understand better what to do. If > not rendered the set is almost impossible to move or rotate on the > view-port, the time lag is enormous. > My solution would be: the modules that are important for the assembly would > verify for a previously exported .stl file with the same name of the > module. > If the file exist then that part is imported, else the code would be > compiled and exported as an .stl file. Since the code bellow is already > possible, > > module ABC() { > import("ABC.stl"); > } > ABC(); > > The only thing missing after having the export functionality working would > be a function returning a flag signaling the existence of a file. > > I know it is possible to have a fluid view done from outside the script, > even to have a second instance of OpenSCAD open with all stls imported, but > it's not practical. It implies that the code is distributed into several > files and somehow the feel of unity of the object weakens. > Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the > SinWrite editor, we have already the facility to better navigate in a more > "complex" code and we do not need to separate the code into several files > if we are not planning for code reuse, for that I would build a library. > > I read this comment by doug.moen a few hours ago. > > "An export command with a file name argument permits a malicious OpenSCAD > script to clobber any file in the file system for which it has write > permissions. OpenSCAD is intentionally designed so that it isn't a general > purpose language like Python, and it doesn't suffer from this kind of > security issue." > > What if limiting the file name parameter to a couple of known pacific > extensions? > > As I said in thread above I'm not a software guy nor an OpenSCAD expert and > I'm not a native english speaker either, so please understand that. > > Happy new year > > jpmendes > < > http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995 > > > > > > -- > View this message in context: > http://forum.openscad.org/export-function-tp15428p15437.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
NH
nop head
Sun, Jan 3, 2016 8:39 PM

Yes persistent caching gets my vote as there are no changes to the
language, it just gets faster.

To export multiple objects from my files I simply call them
something_stl(). I have a python script that finds them and invokes the
command line to export them. That would also get much faster with a
persistent cache.

On 3 January 2016 at 20:26, doug moen doug@moens.org wrote:

In https://github.com/openscad/openscad/issues/1437 clothbot and I
propose to add a persistent caching option to 'render'. This can address
both jpmendes and Mihail's problem.

If we add export and a function for testing file existence, then
openscad starts to become a scripting language for automating file
management workflow. The security problem becomes worse because now you can
determine what operating system is running, by testing for the existence of
system files, and now you know which files to clobber using 'export', for
maximum damage.

On Sunday, 3 January 2016, jpmendes jpmendes54@gmail.com wrote:

Hello,

I asked for such a functionality in a previous thread.
Now only a "function" to check for the existence of a file is missing.
Please note that the code I presented then did not intend to be exact, it
was only to express an idea.

And the idea was the capability of some automation from within the code to
achieve a fluid view and manipulation of complex multi-part objects.
Explaining briefly: rendering a multi-part complex object can make us
loose
many minutes if not hours every time we start an editing session. When we
start assembling a multi-part object it happens frequently that some
modules
are not at the right positions or that we forgot some details, so we need
to
look to the object from several angles to understand better what to do. If
not rendered the set is almost impossible to move or rotate on the
view-port, the time lag is enormous.
My solution would be: the modules that are important for the assembly
would
verify for a previously exported .stl file with the same name of the
module.
If the file exist then that part is imported, else the code would be
compiled and exported as an .stl file. Since the code bellow is already
possible,

module ABC() {
import("ABC.stl");
}
ABC();

The only thing missing  after having the export functionality working
would
be a function returning a flag signaling the existence of a file.

I know it is possible to have a fluid view  done from outside the script,
even to have a second instance of OpenSCAD open with all stls imported,
but
it's not practical. It implies that the code is distributed into several
files and somehow the feel of unity of the object weakens.
Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the
SinWrite editor, we have already the facility to better navigate in a more
"complex" code  and we do not need to separate the code into several files
if we are not planning for code reuse, for that I would build a library.

I read this comment by doug.moen a few hours ago.

"An export command with a file name argument permits a malicious OpenSCAD
script to clobber any file in the file system for which it has write
permissions. OpenSCAD is intentionally designed so that it isn't a general
purpose language like Python, and it doesn't suffer from this kind of
security issue."

What if limiting the file name parameter to a couple of known pacific
extensions?

As I said in thread above I'm not a software guy nor an OpenSCAD expert
and
I'm not a native english speaker either, so please understand that.

Happy new year

jpmendes
<
http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995

--
View this message in context:
http://forum.openscad.org/export-function-tp15428p15437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Yes persistent caching gets my vote as there are no changes to the language, it just gets faster. To export multiple objects from my files I simply call them something_stl(). I have a python script that finds them and invokes the command line to export them. That would also get much faster with a persistent cache. On 3 January 2016 at 20:26, doug moen <doug@moens.org> wrote: > In https://github.com/openscad/openscad/issues/1437 clothbot and I > propose to add a persistent caching option to 'render'. This can address > both jpmendes and Mihail's problem. > > If we add export *and* a function for testing file existence, then > openscad starts to become a scripting language for automating file > management workflow. The security problem becomes worse because now you can > determine what operating system is running, by testing for the existence of > system files, and now you know which files to clobber using 'export', for > maximum damage. > > On Sunday, 3 January 2016, jpmendes <jpmendes54@gmail.com> wrote: > >> Hello, >> >> I asked for such a functionality in a previous thread. >> Now only a "function" to check for the existence of a file is missing. >> Please note that the code I presented then did not intend to be exact, it >> was only to express an idea. >> >> And the idea was the capability of some automation from within the code to >> achieve a fluid view and manipulation of complex multi-part objects. >> Explaining briefly: rendering a multi-part complex object can make us >> loose >> many minutes if not hours every time we start an editing session. When we >> start assembling a multi-part object it happens frequently that some >> modules >> are not at the right positions or that we forgot some details, so we need >> to >> look to the object from several angles to understand better what to do. If >> not rendered the set is almost impossible to move or rotate on the >> view-port, the time lag is enormous. >> My solution would be: the modules that are important for the assembly >> would >> verify for a previously exported .stl file with the same name of the >> module. >> If the file exist then that part is imported, else the code would be >> compiled and exported as an .stl file. Since the code bellow is already >> possible, >> >> module ABC() { >> import("ABC.stl"); >> } >> ABC(); >> >> The only thing missing after having the export functionality working >> would >> be a function returning a flag signaling the existence of a file. >> >> I know it is possible to have a fluid view done from outside the script, >> even to have a second instance of OpenSCAD open with all stls imported, >> but >> it's not practical. It implies that the code is distributed into several >> files and somehow the feel of unity of the object weakens. >> Now with the OpenSCAD lexer presented by runsun (thank you runsun) for the >> SinWrite editor, we have already the facility to better navigate in a more >> "complex" code and we do not need to separate the code into several files >> if we are not planning for code reuse, for that I would build a library. >> >> I read this comment by doug.moen a few hours ago. >> >> "An export command with a file name argument permits a malicious OpenSCAD >> script to clobber any file in the file system for which it has write >> permissions. OpenSCAD is intentionally designed so that it isn't a general >> purpose language like Python, and it doesn't suffer from this kind of >> security issue." >> >> What if limiting the file name parameter to a couple of known pacific >> extensions? >> >> As I said in thread above I'm not a software guy nor an OpenSCAD expert >> and >> I'm not a native english speaker either, so please understand that. >> >> Happy new year >> >> jpmendes >> < >> http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995 >> > >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/export-function-tp15428p15437.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
MV
Mihail Vasiliev
Sun, Jan 3, 2016 9:00 PM

May be it's safe enought to permit only files with names, derived from
original script name.
3 янв. 2016 г. 11:40 PM пользователь "nop head" nop.head@gmail.com
написал:

Yes persistent caching gets my vote as there are no changes to the
language, it just gets faster.

To export multiple objects from my files I simply call them
something_stl(). I have a python script that finds them and invokes the
command line to export them. That would also get much faster with a
persistent cache.

On 3 January 2016 at 20:26, doug moen doug@moens.org wrote:

In https://github.com/openscad/openscad/issues/1437 clothbot and I
propose to add a persistent caching option to 'render'. This can address
both jpmendes and Mihail's problem.

If we add export and a function for testing file existence, then
openscad starts to become a scripting language for automating file
management workflow. The security problem becomes worse because now you can
determine what operating system is running, by testing for the existence of
system files, and now you know which files to clobber using 'export', for
maximum damage.

On Sunday, 3 January 2016, jpmendes jpmendes54@gmail.com wrote:

Hello,

I asked for such a functionality in a previous thread.
Now only a "function" to check for the existence of a file is missing.
Please note that the code I presented then did not intend to be exact, it
was only to express an idea.

And the idea was the capability of some automation from within the code
to
achieve a fluid view and manipulation of complex multi-part objects.
Explaining briefly: rendering a multi-part complex object can make us
loose
many minutes if not hours every time we start an editing session. When we
start assembling a multi-part object it happens frequently that some
modules
are not at the right positions or that we forgot some details, so we
need to
look to the object from several angles to understand better what to do.
If
not rendered the set is almost impossible to move or rotate on the
view-port, the time lag is enormous.
My solution would be: the modules that are important for the assembly
would
verify for a previously exported .stl file with the same name of the
module.
If the file exist then that part is imported, else the code would be
compiled and exported as an .stl file. Since the code bellow is already
possible,

module ABC() {
import("ABC.stl");
}
ABC();

The only thing missing  after having the export functionality working
would
be a function returning a flag signaling the existence of a file.

I know it is possible to have a fluid view  done from outside the script,
even to have a second instance of OpenSCAD open with all stls imported,
but
it's not practical. It implies that the code is distributed into several
files and somehow the feel of unity of the object weakens.
Now with the OpenSCAD lexer presented by runsun (thank you runsun) for
the
SinWrite editor, we have already the facility to better navigate in a
more
"complex" code  and we do not need to separate the code into several
files
if we are not planning for code reuse, for that I would build a library.

I read this comment by doug.moen a few hours ago.

"An export command with a file name argument permits a malicious OpenSCAD
script to clobber any file in the file system for which it has write
permissions. OpenSCAD is intentionally designed so that it isn't a
general
purpose language like Python, and it doesn't suffer from this kind of
security issue."

What if limiting the file name parameter to a couple of known pacific
extensions?

As I said in thread above I'm not a software guy nor an OpenSCAD expert
and
I'm not a native english speaker either, so please understand that.

Happy new year

jpmendes
<
http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995

--
View this message in context:
http://forum.openscad.org/export-function-tp15428p15437.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

May be it's safe enought to permit only files with names, derived from original script name. 3 янв. 2016 г. 11:40 PM пользователь "nop head" <nop.head@gmail.com> написал: > Yes persistent caching gets my vote as there are no changes to the > language, it just gets faster. > > To export multiple objects from my files I simply call them > something_stl(). I have a python script that finds them and invokes the > command line to export them. That would also get much faster with a > persistent cache. > > On 3 January 2016 at 20:26, doug moen <doug@moens.org> wrote: > >> In https://github.com/openscad/openscad/issues/1437 clothbot and I >> propose to add a persistent caching option to 'render'. This can address >> both jpmendes and Mihail's problem. >> >> If we add export *and* a function for testing file existence, then >> openscad starts to become a scripting language for automating file >> management workflow. The security problem becomes worse because now you can >> determine what operating system is running, by testing for the existence of >> system files, and now you know which files to clobber using 'export', for >> maximum damage. >> >> On Sunday, 3 January 2016, jpmendes <jpmendes54@gmail.com> wrote: >> >>> Hello, >>> >>> I asked for such a functionality in a previous thread. >>> Now only a "function" to check for the existence of a file is missing. >>> Please note that the code I presented then did not intend to be exact, it >>> was only to express an idea. >>> >>> And the idea was the capability of some automation from within the code >>> to >>> achieve a fluid view and manipulation of complex multi-part objects. >>> Explaining briefly: rendering a multi-part complex object can make us >>> loose >>> many minutes if not hours every time we start an editing session. When we >>> start assembling a multi-part object it happens frequently that some >>> modules >>> are not at the right positions or that we forgot some details, so we >>> need to >>> look to the object from several angles to understand better what to do. >>> If >>> not rendered the set is almost impossible to move or rotate on the >>> view-port, the time lag is enormous. >>> My solution would be: the modules that are important for the assembly >>> would >>> verify for a previously exported .stl file with the same name of the >>> module. >>> If the file exist then that part is imported, else the code would be >>> compiled and exported as an .stl file. Since the code bellow is already >>> possible, >>> >>> module ABC() { >>> import("ABC.stl"); >>> } >>> ABC(); >>> >>> The only thing missing after having the export functionality working >>> would >>> be a function returning a flag signaling the existence of a file. >>> >>> I know it is possible to have a fluid view done from outside the script, >>> even to have a second instance of OpenSCAD open with all stls imported, >>> but >>> it's not practical. It implies that the code is distributed into several >>> files and somehow the feel of unity of the object weakens. >>> Now with the OpenSCAD lexer presented by runsun (thank you runsun) for >>> the >>> SinWrite editor, we have already the facility to better navigate in a >>> more >>> "complex" code and we do not need to separate the code into several >>> files >>> if we are not planning for code reuse, for that I would build a library. >>> >>> I read this comment by doug.moen a few hours ago. >>> >>> "An export command with a file name argument permits a malicious OpenSCAD >>> script to clobber any file in the file system for which it has write >>> permissions. OpenSCAD is intentionally designed so that it isn't a >>> general >>> purpose language like Python, and it doesn't suffer from this kind of >>> security issue." >>> >>> What if limiting the file name parameter to a couple of known pacific >>> extensions? >>> >>> As I said in thread above I'm not a software guy nor an OpenSCAD expert >>> and >>> I'm not a native english speaker either, so please understand that. >>> >>> Happy new year >>> >>> jpmendes >>> < >>> http://forum.openscad.org/How-to-check-if-a-file-exist-Why-not-export-from-code-td14982.html#a14995 >>> > >>> >>> >>> >>> -- >>> View this message in context: >>> http://forum.openscad.org/export-function-tp15428p15437.html >>> Sent from the OpenSCAD mailing list archive at Nabble.com. >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >>> >>> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
J
jpmendes
Sun, Jan 3, 2016 9:59 PM

Hello,

For me persistent cache is welcome as I seldom make complex multi-part
objects. For the guys tackling
several projects a  time it can be very hard disk consuming.
However with the limitation of the names and extensions of the exports, and
placing the exported files inside the project directory, I cannot figure out
where could be risk for malware propagation.
For the guys not wanting to use the export functionality the language would
not be different.

And what if we had a GUI more like an IDE with a project tree, where the
files could be added from other project dirs and made available locally, and
all (except calls to libraries) would be kept under the project directory?

jpmendes

--
View this message in context: http://forum.openscad.org/export-function-tp15428p15448.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hello, For me persistent cache is welcome as I seldom make complex multi-part objects. For the guys tackling several projects a time it can be very hard disk consuming. However with the limitation of the names and extensions of the exports, and placing the exported files inside the project directory, I cannot figure out where could be risk for malware propagation. For the guys not wanting to use the export functionality the language would not be different. And what if we had a GUI more like an IDE with a project tree, where the files could be added from other project dirs and made available locally, and all (except calls to libraries) would be kept under the project directory? jpmendes -- View this message in context: http://forum.openscad.org/export-function-tp15428p15448.html Sent from the OpenSCAD mailing list archive at Nabble.com.
AC
Alan Cox
Sun, Jan 3, 2016 10:10 PM

On Sun, 3 Jan 2016 14:59:13 -0700 (MST)
jpmendes jpmendes54@gmail.com wrote:

Hello,

For me persistent cache is welcome as I seldom make complex multi-part
objects. For the guys tackling
several projects a  time it can be very hard disk consuming.

Its usually going to be smaller and easier to manage than having loads of
saved export files you have to keep remembering to clean up by hand. It's
a model that works well and has a very simple interface ("Size ?"). All
the web browsers use it for example.

Alan

On Sun, 3 Jan 2016 14:59:13 -0700 (MST) jpmendes <jpmendes54@gmail.com> wrote: > Hello, > > For me persistent cache is welcome as I seldom make complex multi-part > objects. For the guys tackling > several projects a time it can be very hard disk consuming. Its usually going to be smaller and easier to manage than having loads of saved export files you have to keep remembering to clean up by hand. It's a model that works well and has a very simple interface ("Size ?"). All the web browsers use it for example. Alan
J
jpmendes
Mon, Jan 4, 2016 12:30 AM

I pray for the persistent cache location to be user defined. Please!!!

jpmendes

--
View this message in context: http://forum.openscad.org/export-function-tp15428p15455.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I pray for the persistent cache location to be user defined. Please!!! jpmendes -- View this message in context: http://forum.openscad.org/export-function-tp15428p15455.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Mon, Jan 4, 2016 12:45 AM

On 01/04/2016 01:30 AM, jpmendes wrote:

I pray for the persistent cache location to be user defined. Please!!!

One option would be the use of memcached, in that case OpenSCAD would
not specify a path for the actual storage.

ciao,
Torsten.

On 01/04/2016 01:30 AM, jpmendes wrote: > I pray for the persistent cache location to be user defined. Please!!! > One option would be the use of memcached, in that case OpenSCAD would not specify a path for the actual storage. ciao, Torsten.
MV
Mihail Vasiliev
Mon, Jan 4, 2016 9:31 PM

On persistent cache - may be try using mmap-ed files? There is some mechanism
for it in boost
(http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html),
but I have no experience with it.

On my original issue - what about reconsidering my patches and suggestions
on security enhancments?

--
View this message in context: http://forum.openscad.org/export-function-tp15428p15484.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

On persistent cache - may be try using mmap-ed files? There is some mechanism for it in boost (http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html), but I have no experience with it. On my original issue - what about reconsidering my patches and suggestions on security enhancments? -- View this message in context: http://forum.openscad.org/export-function-tp15428p15484.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Mon, Jan 4, 2016 11:09 PM

Hi Mihail. Concerning your pull request for an export() command.

Torsten is a gatekeeper, I'm not. Torsten's response to your proposal was
more relevant and insightful than mine. The security problem is a side
issue, and the real problem is what Torsten said:

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.
  2. You can't add a procedural, side effect causing 'export()' command to
    the language because it doesn't make any sense to export a shape to a file
    while the script is being evaluated: this would mess up preview
    performance. Once again, this is a side issue, like security. It's a
    technical issue which underlies the fundamental design decision that
    OpenSCAD is a declarative language (see point 1 above).

Torsten asked a number of questions about "when does this side effect
occur", which are quite relevant, and which you didn't answer.

Then Torsten proposed a design which is consistent with the OpenSCAD
philosophy. Instead of an "export" function which has the semantics of
"write this shape to a file right now", there is a syntax for adding
metadata to a node of the CSG tree, which has the semantics: this branch of
the CSG tree should be exported to a separate file, at export time. It
could have the same syntax as your proposal.

This metadata is not interpreted until some GUI command is invoked. No
files are exported during preview, render or animation, which is as it
should be. For example, the GUI "Export" command can notice that there are
multiple exported subtrees tagged in the CSG tree. It could, for example,
ask you to specify a root directory, then write all of the exported files
relative to this directory. It should also be specified how to invoke
multiple export from the CLI.

Notice how the security problem goes away when the feature is properly
designed. We are no longer invisibly exporting files without the user's
knowledge, in the case of a downloaded SCAD file. Export only happens
explicitly.

This design addresses the goal of exporting multiple files from a single
*.scad file, but it doesn't address jpmendes' problem, because his goal is
for OpenSCAD to run faster, and he wants to achieve this by persistent
caching of specified subtrees. So we've proposed an extension to the
render() operator to solve his problem.

On 4 January 2016 at 16:31, Mihail Vasiliev mickvav@gmail.com wrote:

On persistent cache - may be try using mmap-ed files? There is some
mechanism
for it in boost
(
http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html
),
but I have no experience with it.

On my original issue - what about reconsidering my patches and suggestions
on security enhancments?

--
View this message in context:
http://forum.openscad.org/export-function-tp15428p15484.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi Mihail. Concerning your pull request for an export() command. Torsten is a gatekeeper, I'm not. Torsten's response to your proposal was more relevant and insightful than mine. The security problem is a side issue, and the real problem is what Torsten said: 1. OpenSCAD is not a procedural programming language. It is a purely declarative language for describing geometry. This is the primary issue. 2. You can't add a procedural, side effect causing 'export()' command to the language because it doesn't make any sense to export a shape to a file while the script is being evaluated: this would mess up preview performance. Once again, this is a side issue, like security. It's a technical issue which underlies the fundamental design decision that OpenSCAD is a declarative language (see point 1 above). Torsten asked a number of questions about "when does this side effect occur", which are quite relevant, and which you didn't answer. Then Torsten proposed a design which is consistent with the OpenSCAD philosophy. Instead of an "export" function which has the semantics of "write this shape to a file *right now*", there is a syntax for adding metadata to a node of the CSG tree, which has the semantics: this branch of the CSG tree should be exported to a separate file, at export time. It could have the same syntax as your proposal. This metadata is not interpreted until some GUI command is invoked. No files are exported during preview, render or animation, which is as it should be. For example, the GUI "Export" command can notice that there are multiple exported subtrees tagged in the CSG tree. It could, for example, ask you to specify a root directory, then write all of the exported files relative to this directory. It should also be specified how to invoke multiple export from the CLI. Notice how the security problem goes away when the feature is properly designed. We are no longer invisibly exporting files without the user's knowledge, in the case of a downloaded SCAD file. Export only happens explicitly. This design addresses the goal of exporting multiple files from a single *.scad file, but it doesn't address jpmendes' problem, because his goal is for OpenSCAD to run faster, and he wants to achieve this by persistent caching of specified subtrees. So we've proposed an extension to the render() operator to solve his problem. On 4 January 2016 at 16:31, Mihail Vasiliev <mickvav@gmail.com> wrote: > On persistent cache - may be try using mmap-ed files? There is some > mechanism > for it in boost > ( > http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html > ), > but I have no experience with it. > > On my original issue - what about reconsidering my patches and suggestions > on security enhancments? > > > > -- > View this message in context: > http://forum.openscad.org/export-function-tp15428p15484.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
MV
Mihail Vasiliev
Wed, Jan 6, 2016 7:57 PM

Hi, Doug, Torsten.

I'll try to answer Torsten's questions first.

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding AbstractNode.

  1. Will that always force the mesh generation and export the
    file on F5?

It's action is triggered at the same times as echo's.
As for now, it actually calls instantiateChildren on it's children nodes.
(I don't know, whether this function it use caches internally. I can dig
it, if it's necessary.)
Than it applies freshly-created GeometryEvaluator on the first of these
children and exports resulted geometry in supplied file, determining it's
type by it's name.

  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create series of
exported files of each time step.
e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

generates several stl files with different names, as expected.

Now on Doug's questions:

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be declared in
command line, not in the language itself?

  1. You can't add a procedural, side effect causing 'export()' command to
    the language because it doesn't make any sense to export a shape to a file
    while the script is being evaluated: this would mess up preview
    performance. Once again, this is a side issue, like security. It's a
    technical issue which underlies the fundamental design decision that
    OpenSCAD is a declarative language (see point 1 above).

This technocal issue can be addressed by adding some extra argument to
export to make it skip it's operation in preview mode, for example. I can
do it, as well as security restrictions, regression tests and so on, if the
community is interested in the feature itself.

2016-01-05 2:09 GMT+03:00 doug moen doug@moens.org:

Hi Mihail. Concerning your pull request for an export() command.

Torsten is a gatekeeper, I'm not. Torsten's response to your proposal was
more relevant and insightful than mine. The security problem is a side
issue, and the real problem is what Torsten said:

1. OpenSCAD is not a procedural programming language. It is a purely
declarative language for describing geometry. This is the primary issue.
2. You can't add a procedural, side effect causing 'export()' command
to the language because it doesn't make any sense to export a shape to a
file while the script is being evaluated: this would mess up preview
performance. Once again, this is a side issue, like security. It's a
technical issue which underlies the fundamental design decision that
OpenSCAD is a declarative language (see point 1 above).

Torsten asked a number of questions about "when does this side effect
occur", which are quite relevant, and which you didn't answer.

Then Torsten proposed a design which is consistent with the OpenSCAD
philosophy. Instead of an "export" function which has the semantics of
"write this shape to a file right now", there is a syntax for adding
metadata to a node of the CSG tree, which has the semantics: this branch of
the CSG tree should be exported to a separate file, at export time. It
could have the same syntax as your proposal.

This metadata is not interpreted until some GUI command is invoked. No
files are exported during preview, render or animation, which is as it
should be. For example, the GUI "Export" command can notice that there are
multiple exported subtrees tagged in the CSG tree. It could, for example,
ask you to specify a root directory, then write all of the exported files
relative to this directory. It should also be specified how to invoke
multiple export from the CLI.

Notice how the security problem goes away when the feature is properly
designed. We are no longer invisibly exporting files without the user's
knowledge, in the case of a downloaded SCAD file. Export only happens
explicitly.

This design addresses the goal of exporting multiple files from a single
*.scad file, but it doesn't address jpmendes' problem, because his goal is
for OpenSCAD to run faster, and he wants to achieve this by persistent
caching of specified subtrees. So we've proposed an extension to the
render() operator to solve his problem.

On 4 January 2016 at 16:31, Mihail Vasiliev mickvav@gmail.com wrote:

On persistent cache - may be try using mmap-ed files? There is some
mechanism
for it in boost
(
http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html
),
but I have no experience with it.

On my original issue - what about reconsidering my patches and suggestions
on security enhancments?

--
View this message in context:
http://forum.openscad.org/export-function-tp15428p15484.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Hi, Doug, Torsten. I'll try to answer Torsten's questions first. 1. How is the difference between preview and render mode handled with export()? The very exact way another side-effecting operation - "echo" does. It does it's dirty job on "instantiate" call to corresponding AbstractNode. 2. Will that always force the mesh generation and export the file on F5? It's action is triggered at the same times as echo's. As for now, it actually calls instantiateChildren on it's children nodes. (I don't know, whether this function it use caches internally. I can dig it, if it's necessary.) Than it applies freshly-created GeometryEvaluator on the first of these children and exports resulted geometry in supplied file, determining it's type by it's name. 3. How will that interact with animation? Yes, I regenerates file on each frame, and can be used to create series of exported files of each time step. e.g. the code: export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); generates several stl files with different names, as expected. Now on Doug's questions: 1. OpenSCAD is not a procedural programming language. It is a purely declarative language for describing geometry. This is the primary issue. And why the way to output for this geometry is obligated to be declared in command line, not in the language itself? 2. You can't add a procedural, side effect causing 'export()' command to the language because it doesn't make any sense to export a shape to a file while the script is being evaluated: this would mess up preview performance. Once again, this is a side issue, like security. It's a technical issue which underlies the fundamental design decision that OpenSCAD is a declarative language (see point 1 above). This technocal issue can be addressed by adding some extra argument to export to make it skip it's operation in preview mode, for example. I can do it, as well as security restrictions, regression tests and so on, if the community is interested in the feature itself. 2016-01-05 2:09 GMT+03:00 doug moen <doug@moens.org>: > Hi Mihail. Concerning your pull request for an export() command. > > Torsten is a gatekeeper, I'm not. Torsten's response to your proposal was > more relevant and insightful than mine. The security problem is a side > issue, and the real problem is what Torsten said: > > 1. OpenSCAD is not a procedural programming language. It is a purely > declarative language for describing geometry. This is the primary issue. > 2. You can't add a procedural, side effect causing 'export()' command > to the language because it doesn't make any sense to export a shape to a > file while the script is being evaluated: this would mess up preview > performance. Once again, this is a side issue, like security. It's a > technical issue which underlies the fundamental design decision that > OpenSCAD is a declarative language (see point 1 above). > > Torsten asked a number of questions about "when does this side effect > occur", which are quite relevant, and which you didn't answer. > > Then Torsten proposed a design which is consistent with the OpenSCAD > philosophy. Instead of an "export" function which has the semantics of > "write this shape to a file *right now*", there is a syntax for adding > metadata to a node of the CSG tree, which has the semantics: this branch of > the CSG tree should be exported to a separate file, at export time. It > could have the same syntax as your proposal. > > This metadata is not interpreted until some GUI command is invoked. No > files are exported during preview, render or animation, which is as it > should be. For example, the GUI "Export" command can notice that there are > multiple exported subtrees tagged in the CSG tree. It could, for example, > ask you to specify a root directory, then write all of the exported files > relative to this directory. It should also be specified how to invoke > multiple export from the CLI. > > Notice how the security problem goes away when the feature is properly > designed. We are no longer invisibly exporting files without the user's > knowledge, in the case of a downloaded SCAD file. Export only happens > explicitly. > > This design addresses the goal of exporting multiple files from a single > *.scad file, but it doesn't address jpmendes' problem, because his goal is > for OpenSCAD to run faster, and he wants to achieve this by persistent > caching of specified subtrees. So we've proposed an extension to the > render() operator to solve his problem. > > On 4 January 2016 at 16:31, Mihail Vasiliev <mickvav@gmail.com> wrote: > >> On persistent cache - may be try using mmap-ed files? There is some >> mechanism >> for it in boost >> ( >> http://www.boost.org/doc/libs/1_50_0/libs/iostreams/doc/classes/mapped_file.html >> ), >> but I have no experience with it. >> >> On my original issue - what about reconsidering my patches and suggestions >> on security enhancments? >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/export-function-tp15428p15484.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
TP
Torsten Paul
Fri, Jan 8, 2016 5:42 PM

On 01/06/2016 08:57 PM, Mihail Vasiliev wrote:

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding AbstractNode.

So it would try to generate the full mesh (aka. F6) for this part
of the model for each preview and export the file. I don't think
this is a good way of handling it. See below for more details...

  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create series
of exported files of each time step. e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

Ok, that might be useful in some rare cases, but it looks a bit like
misusing the animation feature.

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be declared
in command line, not in the language itself?

I would not say it's impossible to use some language feature to declare
what to export. The main issue is the immediate execution which the
code is compiled.

Trying to find the analogy to C++ here, we only have the compilation
step where you do "gcc -o program.exe file.c" and the analog part would
be "openscad -o model.stl file.scad".
So mapping the immediate execution of export() to gcc would be like
exporting another file while the compiler is running via #export file.out
or something similar.

Actually running as program does not really happen with OpenSCAD models,
as they are essentially a data structure that is evaluated by different
things.

Those things can be:

  • F5 preview renderer in OpenSCAD GUI
  • F6 mesh calculation in OpenSCAD GUI or command line
  • various exports to different formats in OpenSCAD GUI or command line
  • import into other programs, namely FreeCAD

Most notably here is the last point which highlights the interpretation
of SCAD (or it's simplified form CSG) files as data. What would FreeCAD
do with an export() node when reading the file?

It's true that echo() is also fitting into that problem area, it mainly
has the argument that there would be almost no debugging possibility
without it.

I think having some capabilities to markup/annotate parts of a model
to tell the OpenSCAD GUI what to do when interpreting the data could
cover both issues: a) leaving the scad script as a data description
while still b) allowing the user to export multiple parts at once.
All this without interfering with other programs that might want to
import the file or making the preview slow due to forced mesh generation.
Also annotations allow more control about export details, as for
instance the DXF export would benefit from defining model parts
as different layer while still exporting into a single file.

Maybe we can work together moving into that direction? The actual
feature for exporting multiple files / multiple layer would be
awesome to have and surely welcomed by a number of people.

ciao,
Torsten.

On 01/06/2016 08:57 PM, Mihail Vasiliev wrote: > 1. How is the difference between preview and render mode handled with > export()? > > The very exact way another side-effecting operation - "echo" does. > It does it's dirty job on "instantiate" call to corresponding AbstractNode. > So it would try to generate the full mesh (aka. F6) for this part of the model for each preview and export the file. I don't think this is a good way of handling it. See below for more details... > 3. How will that interact with animation? > > Yes, I regenerates file on each frame, and can be used to create series > of exported files of each time step. e.g. the code: > > export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); > Ok, that might be useful in some rare cases, but it looks a bit like misusing the animation feature. > 1. OpenSCAD is not a procedural programming language. It is a purely > declarative language for describing geometry. This is the primary issue. > > And why the way to output for this geometry is obligated to be declared > in command line, not in the language itself? > I would not say it's impossible to use some language feature to declare what to export. The main issue is the immediate execution which the code is compiled. Trying to find the analogy to C++ here, we _only_ have the compilation step where you do "gcc -o program.exe file.c" and the analog part would be "openscad -o model.stl file.scad". So mapping the immediate execution of export() to gcc would be like exporting another file while the compiler is running via #export file.out or something similar. Actually running as program does not really happen with OpenSCAD models, as they are essentially a data structure that is evaluated by different things. Those things can be: * F5 preview renderer in OpenSCAD GUI * F6 mesh calculation in OpenSCAD GUI or command line * various exports to different formats in OpenSCAD GUI or command line * import into other programs, namely FreeCAD Most notably here is the last point which highlights the interpretation of SCAD (or it's simplified form CSG) files as data. What would FreeCAD do with an export() node when reading the file? It's true that echo() is also fitting into that problem area, it mainly has the argument that there would be almost no debugging possibility without it. I think having some capabilities to markup/annotate parts of a model to tell the OpenSCAD GUI what to do when interpreting the data could cover both issues: a) leaving the scad script as a data description while still b) allowing the user to export multiple parts at once. All this without interfering with other programs that might want to import the file or making the preview slow due to forced mesh generation. Also annotations allow more control about export details, as for instance the DXF export would benefit from defining model parts as different layer while still exporting into a single file. Maybe we can work together moving into that direction? The actual feature for exporting multiple files / multiple layer would be awesome to have and surely welcomed by a number of people. ciao, Torsten.
DM
doug moen
Fri, Jan 8, 2016 6:57 PM

The animate feature doesn't create an output file for each frame unless
you select the "dump images" option. There's currently no option to export
each frame as stl. If we added such a feature, only then would it make
sense to export tagged subtrees as stl for each frame.

On Friday, 8 January 2016, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/06/2016 08:57 PM, Mihail Vasiliev wrote:

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding

AbstractNode.

So it would try to generate the full mesh (aka. F6) for this part
of the model for each preview and export the file. I don't think
this is a good way of handling it. See below for more details...

  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create series
of exported files of each time step. e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

Ok, that might be useful in some rare cases, but it looks a bit like
misusing the animation feature.

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be declared
in command line, not in the language itself?

I would not say it's impossible to use some language feature to declare
what to export. The main issue is the immediate execution which the
code is compiled.

Trying to find the analogy to C++ here, we only have the compilation
step where you do "gcc -o program.exe file.c" and the analog part would
be "openscad -o model.stl file.scad".
So mapping the immediate execution of export() to gcc would be like
exporting another file while the compiler is running via #export file.out
or something similar.

Actually running as program does not really happen with OpenSCAD models,
as they are essentially a data structure that is evaluated by different
things.

Those things can be:

  • F5 preview renderer in OpenSCAD GUI
  • F6 mesh calculation in OpenSCAD GUI or command line
  • various exports to different formats in OpenSCAD GUI or command line
  • import into other programs, namely FreeCAD

Most notably here is the last point which highlights the interpretation
of SCAD (or it's simplified form CSG) files as data. What would FreeCAD
do with an export() node when reading the file?

It's true that echo() is also fitting into that problem area, it mainly
has the argument that there would be almost no debugging possibility
without it.

I think having some capabilities to markup/annotate parts of a model
to tell the OpenSCAD GUI what to do when interpreting the data could
cover both issues: a) leaving the scad script as a data description
while still b) allowing the user to export multiple parts at once.
All this without interfering with other programs that might want to
import the file or making the preview slow due to forced mesh generation.
Also annotations allow more control about export details, as for
instance the DXF export would benefit from defining model parts
as different layer while still exporting into a single file.

Maybe we can work together moving into that direction? The actual
feature for exporting multiple files / multiple layer would be
awesome to have and surely welcomed by a number of people.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org javascript:;
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

The animate feature doesn't create an output file for each frame *unless* you select the "dump images" option. There's currently no option to export each frame as stl. *If* we added such a feature, only then would it make sense to export tagged subtrees as stl for each frame. On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 01/06/2016 08:57 PM, Mihail Vasiliev wrote: > > 1. How is the difference between preview and render mode handled with > > export()? > > > > The very exact way another side-effecting operation - "echo" does. > > It does it's dirty job on "instantiate" call to corresponding > AbstractNode. > > > So it would try to generate the full mesh (aka. F6) for this part > of the model for each preview and export the file. I don't think > this is a good way of handling it. See below for more details... > > > 3. How will that interact with animation? > > > > Yes, I regenerates file on each frame, and can be used to create series > > of exported files of each time step. e.g. the code: > > > > export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); > > > Ok, that might be useful in some rare cases, but it looks a bit like > misusing the animation feature. > > > 1. OpenSCAD is not a procedural programming language. It is a purely > > declarative language for describing geometry. This is the primary issue. > > > > And why the way to output for this geometry is obligated to be declared > > in command line, not in the language itself? > > > I would not say it's impossible to use some language feature to declare > what to export. The main issue is the immediate execution which the > code is compiled. > > Trying to find the analogy to C++ here, we _only_ have the compilation > step where you do "gcc -o program.exe file.c" and the analog part would > be "openscad -o model.stl file.scad". > So mapping the immediate execution of export() to gcc would be like > exporting another file while the compiler is running via #export file.out > or something similar. > > Actually running as program does not really happen with OpenSCAD models, > as they are essentially a data structure that is evaluated by different > things. > > Those things can be: > * F5 preview renderer in OpenSCAD GUI > * F6 mesh calculation in OpenSCAD GUI or command line > * various exports to different formats in OpenSCAD GUI or command line > * import into other programs, namely FreeCAD > > Most notably here is the last point which highlights the interpretation > of SCAD (or it's simplified form CSG) files as data. What would FreeCAD > do with an export() node when reading the file? > > It's true that echo() is also fitting into that problem area, it mainly > has the argument that there would be almost no debugging possibility > without it. > > I think having some capabilities to markup/annotate parts of a model > to tell the OpenSCAD GUI what to do when interpreting the data could > cover both issues: a) leaving the scad script as a data description > while still b) allowing the user to export multiple parts at once. > All this without interfering with other programs that might want to > import the file or making the preview slow due to forced mesh generation. > Also annotations allow more control about export details, as for > instance the DXF export would benefit from defining model parts > as different layer while still exporting into a single file. > > Maybe we can work together moving into that direction? The actual > feature for exporting multiple files / multiple layer would be > awesome to have and surely welcomed by a number of people. > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <javascript:;> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
MV
Mihail Vasiliev
Fri, Jan 8, 2016 11:22 PM

May be it's better to leave this decision to end user, whether to use
export keyword or not?

On compatibility with other software-I'm not sure, how FreeCAD parses
unknown predicates, but if it behaves like OpenSCAD - just ignores
corresponding subtree, everythings should be fine - it will just show the
same - nothing.
8 янв. 2016 г. 9:58 PM пользователь "doug moen" doug@moens.org написал:

The animate feature doesn't create an output file for each frame unless
you select the "dump images" option. There's currently no option to export
each frame as stl. If we added such a feature, only then would it make
sense to export tagged subtrees as stl for each frame.

On Friday, 8 January 2016, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/06/2016 08:57 PM, Mihail Vasiliev wrote:

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding

AbstractNode.

So it would try to generate the full mesh (aka. F6) for this part
of the model for each preview and export the file. I don't think
this is a good way of handling it. See below for more details...

  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create series
of exported files of each time step. e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

Ok, that might be useful in some rare cases, but it looks a bit like
misusing the animation feature.

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be declared
in command line, not in the language itself?

I would not say it's impossible to use some language feature to declare
what to export. The main issue is the immediate execution which the
code is compiled.

Trying to find the analogy to C++ here, we only have the compilation
step where you do "gcc -o program.exe file.c" and the analog part would
be "openscad -o model.stl file.scad".
So mapping the immediate execution of export() to gcc would be like
exporting another file while the compiler is running via #export file.out
or something similar.

Actually running as program does not really happen with OpenSCAD models,
as they are essentially a data structure that is evaluated by different
things.

Those things can be:

  • F5 preview renderer in OpenSCAD GUI
  • F6 mesh calculation in OpenSCAD GUI or command line
  • various exports to different formats in OpenSCAD GUI or command line
  • import into other programs, namely FreeCAD

Most notably here is the last point which highlights the interpretation
of SCAD (or it's simplified form CSG) files as data. What would FreeCAD
do with an export() node when reading the file?

It's true that echo() is also fitting into that problem area, it mainly
has the argument that there would be almost no debugging possibility
without it.

I think having some capabilities to markup/annotate parts of a model
to tell the OpenSCAD GUI what to do when interpreting the data could
cover both issues: a) leaving the scad script as a data description
while still b) allowing the user to export multiple parts at once.
All this without interfering with other programs that might want to
import the file or making the preview slow due to forced mesh generation.
Also annotations allow more control about export details, as for
instance the DXF export would benefit from defining model parts
as different layer while still exporting into a single file.

Maybe we can work together moving into that direction? The actual
feature for exporting multiple files / multiple layer would be
awesome to have and surely welcomed by a number of people.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

May be it's better to leave this decision to end user, whether to use export keyword or not? On compatibility with other software-I'm not sure, how FreeCAD parses unknown predicates, but if it behaves like OpenSCAD - just ignores corresponding subtree, everythings should be fine - it will just show the same - nothing. 8 янв. 2016 г. 9:58 PM пользователь "doug moen" <doug@moens.org> написал: > The animate feature doesn't create an output file for each frame *unless* > you select the "dump images" option. There's currently no option to export > each frame as stl. *If* we added such a feature, only then would it make > sense to export tagged subtrees as stl for each frame. > > On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de> wrote: > >> On 01/06/2016 08:57 PM, Mihail Vasiliev wrote: >> > 1. How is the difference between preview and render mode handled with >> > export()? >> > >> > The very exact way another side-effecting operation - "echo" does. >> > It does it's dirty job on "instantiate" call to corresponding >> AbstractNode. >> > >> So it would try to generate the full mesh (aka. F6) for this part >> of the model for each preview and export the file. I don't think >> this is a good way of handling it. See below for more details... >> >> > 3. How will that interact with animation? >> > >> > Yes, I regenerates file on each frame, and can be used to create series >> > of exported files of each time step. e.g. the code: >> > >> > export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); >> > >> Ok, that might be useful in some rare cases, but it looks a bit like >> misusing the animation feature. >> >> > 1. OpenSCAD is not a procedural programming language. It is a purely >> > declarative language for describing geometry. This is the primary issue. >> > >> > And why the way to output for this geometry is obligated to be declared >> > in command line, not in the language itself? >> > >> I would not say it's impossible to use some language feature to declare >> what to export. The main issue is the immediate execution which the >> code is compiled. >> >> Trying to find the analogy to C++ here, we _only_ have the compilation >> step where you do "gcc -o program.exe file.c" and the analog part would >> be "openscad -o model.stl file.scad". >> So mapping the immediate execution of export() to gcc would be like >> exporting another file while the compiler is running via #export file.out >> or something similar. >> >> Actually running as program does not really happen with OpenSCAD models, >> as they are essentially a data structure that is evaluated by different >> things. >> >> Those things can be: >> * F5 preview renderer in OpenSCAD GUI >> * F6 mesh calculation in OpenSCAD GUI or command line >> * various exports to different formats in OpenSCAD GUI or command line >> * import into other programs, namely FreeCAD >> >> Most notably here is the last point which highlights the interpretation >> of SCAD (or it's simplified form CSG) files as data. What would FreeCAD >> do with an export() node when reading the file? >> >> It's true that echo() is also fitting into that problem area, it mainly >> has the argument that there would be almost no debugging possibility >> without it. >> >> I think having some capabilities to markup/annotate parts of a model >> to tell the OpenSCAD GUI what to do when interpreting the data could >> cover both issues: a) leaving the scad script as a data description >> while still b) allowing the user to export multiple parts at once. >> All this without interfering with other programs that might want to >> import the file or making the preview slow due to forced mesh generation. >> Also annotations allow more control about export details, as for >> instance the DXF export would benefit from defining model parts >> as different layer while still exporting into a single file. >> >> Maybe we can work together moving into that direction? The actual >> feature for exporting multiple files / multiple layer would be >> awesome to have and surely welcomed by a number of people. >> >> ciao, >> Torsten. >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
ER
Ezra Reynolds
Sat, Jan 9, 2016 2:59 AM

I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't
support hull() or offset() as of the most current version (hull is split
into its components, offset throws nasty errors).

I have created many designs that have multiple subassemblies.  They are
all inter-related pieces of the same design (e.g. top, bottom, middle,
with matching screw-holes, standoffs, etc.)  Since they share variables,
it is logical for them to to share a .SCAD file.  Yes, I know how to use
a batch file or script to do all this, but I would say it is more

I normally arrange the pieces in OpenSCAD for 3D printing (many discrete
volumes as a single STL).  This works up to the point where I have a
single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate each
part, render as an STL, save it with the correct name, rinse and repeat.
Not a problem with a three-part assembly, but could be a problem with
file that generates two dozen variations on a theme.

For my needs, an export("part1.stl") {subtree}  approach would work,
where the subtree is rendered to screen/cache (exactly like render()),
but is also exported to disk as the last step of the process.

For example:
export("top.stl") top();
translate ([20, 0, 0]) export("middle.stl") middle ();
translate ([-20, 0, 0]) export("bottom.stl") bottom();

F5 Preview - no difference, objects are rendered and shown

F6 Render - objects are rendered, displayed on screen.  Export subtrees
are written to disk, allowing user to still save whole render as .STL or
.AMF or whatever.  This guarantees I have a current (top, middle,
bottom) and not a top from two revisions ago.

Or maybe have a "Super F6" (shift+F6?) that handles the export()
commands or whatever other metadata functions we need.  I like
doug.moen's suggestion about handling this as metadata; you could
implement as a post-process function.

From my vantage point, export is still "Object Description" and not
"general programming"; it is describing the shape of the sub object, and
how it stored on the disk.

One potential problem that hasn't been mentioned is that if export()
triggers a render+write RIGHT NOW that can lead to a race condition; if
I export "X.stl" and use "X.stl" in other parts of the same file - does
it use the previous "X.stl" or the just-rendered version....

On 1/8/2016 6:22 PM, Mihail Vasiliev wrote:

May be it's better to leave this decision to end user, whether to use
export keyword or not?

On compatibility with other software-I'm not sure, how FreeCAD parses
unknown predicates, but if it behaves like OpenSCAD - just ignores
corresponding subtree, everythings should be fine - it will just show
the same - nothing.

8 янв. 2016 г. 9:58 PM пользователь "doug moen" <doug@moens.org
mailto:doug@moens.org> написал:

 The animate feature doesn't create an output file for each frame
 *unless* you select the "dump images" option. There's currently no
 option to export each frame as stl. *If* we added such a feature,
 only then would it make sense to export tagged subtrees as stl for
 each frame.

 On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de
 <mailto:Torsten.Paul@gmx.de>> wrote:

     On 01/06/2016 08:57 PM, Mihail Vasiliev wrote:
  1. How is the difference between preview and render mode
     handled with

export()?

The very exact way another side-effecting operation - "echo"

     does.

It does it's dirty job on "instantiate" call to corresponding

     AbstractNode.
     So it would try to generate the full mesh (aka. F6) for this part
     of the model for each preview and export the file. I don't think
     this is a good way of handling it. See below for more details...
  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to

     create series

of exported files of each time step. e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0])

     cube([10,10,10]);
     Ok, that might be useful in some rare cases, but it looks a bit like
     misusing the animation feature.
  1. OpenSCAD is not a procedural programming language. It is a
     purely

declarative language for describing geometry. This is the

     primary issue.

And why the way to output for this geometry is obligated to

     be declared

in command line, not in the language itself?

     I would not say it's impossible to use some language feature to
     declare
     what to export. The main issue is the immediate execution which the
     code is compiled.

     Trying to find the analogy to C++ here, we _only_ have the
     compilation
     step where you do "gcc -o program.exe file.c" and the analog
     part would
     be "openscad -o model.stl file.scad".
     So mapping the immediate execution of export() to gcc would be like
     exporting another file while the compiler is running via #export
     file.out
     or something similar.

     Actually running as program does not really happen with OpenSCAD
     models,
     as they are essentially a data structure that is evaluated by
     different
     things.

     Those things can be:
     * F5 preview renderer in OpenSCAD GUI
     * F6 mesh calculation in OpenSCAD GUI or command line
     * various exports to different formats in OpenSCAD GUI or
     command line
     * import into other programs, namely FreeCAD

     Most notably here is the last point which highlights the
     interpretation
     of SCAD (or it's simplified form CSG) files as data. What would
     FreeCAD
     do with an export() node when reading the file?

     It's true that echo() is also fitting into that problem area, it
     mainly
     has the argument that there would be almost no debugging possibility
     without it.

     I think having some capabilities to markup/annotate parts of a model
     to tell the OpenSCAD GUI what to do when interpreting the data could
     cover both issues: a) leaving the scad script as a data description
     while still b) allowing the user to export multiple parts at once.
     All this without interfering with other programs that might want to
     import the file or making the preview slow due to forced mesh
     generation.
     Also annotations allow more control about export details, as for
     instance the DXF export would benefit from defining model parts
     as different layer while still exporting into a single file.

     Maybe we can work together moving into that direction? The actual
     feature for exporting multiple files / multiple layer would be
     awesome to have and surely welcomed by a number of people.

     ciao,
        Torsten.


     _______________________________________________
     OpenSCAD mailing list
     Discuss@lists.openscad.org
     http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



 _______________________________________________
 OpenSCAD mailing list
 Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org>
 http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't support hull() or offset() as of the most current version (hull is split into its components, offset throws nasty errors). I have created many designs that have multiple subassemblies. They are all inter-related pieces of the same design (e.g. top, bottom, middle, with matching screw-holes, standoffs, etc.) Since they share variables, it is logical for them to to share a .SCAD file. Yes, I know how to use a batch file or script to do all this, but I would say it is more I normally arrange the pieces in OpenSCAD for 3D printing (many discrete volumes as a single STL). This works up to the point where I have a single part, or several parts, fail during printing / derafting/assembly. It is an error-prone thing to manually isolate each part, render as an STL, save it with the correct name, rinse and repeat. Not a problem with a three-part assembly, but could be a problem with file that generates two dozen variations on a theme. For my needs, an export("part1.stl") {subtree} approach would work, where the subtree is rendered to screen/cache (exactly like render()), but is also exported to disk as the last step of the process. For example: export("top.stl") top(); translate ([20, 0, 0]) export("middle.stl") middle (); translate ([-20, 0, 0]) export("bottom.stl") bottom(); F5 Preview - no difference, objects are rendered and shown F6 Render - objects are rendered, displayed on screen. Export subtrees are written to disk, allowing user to still save whole render as .STL or .AMF or whatever. This guarantees I have a current (top, middle, bottom) and not a top from two revisions ago. Or maybe have a "Super F6" (shift+F6?) that handles the export() commands or whatever other metadata functions we need. I like doug.moen's suggestion about handling this as metadata; you could implement as a post-process function. From my vantage point, export is still "Object Description" and not "general programming"; it is describing the shape of the sub object, and how it stored on the disk. One potential problem that hasn't been mentioned is that if export() triggers a render+write RIGHT NOW that can lead to a race condition; if I export "X.stl" and use "X.stl" in other parts of the same file - does it use the previous "X.stl" or the just-rendered version.... On 1/8/2016 6:22 PM, Mihail Vasiliev wrote: > May be it's better to leave this decision to end user, whether to use > export keyword or not? > > On compatibility with other software-I'm not sure, how FreeCAD parses > unknown predicates, but if it behaves like OpenSCAD - just ignores > corresponding subtree, everythings should be fine - it will just show > the same - nothing. > > 8 янв. 2016 г. 9:58 PM пользователь "doug moen" <doug@moens.org > <mailto:doug@moens.org>> написал: > > The animate feature doesn't create an output file for each frame > *unless* you select the "dump images" option. There's currently no > option to export each frame as stl. *If* we added such a feature, > only then would it make sense to export tagged subtrees as stl for > each frame. > > On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de > <mailto:Torsten.Paul@gmx.de>> wrote: > > On 01/06/2016 08:57 PM, Mihail Vasiliev wrote: > > 1. How is the difference between preview and render mode > handled with > > export()? > > > > The very exact way another side-effecting operation - "echo" > does. > > It does it's dirty job on "instantiate" call to corresponding > AbstractNode. > > > So it would try to generate the full mesh (aka. F6) for this part > of the model for each preview and export the file. I don't think > this is a good way of handling it. See below for more details... > > > 3. How will that interact with animation? > > > > Yes, I regenerates file on each frame, and can be used to > create series > > of exported files of each time step. e.g. the code: > > > > export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) > cube([10,10,10]); > > > Ok, that might be useful in some rare cases, but it looks a bit like > misusing the animation feature. > > > 1. OpenSCAD is not a procedural programming language. It is a > purely > > declarative language for describing geometry. This is the > primary issue. > > > > And why the way to output for this geometry is obligated to > be declared > > in command line, not in the language itself? > > > I would not say it's impossible to use some language feature to > declare > what to export. The main issue is the immediate execution which the > code is compiled. > > Trying to find the analogy to C++ here, we _only_ have the > compilation > step where you do "gcc -o program.exe file.c" and the analog > part would > be "openscad -o model.stl file.scad". > So mapping the immediate execution of export() to gcc would be like > exporting another file while the compiler is running via #export > file.out > or something similar. > > Actually running as program does not really happen with OpenSCAD > models, > as they are essentially a data structure that is evaluated by > different > things. > > Those things can be: > * F5 preview renderer in OpenSCAD GUI > * F6 mesh calculation in OpenSCAD GUI or command line > * various exports to different formats in OpenSCAD GUI or > command line > * import into other programs, namely FreeCAD > > Most notably here is the last point which highlights the > interpretation > of SCAD (or it's simplified form CSG) files as data. What would > FreeCAD > do with an export() node when reading the file? > > It's true that echo() is also fitting into that problem area, it > mainly > has the argument that there would be almost no debugging possibility > without it. > > I think having some capabilities to markup/annotate parts of a model > to tell the OpenSCAD GUI what to do when interpreting the data could > cover both issues: a) leaving the scad script as a data description > while still b) allowing the user to export multiple parts at once. > All this without interfering with other programs that might want to > import the file or making the preview slow due to forced mesh > generation. > Also annotations allow more control about export details, as for > instance the DXF export would benefit from defining model parts > as different layer while still exporting into a single file. > > Maybe we can work together moving into that direction? The actual > feature for exporting multiple files / multiple layer would be > awesome to have and surely welcomed by a number of people. > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org <mailto:Discuss@lists.openscad.org> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
YA
Yona Appletree
Sat, Jan 9, 2016 3:10 AM

I have very much the same workflow, and really like the idea of being
able to tag a subtree as being a logically separate, named, object.

This would allow more than just exporting groups of objects at once
(which as mentioned would be much better than rendering each part
separately and manually entering filenames). It would be really neat if
the preview window had, for instance, a dropdown where you could either
view the entire generated tree or view each of the tagged subtrees on
their own. Effectively and after-the-fact application of the re-root (!)
operator.

In this same vein, having an export option that would automatically
create a new folder for the specific export instance that is timestamped
or versioned would be very awesome. Then, the current, many-step
workflow for rendering, examining, and exporting a new version of a
multipart model would be a click or two.

~ Yona

Ezra Reynolds mailto:shadowwynd@gmail.com
January 8, 2016 at 18:59
I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't
support hull() or offset() as of the most current version (hull is
split into its components, offset throws nasty errors).

I have created many designs that have multiple subassemblies.  They
are all inter-related pieces of the same design (e.g. top, bottom,
middle, with matching screw-holes, standoffs, etc.)  Since they share
variables, it is logical for them to to share a .SCAD file.  Yes, I
know how to use a batch file or script to do all this, but I would say
it is more

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.

For my needs, an export("part1.stl") {subtree}  approach would work,
where the subtree is rendered to screen/cache (exactly like render()),
but is also exported to disk as the last step of the process.

For example:
export("top.stl") top();
translate ([20, 0, 0]) export("middle.stl") middle ();
translate ([-20, 0, 0]) export("bottom.stl") bottom();

F5 Preview - no difference, objects are rendered and shown

F6 Render - objects are rendered, displayed on screen.  Export
subtrees are written to disk, allowing user to still save whole render
as .STL or .AMF or whatever.  This guarantees I have a current (top,
middle, bottom) and not a top from two revisions ago.

Or maybe have a "Super F6" (shift+F6?) that handles the export()
commands or whatever other metadata functions we need.  I like
doug.moen's suggestion about handling this as metadata; you could
implement as a post-process function.

From my vantage point, export is still "Object Description" and not
"general programming"; it is describing the shape of the sub object,
and how it stored on the disk.

One potential problem that hasn't been mentioned is that if export()
triggers a render+write RIGHT NOW that can lead to a race condition;
if I export "X.stl" and use "X.stl" in other parts of the same file -
does it use the previous "X.stl" or the just-rendered version....


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Mihail Vasiliev mailto:mickvav@gmail.com
January 8, 2016 at 15:22

May be it's better to leave this decision to end user, whether to use
export keyword or not?

On compatibility with other software-I'm not sure, how FreeCAD parses
unknown predicates, but if it behaves like OpenSCAD - just ignores
corresponding subtree, everythings should be fine - it will just show
the same - nothing.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
doug moen mailto:doug@moens.org
January 8, 2016 at 10:57
The animate feature doesn't create an output file for each frame
unless you select the "dump images" option. There's currently no
option to export each frame as stl. If we added such a feature, only
then would it make sense to export tagged subtrees as stl for each frame.

On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de
mailto:Torsten.Paul@gmx.de> wrote:


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Torsten Paul mailto:Torsten.Paul@gmx.de
January 8, 2016 at 09:42
On 01/06/2016 08:57 PM, Mihail Vasiliev wrote:

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding AbstractNode.

So it would try to generate the full mesh (aka. F6) for this part
of the model for each preview and export the file. I don't think
this is a good way of handling it. See below for more details...

  1. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create series
of exported files of each time step. e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

Ok, that might be useful in some rare cases, but it looks a bit like
misusing the animation feature.

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be declared
in command line, not in the language itself?

I would not say it's impossible to use some language feature to declare
what to export. The main issue is the immediate execution which the
code is compiled.

Trying to find the analogy to C++ here, we only have the compilation
step where you do "gcc -o program.exe file.c" and the analog part would
be "openscad -o model.stl file.scad".
So mapping the immediate execution of export() to gcc would be like
exporting another file while the compiler is running via #export file.out
or something similar.

Actually running as program does not really happen with OpenSCAD models,
as they are essentially a data structure that is evaluated by different
things.

Those things can be:

  • F5 preview renderer in OpenSCAD GUI
  • F6 mesh calculation in OpenSCAD GUI or command line
  • various exports to different formats in OpenSCAD GUI or command line
  • import into other programs, namely FreeCAD

Most notably here is the last point which highlights the interpretation
of SCAD (or it's simplified form CSG) files as data. What would FreeCAD
do with an export() node when reading the file?

It's true that echo() is also fitting into that problem area, it mainly
has the argument that there would be almost no debugging possibility
without it.

I think having some capabilities to markup/annotate parts of a model
to tell the OpenSCAD GUI what to do when interpreting the data could
cover both issues: a) leaving the scad script as a data description
while still b) allowing the user to export multiple parts at once.
All this without interfering with other programs that might want to
import the file or making the preview slow due to forced mesh generation.
Also annotations allow more control about export details, as for
instance the DXF export would benefit from defining model parts
as different layer while still exporting into a single file.

Maybe we can work together moving into that direction? The actual
feature for exporting multiple files / multiple layer would be
awesome to have and surely welcomed by a number of people.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Mihail Vasiliev mailto:mickvav@gmail.com
January 6, 2016 at 11:57
Hi, Doug, Torsten.

I'll try to answer Torsten's questions first.

  1. How is the difference between preview and render mode handled with
    export()?

The very exact way another side-effecting operation - "echo" does.
It does it's dirty job on "instantiate" call to corresponding
AbstractNode.

  1. Will that always force the mesh generation and export the
    file on F5?

It's action is triggered at the same times as echo's.
As for now, it actually calls instantiateChildren on it's children
nodes. (I don't know, whether this function it use caches internally.
I can dig it, if it's necessary.)
Than it applies freshly-created GeometryEvaluator on the first of
these children and exports resulted geometry in supplied file,
determining it's type by it's name.
3. How will that interact with animation?

Yes, I regenerates file on each frame, and can be used to create
series of exported files of each time step.
e.g. the code:

export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]);

generates several stl files with different names, as expected.

Now on Doug's questions:

  1. OpenSCAD is not a procedural programming language. It is a purely
    declarative language for describing geometry. This is the primary issue.

And why the way to output for this geometry is obligated to be
declared in command line, not in the language itself?

  1. You can't add a procedural, side effect causing 'export()' command
    to the language because it doesn't make any sense to export a shape to
    a file while the script is being evaluated: this would mess up preview
    performance. Once again, this is a side issue, like security. It's a
    technical issue which underlies the fundamental design decision that
    OpenSCAD is a declarative language (see point 1 above).

This technocal issue can be addressed by adding some extra argument to
export to make it skip it's operation in preview mode, for example. I
can do it, as well as security restrictions, regression tests and so
on, if the community is interested in the feature itself.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I have very much the same workflow, and really like the idea of being able to tag a subtree as being a logically separate, named, object. This would allow more than just exporting groups of objects at once (which as mentioned would be much better than rendering each part separately and manually entering filenames). It would be really neat if the preview window had, for instance, a dropdown where you could either view the entire generated tree or view each of the tagged subtrees on their own. Effectively and after-the-fact application of the re-root (!) operator. In this same vein, having an export option that would automatically create a new folder for the specific export instance that is timestamped or versioned would be very awesome. Then, the current, many-step workflow for rendering, examining, and exporting a new version of a multipart model would be a click or two. ~ Yona > Ezra Reynolds <mailto:shadowwynd@gmail.com> > January 8, 2016 at 18:59 > I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't > support hull() or offset() as of the most current version (hull is > split into its components, offset throws nasty errors). > > I have created many designs that have multiple subassemblies. They > are all inter-related pieces of the same design (e.g. top, bottom, > middle, with matching screw-holes, standoffs, etc.) Since they share > variables, it is logical for them to to share a .SCAD file. Yes, I > know how to use a batch file or script to do all this, but I would say > it is more > > I normally arrange the pieces in OpenSCAD for 3D printing (many > discrete volumes as a single STL). This works up to the point where I > have a single part, or several parts, fail during printing / > derafting/assembly. It is an error-prone thing to manually isolate > each part, render as an STL, save it with the correct name, rinse and > repeat. Not a problem with a three-part assembly, but could be a > problem with file that generates two dozen variations on a theme. > > > For my needs, an export("part1.stl") {subtree} approach would work, > where the subtree is rendered to screen/cache (exactly like render()), > but is also exported to disk as the last step of the process. > > For example: > export("top.stl") top(); > translate ([20, 0, 0]) export("middle.stl") middle (); > translate ([-20, 0, 0]) export("bottom.stl") bottom(); > > F5 Preview - no difference, objects are rendered and shown > > F6 Render - objects are rendered, displayed on screen. Export > subtrees are written to disk, allowing user to still save whole render > as .STL or .AMF or whatever. This guarantees I have a current (top, > middle, bottom) and not a top from two revisions ago. > > Or maybe have a "Super F6" (shift+F6?) that handles the export() > commands or whatever other metadata functions we need. I like > doug.moen's suggestion about handling this as metadata; you could > implement as a post-process function. > > From my vantage point, export is still "Object Description" and not > "general programming"; it is describing the shape of the sub object, > and how it stored on the disk. > > One potential problem that hasn't been mentioned is that if export() > triggers a render+write RIGHT NOW that can lead to a race condition; > if I export "X.stl" and use "X.stl" in other parts of the same file - > does it use the previous "X.stl" or the just-rendered version.... > > > > > > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Mihail Vasiliev <mailto:mickvav@gmail.com> > January 8, 2016 at 15:22 > > May be it's better to leave this decision to end user, whether to use > export keyword or not? > > On compatibility with other software-I'm not sure, how FreeCAD parses > unknown predicates, but if it behaves like OpenSCAD - just ignores > corresponding subtree, everythings should be fine - it will just show > the same - nothing. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > doug moen <mailto:doug@moens.org> > January 8, 2016 at 10:57 > The animate feature doesn't create an output file for each frame > *unless* you select the "dump images" option. There's currently no > option to export each frame as stl. *If* we added such a feature, only > then would it make sense to export tagged subtrees as stl for each frame. > > On Friday, 8 January 2016, Torsten Paul <Torsten.Paul@gmx.de > <mailto:Torsten.Paul@gmx.de>> wrote: > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Torsten Paul <mailto:Torsten.Paul@gmx.de> > January 8, 2016 at 09:42 > On 01/06/2016 08:57 PM, Mihail Vasiliev wrote: >> 1. How is the difference between preview and render mode handled with >> export()? >> >> The very exact way another side-effecting operation - "echo" does. >> It does it's dirty job on "instantiate" call to corresponding AbstractNode. >> > So it would try to generate the full mesh (aka. F6) for this part > of the model for each preview and export the file. I don't think > this is a good way of handling it. See below for more details... > >> 3. How will that interact with animation? >> >> Yes, I regenerates file on each frame, and can be used to create series >> of exported files of each time step. e.g. the code: >> >> export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); >> > Ok, that might be useful in some rare cases, but it looks a bit like > misusing the animation feature. > >> 1. OpenSCAD is not a procedural programming language. It is a purely >> declarative language for describing geometry. This is the primary issue. >> >> And why the way to output for this geometry is obligated to be declared >> in command line, not in the language itself? >> > I would not say it's impossible to use some language feature to declare > what to export. The main issue is the immediate execution which the > code is compiled. > > Trying to find the analogy to C++ here, we _only_ have the compilation > step where you do "gcc -o program.exe file.c" and the analog part would > be "openscad -o model.stl file.scad". > So mapping the immediate execution of export() to gcc would be like > exporting another file while the compiler is running via #export file.out > or something similar. > > Actually running as program does not really happen with OpenSCAD models, > as they are essentially a data structure that is evaluated by different > things. > > Those things can be: > * F5 preview renderer in OpenSCAD GUI > * F6 mesh calculation in OpenSCAD GUI or command line > * various exports to different formats in OpenSCAD GUI or command line > * import into other programs, namely FreeCAD > > Most notably here is the last point which highlights the interpretation > of SCAD (or it's simplified form CSG) files as data. What would FreeCAD > do with an export() node when reading the file? > > It's true that echo() is also fitting into that problem area, it mainly > has the argument that there would be almost no debugging possibility > without it. > > I think having some capabilities to markup/annotate parts of a model > to tell the OpenSCAD GUI what to do when interpreting the data could > cover both issues: a) leaving the scad script as a data description > while still b) allowing the user to export multiple parts at once. > All this without interfering with other programs that might want to > import the file or making the preview slow due to forced mesh generation. > Also annotations allow more control about export details, as for > instance the DXF export would benefit from defining model parts > as different layer while still exporting into a single file. > > Maybe we can work together moving into that direction? The actual > feature for exporting multiple files / multiple layer would be > awesome to have and surely welcomed by a number of people. > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Mihail Vasiliev <mailto:mickvav@gmail.com> > January 6, 2016 at 11:57 > Hi, Doug, Torsten. > > I'll try to answer Torsten's questions first. > > 1. How is the difference between preview and render mode handled with > export()? > > The very exact way another side-effecting operation - "echo" does. > It does it's dirty job on "instantiate" call to corresponding > AbstractNode. > > 2. Will that always force the mesh generation and export the > file on F5? > > It's action is triggered at the same times as echo's. > As for now, it actually calls instantiateChildren on it's children > nodes. (I don't know, whether this function it use caches internally. > I can dig it, if it's necessary.) > Than it applies freshly-created GeometryEvaluator on the first of > these children and exports resulted geometry in supplied file, > determining it's type by it's name. > 3. How will that interact with animation? > > Yes, I regenerates file on each frame, and can be used to create > series of exported files of each time step. > e.g. the code: > > export(file=str("gg",$t,".stl")) rotate([$t*50,0,0]) cube([10,10,10]); > > generates several stl files with different names, as expected. > > Now on Doug's questions: > > 1. OpenSCAD is not a procedural programming language. It is a purely > declarative language for describing geometry. This is the primary issue. > > And why the way to output for this geometry is obligated to be > declared in command line, not in the language itself? > > 2. You can't add a procedural, side effect causing 'export()' command > to the language because it doesn't make any sense to export a shape to > a file while the script is being evaluated: this would mess up preview > performance. Once again, this is a side issue, like security. It's a > technical issue which underlies the fundamental design decision that > OpenSCAD is a declarative language (see point 1 above). > > This technocal issue can be addressed by adding some extra argument to > export to make it skip it's operation in preview mode, for example. I > can do it, as well as security restrictions, regression tests and so > on, if the community is interested in the feature itself. > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
MS
Mark Schafer
Sat, Jan 9, 2016 3:24 AM

would this be equivalent to allowing render() to have an export keyword ?

would this be equivalent to allowing render() to have an export keyword ?
M
MichaelAtOz
Sat, Jan 9, 2016 4:51 AM

We have had this discussion  before
http://forum.openscad.org/Multi-material-support-was-Re-OpenSCAD-3000-td8613.html
, re multi-material support.


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/export-function-tp15428p15583.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

We have had this discussion before <http://forum.openscad.org/Multi-material-support-was-Re-OpenSCAD-3000-td8613.html> , re multi-material support. ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/export-function-tp15428p15583.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jon
Sat, Jan 9, 2016 11:07 AM

I create modules for each part, list them at the bottom of the script,
and then use ! to create the geometry for the part that I wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.

I create modules for each part, list them at the bottom of the script, and then use ! to create the geometry for the part that I wish to print. On 1/8/2016 9:59 PM, Ezra Reynolds wrote: > I normally arrange the pieces in OpenSCAD for 3D printing (many > discrete volumes as a single STL). This works up to the point where I > have a single part, or several parts, fail during printing / > derafting/assembly. It is an error-prone thing to manually isolate > each part, render as an STL, save it with the correct name, rinse and > repeat. Not a problem with a three-part assembly, but could be a > problem with file that generates two dozen variations on a theme.
ER
Ezra Reynolds
Sat, Jan 9, 2016 12:26 PM

That could work well.

On 1/8/2016 10:24 PM, Mark Schafer wrote:

would this be equivalent to allowing render() to have an export keyword ?


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

That could work well. On 1/8/2016 10:24 PM, Mark Schafer wrote: > would this be equivalent to allowing render() to have an export keyword ? > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
ER
Ezra Reynolds
Sat, Jan 9, 2016 12:38 PM

I do the same, many of my files have a list of

*!module1Name();
*!module2Name();

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it easier
to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:

I create modules for each part, list them at the bottom of the script,
and then use ! to create the geometry for the part that I wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.

I do the same, many of my files have a list of *!module1Name(); *!module2Name(); at the bottom so that I can easily turn pieces off and on. However, if using a generator: for (i=[0 : 10]) { for (j=[0 : 10]) { translate ([i*20, j*20, 0]) smallPartGenerator(i, j); } } I then have 100 individual volumes on a build plate which is NOT as easy to toggle. If we had an export command, then I could have an export("R"+str(i) + "C"+str(j) + ".STL"); in the mix and get 100 STL files out of the deal; this makes it easier to get a specific replacement without reprinting all 100. On 1/9/2016 6:07 AM, jon wrote: > I create modules for each part, list them at the bottom of the script, > and then use ! to create the geometry for the part that I wish to print. > > On 1/8/2016 9:59 PM, Ezra Reynolds wrote: >> I normally arrange the pieces in OpenSCAD for 3D printing (many >> discrete volumes as a single STL). This works up to the point where I >> have a single part, or several parts, fail during printing / >> derafting/assembly. It is an error-prone thing to manually isolate >> each part, render as an STL, save it with the correct name, rinse and >> repeat. Not a problem with a three-part assembly, but could be a >> problem with file that generates two dozen variations on a theme. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
J
jon
Sat, Jan 9, 2016 1:03 PM

I agree that this would be a useful improvement!

On 1/9/2016 7:38 AM, Ezra Reynolds wrote:

I do the same, many of my files have a list of

 *!module1Name();
 *!module2Name();

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it easier
to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:

I create modules for each part, list them at the bottom of the script,
and then use ! to create the geometry for the part that I wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7294 / Virus Database: 4489/11360 - Release Date:
01/09/16

I agree that this would be a useful improvement! On 1/9/2016 7:38 AM, Ezra Reynolds wrote: > I do the same, many of my files have a list of > > *!module1Name(); > *!module2Name(); > > at the bottom so that I can easily turn pieces off and on. > > However, if using a generator: > for (i=[0 : 10]) > { > for (j=[0 : 10]) > { > translate ([i*20, j*20, 0]) smallPartGenerator(i, j); > > } > } > > I then have 100 individual volumes on a build plate which is NOT as > easy to toggle. > > If we had an export command, then I could have an > export("R"+str(i) + "C"+str(j) + ".STL"); > in the mix and get 100 STL files out of the deal; this makes it easier > to get a specific replacement without reprinting all 100. > > > > On 1/9/2016 6:07 AM, jon wrote: >> I create modules for each part, list them at the bottom of the script, >> and then use ! to create the geometry for the part that I wish to print. >> >> On 1/8/2016 9:59 PM, Ezra Reynolds wrote: >>> I normally arrange the pieces in OpenSCAD for 3D printing (many >>> discrete volumes as a single STL). This works up to the point where I >>> have a single part, or several parts, fail during printing / >>> derafting/assembly. It is an error-prone thing to manually isolate >>> each part, render as an STL, save it with the correct name, rinse and >>> repeat. Not a problem with a three-part assembly, but could be a >>> problem with file that generates two dozen variations on a theme. >> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2016.0.7294 / Virus Database: 4489/11360 - Release Date: > 01/09/16 > >
NH
nop head
Sat, Jan 9, 2016 1:24 PM

Perhaps have export(file) treated the same as * for F5 and F6 but export
its subtree of geometry to the named file when a new Export "exports" menu
option is invoked. Doesn't that remove all the objections? It is just a
more convenient way of changing some *s at the bottom of the file, pressing
F6 and then invoking the Export menu. The code no longer has side effects,
the export is still an manual operation but can deliver a bunch of files.
The export doesn't appear in the CSG file but it could export a CSG file of
the things under it if the file type was CSG.

On 9 January 2016 at 13:03, jon jon@jonbondy.com wrote:

I agree that this would be a useful improvement!

On 1/9/2016 7:38 AM, Ezra Reynolds wrote:

I do the same, many of my files have a list of

 *!module1Name();
 *!module2Name();

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as easy
to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it easier to
get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:

I create modules for each part, list them at the bottom of the script,
and then use ! to create the geometry for the part that I wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7294 / Virus Database: 4489/11360 - Release Date: 01/09/16

Perhaps have export(file) treated the same as * for F5 and F6 but export its subtree of geometry to the named file when a new Export "exports" menu option is invoked. Doesn't that remove all the objections? It is just a more convenient way of changing some *s at the bottom of the file, pressing F6 and then invoking the Export menu. The code no longer has side effects, the export is still an manual operation but can deliver a bunch of files. The export doesn't appear in the CSG file but it could export a CSG file of the things under it if the file type was CSG. On 9 January 2016 at 13:03, jon <jon@jonbondy.com> wrote: > I agree that this would be a useful improvement! > > > On 1/9/2016 7:38 AM, Ezra Reynolds wrote: > >> I do the same, many of my files have a list of >> >> *!module1Name(); >> *!module2Name(); >> >> at the bottom so that I can easily turn pieces off and on. >> >> However, if using a generator: >> for (i=[0 : 10]) >> { >> for (j=[0 : 10]) >> { >> translate ([i*20, j*20, 0]) smallPartGenerator(i, j); >> >> } >> } >> >> I then have 100 individual volumes on a build plate which is NOT as easy >> to toggle. >> >> If we had an export command, then I could have an >> export("R"+str(i) + "C"+str(j) + ".STL"); >> in the mix and get 100 STL files out of the deal; this makes it easier to >> get a specific replacement without reprinting all 100. >> >> >> >> On 1/9/2016 6:07 AM, jon wrote: >> >>> I create modules for each part, list them at the bottom of the script, >>> and then use ! to create the geometry for the part that I wish to print. >>> >>> On 1/8/2016 9:59 PM, Ezra Reynolds wrote: >>> >>>> I normally arrange the pieces in OpenSCAD for 3D printing (many >>>> discrete volumes as a single STL). This works up to the point where I >>>> have a single part, or several parts, fail during printing / >>>> derafting/assembly. It is an error-prone thing to manually isolate >>>> each part, render as an STL, save it with the correct name, rinse and >>>> repeat. Not a problem with a three-part assembly, but could be a >>>> problem with file that generates two dozen variations on a theme. >>>> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >>> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> >> ----- >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2016.0.7294 / Virus Database: 4489/11360 - Release Date: 01/09/16 >> >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
YA
Yona Appletree
Sat, Jan 9, 2016 6:43 PM

Sounds pretty much exactly like what I'm looking for -- in addition to
being able to preview just one component from a drop-down menu post render.

nop head mailto:nop.head@gmail.com
January 9, 2016 at 05:24
Perhaps have export(file) treated the same as * for F5 and F6 but
export its subtree of geometry to the named file when a new Export
"exports" menu option is invoked. Doesn't that remove all the
objections? It is just a more convenient way of changing some *s at
the bottom of the file, pressing F6 and then invoking the Export menu.
The code no longer has side effects, the export is still an manual
operation but can deliver a bunch of files. The export doesn't appear
in the CSG file but it could export a CSG file of the things under it
if the file type was CSG.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
jon mailto:jon@jonbondy.com
January 9, 2016 at 05:03
I agree that this would be a useful improvement!


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ezra Reynolds mailto:shadowwynd@gmail.com
January 9, 2016 at 04:38
I do the same, many of my files have a list of

 *!module1Name();
 *!module2Name();

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it easier
to get a specific replacement without reprinting all 100.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
jon mailto:jon@jonbondy.com
January 9, 2016 at 03:07
I create modules for each part, list them at the bottom of the script,
and then use ! to create the geometry for the part that I wish to print.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ezra Reynolds mailto:shadowwynd@gmail.com
January 8, 2016 at 18:59
I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't
support hull() or offset() as of the most current version (hull is
split into its components, offset throws nasty errors).

I have created many designs that have multiple subassemblies.  They
are all inter-related pieces of the same design (e.g. top, bottom,
middle, with matching screw-holes, standoffs, etc.)  Since they share
variables, it is logical for them to to share a .SCAD file.  Yes, I
know how to use a batch file or script to do all this, but I would say
it is more

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point where I
have a single part, or several parts, fail during printing /
derafting/assembly.  It is an error-prone thing to manually isolate
each part, render as an STL, save it with the correct name, rinse and
repeat.  Not a problem with a three-part assembly, but could be a
problem with file that generates two dozen variations on a theme.

For my needs, an export("part1.stl") {subtree}  approach would work,
where the subtree is rendered to screen/cache (exactly like render()),
but is also exported to disk as the last step of the process.

For example:
export("top.stl") top();
translate ([20, 0, 0]) export("middle.stl") middle ();
translate ([-20, 0, 0]) export("bottom.stl") bottom();

F5 Preview - no difference, objects are rendered and shown

F6 Render - objects are rendered, displayed on screen.  Export
subtrees are written to disk, allowing user to still save whole render
as .STL or .AMF or whatever.  This guarantees I have a current (top,
middle, bottom) and not a top from two revisions ago.

Or maybe have a "Super F6" (shift+F6?) that handles the export()
commands or whatever other metadata functions we need.  I like
doug.moen's suggestion about handling this as metadata; you could
implement as a post-process function.

From my vantage point, export is still "Object Description" and not
"general programming"; it is describing the shape of the sub object,
and how it stored on the disk.

One potential problem that hasn't been mentioned is that if export()
triggers a render+write RIGHT NOW that can lead to a race condition;
if I export "X.stl" and use "X.stl" in other parts of the same file -
does it use the previous "X.stl" or the just-rendered version....


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Sounds pretty much exactly like what I'm looking for -- in addition to being able to preview just one component from a drop-down menu post render. > nop head <mailto:nop.head@gmail.com> > January 9, 2016 at 05:24 > Perhaps have export(file) treated the same as * for F5 and F6 but > export its subtree of geometry to the named file when a new Export > "exports" menu option is invoked. Doesn't that remove all the > objections? It is just a more convenient way of changing some *s at > the bottom of the file, pressing F6 and then invoking the Export menu. > The code no longer has side effects, the export is still an manual > operation but can deliver a bunch of files. The export doesn't appear > in the CSG file but it could export a CSG file of the things under it > if the file type was CSG. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > jon <mailto:jon@jonbondy.com> > January 9, 2016 at 05:03 > I agree that this would be a useful improvement! > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Ezra Reynolds <mailto:shadowwynd@gmail.com> > January 9, 2016 at 04:38 > I do the same, many of my files have a list of > > *!module1Name(); > *!module2Name(); > > at the bottom so that I can easily turn pieces off and on. > > However, if using a generator: > for (i=[0 : 10]) > { > for (j=[0 : 10]) > { > translate ([i*20, j*20, 0]) smallPartGenerator(i, j); > > } > } > > I then have 100 individual volumes on a build plate which is NOT as > easy to toggle. > > If we had an export command, then I could have an > export("R"+str(i) + "C"+str(j) + ".STL"); > in the mix and get 100 STL files out of the deal; this makes it easier > to get a specific replacement without reprinting all 100. > > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > jon <mailto:jon@jonbondy.com> > January 9, 2016 at 03:07 > I create modules for each part, list them at the bottom of the script, > and then use ! to create the geometry for the part that I wish to print. > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > Ezra Reynolds <mailto:shadowwynd@gmail.com> > January 8, 2016 at 18:59 > I wouldn't use FreeCAD as a barometer of compatibility, as it doesn't > support hull() or offset() as of the most current version (hull is > split into its components, offset throws nasty errors). > > I have created many designs that have multiple subassemblies. They > are all inter-related pieces of the same design (e.g. top, bottom, > middle, with matching screw-holes, standoffs, etc.) Since they share > variables, it is logical for them to to share a .SCAD file. Yes, I > know how to use a batch file or script to do all this, but I would say > it is more > > I normally arrange the pieces in OpenSCAD for 3D printing (many > discrete volumes as a single STL). This works up to the point where I > have a single part, or several parts, fail during printing / > derafting/assembly. It is an error-prone thing to manually isolate > each part, render as an STL, save it with the correct name, rinse and > repeat. Not a problem with a three-part assembly, but could be a > problem with file that generates two dozen variations on a theme. > > > For my needs, an export("part1.stl") {subtree} approach would work, > where the subtree is rendered to screen/cache (exactly like render()), > but is also exported to disk as the last step of the process. > > For example: > export("top.stl") top(); > translate ([20, 0, 0]) export("middle.stl") middle (); > translate ([-20, 0, 0]) export("bottom.stl") bottom(); > > F5 Preview - no difference, objects are rendered and shown > > F6 Render - objects are rendered, displayed on screen. Export > subtrees are written to disk, allowing user to still save whole render > as .STL or .AMF or whatever. This guarantees I have a current (top, > middle, bottom) and not a top from two revisions ago. > > Or maybe have a "Super F6" (shift+F6?) that handles the export() > commands or whatever other metadata functions we need. I like > doug.moen's suggestion about handling this as metadata; you could > implement as a post-process function. > > From my vantage point, export is still "Object Description" and not > "general programming"; it is describing the shape of the sub object, > and how it stored on the disk. > > One potential problem that hasn't been mentioned is that if export() > triggers a render+write RIGHT NOW that can lead to a race condition; > if I export "X.stl" and use "X.stl" in other parts of the same file - > does it use the previous "X.stl" or the just-rendered version.... > > > > > > > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TP
Torsten Paul
Sat, Jan 9, 2016 6:59 PM

On 01/09/2016 07:43 PM, Yona Appletree wrote:

nop head mailto:nop.head@gmail.com
January 9, 2016 at 05:24
Perhaps have export(file) treated the same as * for F5 and F6 but export its subtree of geometry to the named file when a new Export
"exports" menu option is invoked. Doesn't that remove all the objections? It is just a more convenient way of changing some *s at the
bottom of the file, pressing F6 and then invoking the Export menu. The code no longer has side effects, the export is still an manual
operation but can deliver a bunch of files. The export doesn't appear in the CSG file but it could export a CSG file of the things under
it if the file type was CSG.

Sounds pretty much exactly like what I'm looking for -- in addition to being able to preview just one component from a drop-down menu post
render.

Well, that's exactly what I'm talking about. Just with the additional
suggestion to use a different syntax that does not produce the confusion
of that export() "not being executed" when pressing F6 and allow more
flexibility to also handle DXF layers or AMF multi-volumes and such
things.

Having the separate syntax also means there's no need to mess with
the CSG files. We can simply export the data as it is.
Note that one rule is that exported CSG files can be read by OpenSCAD
again and are supposed to produce exactly the same model as the
original SCAD file. For 99.9% of files that works (problem is having
inf or NaN values) and is validated by the test suite.

ciao,
Torsten.

On 01/09/2016 07:43 PM, Yona Appletree wrote: >> >> nop head <mailto:nop.head@gmail.com> >> January 9, 2016 at 05:24 >> Perhaps have export(file) treated the same as * for F5 and F6 but export its subtree of geometry to the named file when a new Export >> "exports" menu option is invoked. Doesn't that remove all the objections? It is just a more convenient way of changing some *s at the >> bottom of the file, pressing F6 and then invoking the Export menu. The code no longer has side effects, the export is still an manual >> operation but can deliver a bunch of files. The export doesn't appear in the CSG file but it could export a CSG file of the things under >> it if the file type was CSG. >> > Sounds pretty much exactly like what I'm looking for -- in addition to being able to preview just one component from a drop-down menu post > render. > Well, that's exactly what I'm talking about. Just with the additional suggestion to use a different syntax that does not produce the confusion of that export() "not being executed" when pressing F6 and allow more flexibility to also handle DXF layers or AMF multi-volumes and such things. Having the separate syntax also means there's no need to mess with the CSG files. We can simply export the data as it is. Note that one rule is that exported CSG files can be read by OpenSCAD again and are supposed to produce exactly the same model as the original SCAD file. For 99.9% of files that works (problem is having inf or NaN values) and is validated by the test suite. ciao, Torsten.
GW
G. Wade Johnson
Sat, Jan 9, 2016 7:01 PM

On Sat, 09 Jan 2016 07:38:30 -0500
Ezra Reynolds shadowwynd@gmail.com wrote:

I do the same, many of my files have a list of

*!module1Name();
*!module2Name();

I like that approach.

In many of my more complicated designs I have something like:

plate="combined";
if( plate == "part1" )
{
module1Name();
}
if( plate == "part2" )
{
module2Name();
}
if( plate == "combined" )
{
translate([-20,-20, 0]) module1Name();
translate([ 20, 20, 0]) module2Name();
}

This makes it easy to generate specific versions using openscad on the
command line. It works particularly well driven by make.

G. Wade

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

  }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it
easier to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:

I create modules for each part, list them at the bottom of the
script, and then use ! to create the geometry for the part that I
wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:

I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point
where I have a single part, or several parts, fail during
printing / derafting/assembly.  It is an error-prone thing to
manually isolate each part, render as an STL, save it with the
correct name, rinse and repeat.  Not a problem with a three-part
assembly, but could be a problem with file that generates two
dozen variations on a theme.

--
You need at least two viewpoints to have perspective.
-- Rick Hoselton

On Sat, 09 Jan 2016 07:38:30 -0500 Ezra Reynolds <shadowwynd@gmail.com> wrote: > I do the same, many of my files have a list of > > *!module1Name(); > *!module2Name(); I like that approach. In many of my more complicated designs I have something like: plate="combined"; if( plate == "part1" ) { module1Name(); } if( plate == "part2" ) { module2Name(); } if( plate == "combined" ) { translate([-20,-20, 0]) module1Name(); translate([ 20, 20, 0]) module2Name(); } This makes it easy to generate specific versions using openscad on the command line. It works particularly well driven by make. G. Wade > at the bottom so that I can easily turn pieces off and on. > > However, if using a generator: > for (i=[0 : 10]) > { > for (j=[0 : 10]) > { > translate ([i*20, j*20, 0]) smallPartGenerator(i, j); > > } > } > > I then have 100 individual volumes on a build plate which is NOT as > easy to toggle. > > If we had an export command, then I could have an > export("R"+str(i) + "C"+str(j) + ".STL"); > in the mix and get 100 STL files out of the deal; this makes it > easier to get a specific replacement without reprinting all 100. > > > > On 1/9/2016 6:07 AM, jon wrote: > > I create modules for each part, list them at the bottom of the > > script, and then use ! to create the geometry for the part that I > > wish to print. > > > > On 1/8/2016 9:59 PM, Ezra Reynolds wrote: > >> I normally arrange the pieces in OpenSCAD for 3D printing (many > >> discrete volumes as a single STL). This works up to the point > >> where I have a single part, or several parts, fail during > >> printing / derafting/assembly. It is an error-prone thing to > >> manually isolate each part, render as an STL, save it with the > >> correct name, rinse and repeat. Not a problem with a three-part > >> assembly, but could be a problem with file that generates two > >> dozen variations on a theme. > > > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- You need at least two viewpoints to have perspective. -- Rick Hoselton
GF
Greg Frost
Sat, Jan 9, 2016 9:25 PM

What if instead of export(), you could just tag a part of the tree with a name. Then when you do export, there could be an option to export subtrees where you give a base name for the export and each tagged subtree is exported with a filename constructed by appending the subtree's name to the base name.

You would have to think about what to do if two things were tagged with the same name.

Greg Frost

On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" gwadej@anomaly.org wrote:

On Sat, 09 Jan 2016 07:38:30 -0500
Ezra Reynolds shadowwynd@gmail.com wrote:

I do the same, many of my files have a list of

*!module1Name();
*!module2Name();

I like that approach.

In many of my more complicated designs I have something like:

plate="combined";
if( plate == "part1" )
{
module1Name();
}
if( plate == "part2" )
{
module2Name();
}
if( plate == "combined" )
{
translate([-20,-20, 0]) module1Name();
translate([ 20, 20, 0]) module2Name();
}

This makes it easy to generate specific versions using openscad on the
command line. It works particularly well driven by make.

G. Wade

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it
easier to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:
I create modules for each part, list them at the bottom of the
script, and then use ! to create the geometry for the part that I
wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:
I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point
where I have a single part, or several parts, fail during
printing / derafting/assembly.  It is an error-prone thing to
manually isolate each part, render as an STL, save it with the
correct name, rinse and repeat.  Not a problem with a three-part
assembly, but could be a problem with file that generates two
dozen variations on a theme.

--
You need at least two viewpoints to have perspective.
-- Rick Hoselton


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

What if instead of export(), you could just tag a part of the tree with a name. Then when you do export, there could be an option to export subtrees where you give a base name for the export and each tagged subtree is exported with a filename constructed by appending the subtree's name to the base name. You would have to think about what to do if two things were tagged with the same name. Greg Frost > On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" <gwadej@anomaly.org> wrote: > > On Sat, 09 Jan 2016 07:38:30 -0500 > Ezra Reynolds <shadowwynd@gmail.com> wrote: > >> I do the same, many of my files have a list of >> >> *!module1Name(); >> *!module2Name(); > > I like that approach. > > In many of my more complicated designs I have something like: > > plate="combined"; > if( plate == "part1" ) > { > module1Name(); > } > if( plate == "part2" ) > { > module2Name(); > } > if( plate == "combined" ) > { > translate([-20,-20, 0]) module1Name(); > translate([ 20, 20, 0]) module2Name(); > } > > This makes it easy to generate specific versions using openscad on the > command line. It works particularly well driven by make. > > G. Wade > >> at the bottom so that I can easily turn pieces off and on. >> >> However, if using a generator: >> for (i=[0 : 10]) >> { >> for (j=[0 : 10]) >> { >> translate ([i*20, j*20, 0]) smallPartGenerator(i, j); >> >> } >> } >> >> I then have 100 individual volumes on a build plate which is NOT as >> easy to toggle. >> >> If we had an export command, then I could have an >> export("R"+str(i) + "C"+str(j) + ".STL"); >> in the mix and get 100 STL files out of the deal; this makes it >> easier to get a specific replacement without reprinting all 100. >> >> >> >>> On 1/9/2016 6:07 AM, jon wrote: >>> I create modules for each part, list them at the bottom of the >>> script, and then use ! to create the geometry for the part that I >>> wish to print. >>> >>>> On 1/8/2016 9:59 PM, Ezra Reynolds wrote: >>>> I normally arrange the pieces in OpenSCAD for 3D printing (many >>>> discrete volumes as a single STL). This works up to the point >>>> where I have a single part, or several parts, fail during >>>> printing / derafting/assembly. It is an error-prone thing to >>>> manually isolate each part, render as an STL, save it with the >>>> correct name, rinse and repeat. Not a problem with a three-part >>>> assembly, but could be a problem with file that generates two >>>> dozen variations on a theme. >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > -- > You need at least two viewpoints to have perspective. > -- Rick Hoselton > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
MV
Mihail Vasiliev
Sun, Jan 10, 2016 11:49 AM

Ok, let's try to create a short resume of the discussion.

  1. The feature itself is expected by at least some (or even most of)
    people, who posted their opinions here.

  2. People are interested in having options to control, when export is
    performing it's action - preview or render mode.

  3. There are security and unpredicted behavior issues:
    3a when exporting to arbitrary file.
    3b when importing and exporting from/to the same file.

  4. There is a separate, but extremely interesting idea on giving names/tags
    to subtrees. I think it's worth separate discussion. Like having a
    function, which fetches such name from subtree to be able to do something
    like:
    module mymod(){
    name("My Super Module");
    ...
    };

export(file=nameofchild()+".stl") mymod();

Or even place texts with module names on top of the modules themself (seems
fun, but not sure, whether it is needed by someone at all).

If I have missed something, correct me please.

So, I have a simple question to maintainers - if I address the issues 1-3,
will these patches be accepted (after technical review, cleanup, whatever)?

What I'm planing to do:
2. Add options to export()
onrender=true|false, default - true
onpreview=true|false, default - true
// At this point I want to add undiscussed option
show=true|false, default - true, to control, whether just-exported subtree
should be shown on screen.
3a. Limit export operations to current working directory. Limit characters,
allowed in filenames to some known-safe set.
3b. Store all export/import filenames in some common (global?) data
structure to prevent loops.
10 янв. 2016 г. 12:26 AM пользователь "Greg Frost" <
gregorybartonfrost@gmail.com> написал:

What if instead of export(), you could just tag a part of the tree with a
name. Then when you do export, there could be an option to export subtrees
where you give a base name for the export and each tagged subtree is
exported with a filename constructed by appending the subtree's name to the
base name.

You would have to think about what to do if two things were tagged with
the same name.

Greg Frost

On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" gwadej@anomaly.org

wrote:

On Sat, 09 Jan 2016 07:38:30 -0500
Ezra Reynolds shadowwynd@gmail.com wrote:

I do the same, many of my files have a list of

*!module1Name();
*!module2Name();

I like that approach.

In many of my more complicated designs I have something like:

plate="combined";
if( plate == "part1" )
{
module1Name();
}
if( plate == "part2" )
{
module2Name();
}
if( plate == "combined" )
{
translate([-20,-20, 0]) module1Name();
translate([ 20, 20, 0]) module2Name();
}

This makes it easy to generate specific versions using openscad on the
command line. It works particularly well driven by make.

G. Wade

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it
easier to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:
I create modules for each part, list them at the bottom of the
script, and then use ! to create the geometry for the part that I
wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:
I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point
where I have a single part, or several parts, fail during
printing / derafting/assembly.  It is an error-prone thing to
manually isolate each part, render as an STL, save it with the
correct name, rinse and repeat.  Not a problem with a three-part
assembly, but could be a problem with file that generates two
dozen variations on a theme.

--
You need at least two viewpoints to have perspective.
-- Rick Hoselton


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Ok, let's try to create a short resume of the discussion. 1. The feature itself is expected by at least some (or even most of) people, who posted their opinions here. 2. People are interested in having options to control, when export is performing it's action - preview or render mode. 3. There are security and unpredicted behavior issues: 3a when exporting to arbitrary file. 3b when importing and exporting from/to the same file. 4. There is a separate, but extremely interesting idea on giving names/tags to subtrees. I think it's worth separate discussion. Like having a function, which fetches such name from subtree to be able to do something like: module mymod(){ name("My Super Module"); ... }; export(file=nameofchild()+".stl") mymod(); Or even place texts with module names on top of the modules themself (seems fun, but not sure, whether it is needed by someone at all). If I have missed something, correct me please. So, I have a simple question to maintainers - if I address the issues 1-3, will these patches be accepted (after technical review, cleanup, whatever)? What I'm planing to do: 2. Add options to export() onrender=true|false, default - true onpreview=true|false, default - true // At this point I want to add undiscussed option show=true|false, default - true, to control, whether just-exported subtree should be shown on screen. 3a. Limit export operations to current working directory. Limit characters, allowed in filenames to some known-safe set. 3b. Store all export/import filenames in some common (global?) data structure to prevent loops. 10 янв. 2016 г. 12:26 AM пользователь "Greg Frost" < gregorybartonfrost@gmail.com> написал: > What if instead of export(), you could just tag a part of the tree with a > name. Then when you do export, there could be an option to export subtrees > where you give a base name for the export and each tagged subtree is > exported with a filename constructed by appending the subtree's name to the > base name. > > You would have to think about what to do if two things were tagged with > the same name. > > Greg Frost > > > On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" <gwadej@anomaly.org> > wrote: > > > > On Sat, 09 Jan 2016 07:38:30 -0500 > > Ezra Reynolds <shadowwynd@gmail.com> wrote: > > > >> I do the same, many of my files have a list of > >> > >> *!module1Name(); > >> *!module2Name(); > > > > I like that approach. > > > > In many of my more complicated designs I have something like: > > > > plate="combined"; > > if( plate == "part1" ) > > { > > module1Name(); > > } > > if( plate == "part2" ) > > { > > module2Name(); > > } > > if( plate == "combined" ) > > { > > translate([-20,-20, 0]) module1Name(); > > translate([ 20, 20, 0]) module2Name(); > > } > > > > This makes it easy to generate specific versions using openscad on the > > command line. It works particularly well driven by make. > > > > G. Wade > > > >> at the bottom so that I can easily turn pieces off and on. > >> > >> However, if using a generator: > >> for (i=[0 : 10]) > >> { > >> for (j=[0 : 10]) > >> { > >> translate ([i*20, j*20, 0]) smallPartGenerator(i, j); > >> > >> } > >> } > >> > >> I then have 100 individual volumes on a build plate which is NOT as > >> easy to toggle. > >> > >> If we had an export command, then I could have an > >> export("R"+str(i) + "C"+str(j) + ".STL"); > >> in the mix and get 100 STL files out of the deal; this makes it > >> easier to get a specific replacement without reprinting all 100. > >> > >> > >> > >>> On 1/9/2016 6:07 AM, jon wrote: > >>> I create modules for each part, list them at the bottom of the > >>> script, and then use ! to create the geometry for the part that I > >>> wish to print. > >>> > >>>> On 1/8/2016 9:59 PM, Ezra Reynolds wrote: > >>>> I normally arrange the pieces in OpenSCAD for 3D printing (many > >>>> discrete volumes as a single STL). This works up to the point > >>>> where I have a single part, or several parts, fail during > >>>> printing / derafting/assembly. It is an error-prone thing to > >>>> manually isolate each part, render as an STL, save it with the > >>>> correct name, rinse and repeat. Not a problem with a three-part > >>>> assembly, but could be a problem with file that generates two > >>>> dozen variations on a theme. > >>> > >>> > >>> _______________________________________________ > >>> OpenSCAD mailing list > >>> Discuss@lists.openscad.org > >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >> > >> _______________________________________________ > >> OpenSCAD mailing list > >> Discuss@lists.openscad.org > >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > > > > -- > > You need at least two viewpoints to have perspective. > > -- Rick Hoselton > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
AC
Alan Cox
Sun, Jan 10, 2016 12:11 PM

On Sun, 10 Jan 2016 14:49:15 +0300
Mihail Vasiliev mickvav@gmail.com wrote:

Ok, let's try to create a short resume of the discussion.

  1. The feature itself is expected by at least some (or even most of)
    people, who posted their opinions here.

I'm surprised we need an export() given that you really need render() to
force the right behaviour.  render(export="xx") might be saner but that
is a minor point.

  1. People are interested in having options to control, when export is
    performing it's action - preview or render mode.

Or neither or both. However that's nothing to do with export(). It's a
matter of having a variable saying which mode you are in. That is
immediately way more powerful and cleaner.

Even better but a separate issue might also be having a "view" variable
that two fn keys inc/dec so that you can flip between views as programmed.

  1. There are security and unpredicted behavior issues:
    3a when exporting to arbitrary file.
    3b when importing and exporting from/to the same file.

Any file can be a security issue. Even writing just files ending ".stl"
into the current directory can be used to overwrite existing stuff, while
not overwriting has its own set of usability problems.

3a. Limit export operations to current working directory. Limit characters,
allowed in filenames to some known-safe set.

There is no simple known safe set (eg "AUX" in windows) but you can get
close. Another alternative is to strip any pathname elements out and
place all the render components in a subdirectory based upon the name of
the original

ie

foo.scad

produces
components-foo/*.stl

(you'll notice this is basically what for example Firefox does saving web
pages)

Alan

On Sun, 10 Jan 2016 14:49:15 +0300 Mihail Vasiliev <mickvav@gmail.com> wrote: > Ok, let's try to create a short resume of the discussion. > 1. The feature itself is expected by at least some (or even most of) > people, who posted their opinions here. I'm surprised we need an export() given that you really need render() to force the right behaviour. render(export="xx") might be saner but that is a minor point. > 2. People are interested in having options to control, when export is > performing it's action - preview or render mode. Or neither or both. However that's *nothing* to do with export(). It's a matter of having a variable saying which mode you are in. That is immediately way more powerful and cleaner. Even better but a separate issue might also be having a "view" variable that two fn keys inc/dec so that you can flip between views as programmed. > 3. There are security and unpredicted behavior issues: > 3a when exporting to arbitrary file. > 3b when importing and exporting from/to the same file. Any file can be a security issue. Even writing just files ending ".stl" into the current directory can be used to overwrite existing stuff, while not overwriting has its own set of usability problems. > 3a. Limit export operations to current working directory. Limit characters, > allowed in filenames to some known-safe set. There is no simple known safe set (eg "AUX" in windows) but you can get close. Another alternative is to strip any pathname elements out and place all the render components in a subdirectory based upon the name of the original ie foo.scad produces components-foo/*.stl (you'll notice this is basically what for example Firefox does saving web pages) Alan
NH
nop head
Sun, Jan 10, 2016 12:13 PM

I don't think export should ever do anything in preview or render except
cause it children to be ignored. Making what it does optional does not
solve any of the objections raised about side effects, security and race
conditions. It should only export on a menu action and then show the files
names it has generated and the directory they will go into like a normal
export file dialog. The only complication is there are multiple files
rather than one.

There is no need for new syntax for meta data tagging. You can always
explicitly put what you want exported under the export statement.

On 10 January 2016 at 11:49, Mihail Vasiliev mickvav@gmail.com wrote:

Ok, let's try to create a short resume of the discussion.

  1. The feature itself is expected by at least some (or even most of)
    people, who posted their opinions here.

  2. People are interested in having options to control, when export is
    performing it's action - preview or render mode.

  3. There are security and unpredicted behavior issues:
    3a when exporting to arbitrary file.
    3b when importing and exporting from/to the same file.

  4. There is a separate, but extremely interesting idea on giving
    names/tags to subtrees. I think it's worth separate discussion. Like having
    a function, which fetches such name from subtree to be able to do something
    like:
    module mymod(){
    name("My Super Module");
    ...
    };

export(file=nameofchild()+".stl") mymod();

Or even place texts with module names on top of the modules themself
(seems fun, but not sure, whether it is needed by someone at all).

If I have missed something, correct me please.

So, I have a simple question to maintainers - if I address the issues 1-3,
will these patches be accepted (after technical review, cleanup, whatever)?

What I'm planing to do:
2. Add options to export()
onrender=true|false, default - true
onpreview=true|false, default - true
// At this point I want to add undiscussed option
show=true|false, default - true, to control, whether just-exported subtree
should be shown on screen.
3a. Limit export operations to current working directory. Limit
characters, allowed in filenames to some known-safe set.
3b. Store all export/import filenames in some common (global?) data
structure to prevent loops.
10 янв. 2016 г. 12:26 AM пользователь "Greg Frost" <
gregorybartonfrost@gmail.com> написал:

What if instead of export(), you could just tag a part of the tree with a

name. Then when you do export, there could be an option to export subtrees
where you give a base name for the export and each tagged subtree is
exported with a filename constructed by appending the subtree's name to the
base name.

You would have to think about what to do if two things were tagged with
the same name.

Greg Frost

On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" gwadej@anomaly.org

wrote:

On Sat, 09 Jan 2016 07:38:30 -0500
Ezra Reynolds shadowwynd@gmail.com wrote:

I do the same, many of my files have a list of

*!module1Name();
*!module2Name();

I like that approach.

In many of my more complicated designs I have something like:

plate="combined";
if( plate == "part1" )
{
module1Name();
}
if( plate == "part2" )
{
module2Name();
}
if( plate == "combined" )
{
translate([-20,-20, 0]) module1Name();
translate([ 20, 20, 0]) module2Name();
}

This makes it easy to generate specific versions using openscad on the
command line. It works particularly well driven by make.

G. Wade

at the bottom so that I can easily turn pieces off and on.

However, if using a generator:
for (i=[0 : 10])
{
for (j=[0 : 10])
{
translate ([i20, j20, 0]) smallPartGenerator(i, j);

 }

}

I then have 100 individual volumes on a build plate  which is NOT as
easy to toggle.

If we had an export command, then I could have an
export("R"+str(i) + "C"+str(j) + ".STL");
in the mix and get 100 STL files out of the deal; this makes it
easier to get a specific replacement without reprinting all 100.

On 1/9/2016 6:07 AM, jon wrote:
I create modules for each part, list them at the bottom of the
script, and then use ! to create the geometry for the part that I
wish to print.

On 1/8/2016 9:59 PM, Ezra Reynolds wrote:
I normally arrange the pieces in OpenSCAD for 3D printing (many
discrete volumes as a single STL).  This works up to the point
where I have a single part, or several parts, fail during
printing / derafting/assembly.  It is an error-prone thing to
manually isolate each part, render as an STL, save it with the
correct name, rinse and repeat.  Not a problem with a three-part
assembly, but could be a problem with file that generates two
dozen variations on a theme.

--
You need at least two viewpoints to have perspective.
-- Rick Hoselton


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I don't think export should ever do anything in preview or render except cause it children to be ignored. Making what it does optional does not solve any of the objections raised about side effects, security and race conditions. It should only export on a menu action and then show the files names it has generated and the directory they will go into like a normal export file dialog. The only complication is there are multiple files rather than one. There is no need for new syntax for meta data tagging. You can always explicitly put what you want exported under the export statement. On 10 January 2016 at 11:49, Mihail Vasiliev <mickvav@gmail.com> wrote: > Ok, let's try to create a short resume of the discussion. > 1. The feature itself is expected by at least some (or even most of) > people, who posted their opinions here. > 2. People are interested in having options to control, when export is > performing it's action - preview or render mode. > 3. There are security and unpredicted behavior issues: > 3a when exporting to arbitrary file. > 3b when importing and exporting from/to the same file. > > 4. There is a separate, but extremely interesting idea on giving > names/tags to subtrees. I think it's worth separate discussion. Like having > a function, which fetches such name from subtree to be able to do something > like: > module mymod(){ > name("My Super Module"); > ... > }; > > export(file=nameofchild()+".stl") mymod(); > > Or even place texts with module names on top of the modules themself > (seems fun, but not sure, whether it is needed by someone at all). > > If I have missed something, correct me please. > > So, I have a simple question to maintainers - if I address the issues 1-3, > will these patches be accepted (after technical review, cleanup, whatever)? > > What I'm planing to do: > 2. Add options to export() > onrender=true|false, default - true > onpreview=true|false, default - true > // At this point I want to add undiscussed option > show=true|false, default - true, to control, whether just-exported subtree > should be shown on screen. > 3a. Limit export operations to current working directory. Limit > characters, allowed in filenames to some known-safe set. > 3b. Store all export/import filenames in some common (global?) data > structure to prevent loops. > 10 янв. 2016 г. 12:26 AM пользователь "Greg Frost" < > gregorybartonfrost@gmail.com> написал: > > What if instead of export(), you could just tag a part of the tree with a >> name. Then when you do export, there could be an option to export subtrees >> where you give a base name for the export and each tagged subtree is >> exported with a filename constructed by appending the subtree's name to the >> base name. >> >> You would have to think about what to do if two things were tagged with >> the same name. >> >> Greg Frost >> >> > On 10 Jan 2016, at 5:31 am, "G. Wade Johnson" <gwadej@anomaly.org> >> wrote: >> > >> > On Sat, 09 Jan 2016 07:38:30 -0500 >> > Ezra Reynolds <shadowwynd@gmail.com> wrote: >> > >> >> I do the same, many of my files have a list of >> >> >> >> *!module1Name(); >> >> *!module2Name(); >> > >> > I like that approach. >> > >> > In many of my more complicated designs I have something like: >> > >> > plate="combined"; >> > if( plate == "part1" ) >> > { >> > module1Name(); >> > } >> > if( plate == "part2" ) >> > { >> > module2Name(); >> > } >> > if( plate == "combined" ) >> > { >> > translate([-20,-20, 0]) module1Name(); >> > translate([ 20, 20, 0]) module2Name(); >> > } >> > >> > This makes it easy to generate specific versions using openscad on the >> > command line. It works particularly well driven by make. >> > >> > G. Wade >> > >> >> at the bottom so that I can easily turn pieces off and on. >> >> >> >> However, if using a generator: >> >> for (i=[0 : 10]) >> >> { >> >> for (j=[0 : 10]) >> >> { >> >> translate ([i*20, j*20, 0]) smallPartGenerator(i, j); >> >> >> >> } >> >> } >> >> >> >> I then have 100 individual volumes on a build plate which is NOT as >> >> easy to toggle. >> >> >> >> If we had an export command, then I could have an >> >> export("R"+str(i) + "C"+str(j) + ".STL"); >> >> in the mix and get 100 STL files out of the deal; this makes it >> >> easier to get a specific replacement without reprinting all 100. >> >> >> >> >> >> >> >>> On 1/9/2016 6:07 AM, jon wrote: >> >>> I create modules for each part, list them at the bottom of the >> >>> script, and then use ! to create the geometry for the part that I >> >>> wish to print. >> >>> >> >>>> On 1/8/2016 9:59 PM, Ezra Reynolds wrote: >> >>>> I normally arrange the pieces in OpenSCAD for 3D printing (many >> >>>> discrete volumes as a single STL). This works up to the point >> >>>> where I have a single part, or several parts, fail during >> >>>> printing / derafting/assembly. It is an error-prone thing to >> >>>> manually isolate each part, render as an STL, save it with the >> >>>> correct name, rinse and repeat. Not a problem with a three-part >> >>>> assembly, but could be a problem with file that generates two >> >>>> dozen variations on a theme. >> >>> >> >>> >> >>> _______________________________________________ >> >>> OpenSCAD mailing list >> >>> Discuss@lists.openscad.org >> >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> >> >> _______________________________________________ >> >> OpenSCAD mailing list >> >> Discuss@lists.openscad.org >> >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > >> > >> > -- >> > You need at least two viewpoints to have perspective. >> > -- Rick Hoselton >> > >> > _______________________________________________ >> > OpenSCAD mailing list >> > Discuss@lists.openscad.org >> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
TP
Torsten Paul
Sun, Jan 10, 2016 4:25 PM

On 01/10/2016 01:13 PM, nop head wrote:

There is no need for new syntax for meta data tagging. You can
always explicitly put what you want exported under the export
statement.

Ok, we also have https://github.com/openscad/openscad/issues/1044
which asks for a way to control the layers that will be exported
to DXF. And there's a number of other similar requests already. How
would you do that with multiple file exports? Put all the various
possible inputs as parameters into one single export() which is then
called sometimes with parameterset A (for dxf layers) and sometimes
for parameterset B (for defining a file export)? This would also
mean the export() calls would need to be nested as the layers belong
into a single file.

With just tagging the subtrees, it leaves the interpretation to
the actual export function which could even show that information
to the user and allow changing it.

Note1: The syntax is just the Java one, lots of other languages
have adopted this feature with a different syntax, we would be
free to choose.

Note2: The prototype implementing this is already there and it's
actually not very complicated. The complex part is as always the
GUI. I also like to point out how this prototype is for a completely
different feature (https://github.com/openscad/openscad/issues/722)
and that would also be covered using the same syntax, maybe at
other places in the code, like the module definition instead of
the module instantiation.

module something(s) {
square(s * 10);
}

module part(r) {
@DxfLayer("layer1")
rotate(r) something(10);

@DxfLayer("layer2")
rotate(r) something(20);

}

@Export(name = "part1")
part1(0);

@Export(name = "part2")
part1(45);

Basically this simply attaches a set of key/value pairs to the
nodes which then can be interpreted when traversing the models
node tree.

Slic3r supports annotations in AMF files, to define some
properties for slicing a model. Even that could be handled
like @AMFMetaData(name = "slic3r.extruder", value = 1) and
would be silently ignore for STL export which does not have
any means to store this information.

ciao,
Torsten.

On 01/10/2016 01:13 PM, nop head wrote: > There is no need for new syntax for meta data tagging. You can > always explicitly put what you want exported under the export > statement. > Ok, we also have https://github.com/openscad/openscad/issues/1044 which asks for a way to control the layers that will be exported to DXF. And there's a number of other similar requests already. How would you do that with multiple file exports? Put all the various possible inputs as parameters into one single export() which is then called sometimes with parameterset A (for dxf layers) and sometimes for parameterset B (for defining a file export)? This would also mean the export() calls would need to be nested as the layers belong into a single file. With just tagging the subtrees, it leaves the interpretation to the actual export function which could even show that information to the user and allow changing it. Note1: The syntax is just the Java one, lots of other languages have adopted this feature with a different syntax, we would be free to choose. Note2: The prototype implementing this is already there and it's actually not very complicated. The complex part is as always the GUI. I also like to point out how this prototype is for a completely different feature (https://github.com/openscad/openscad/issues/722) and that would also be covered using the same syntax, maybe at other places in the code, like the module definition instead of the module instantiation. module something(s) { square(s * 10); } module part(r) { @DxfLayer("layer1") rotate(r) something(10); @DxfLayer("layer2") rotate(r) something(20); } @Export(name = "part1") part1(0); @Export(name = "part2") part1(45); Basically this simply attaches a set of key/value pairs to the nodes which then can be interpreted when traversing the models node tree. Slic3r supports annotations in AMF files, to define some properties for slicing a model. Even that could be handled like @AMFMetaData(name = "slic3r.extruder", value = 1) and would be silently ignore for STL export which does not have any means to store this information. ciao, Torsten.
NH
nop head
Sun, Jan 10, 2016 4:47 PM

I think being able to put multiple layers in a DXF or multiple materials in
an AMF is completely orthogonal functionality to being able to export
multiple files using the export menu. They can both be implemented
separately and will simple work together when you export a tree that makes
a multi component file.

I.e. If you export a DXF then it is exactly the same as removing a * or
adding a !, doing F6 (or F5 if it is a png) and using the export menu. My
proposed export simply automates what you can already with *,! and the
export menu but is tedious. I don't see why designing a multi-material
system needs to hold up this simple function.

My preferred way of doing multi-materials would be to attach attributes
exactly the same way color does, rather than borrowing more syntax from
other languages. Keep it looking like C as much as possible. I wouldn't
have chosen C myself as I prefer Python syntax but as it started out almost
pure C syntax I think it should stay that way.

On 10 January 2016 at 16:25, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/10/2016 01:13 PM, nop head wrote:

There is no need for new syntax for meta data tagging. You can
always explicitly put what you want exported under the export
statement.

Ok, we also have https://github.com/openscad/openscad/issues/1044
which asks for a way to control the layers that will be exported
to DXF. And there's a number of other similar requests already. How
would you do that with multiple file exports? Put all the various
possible inputs as parameters into one single export() which is then
called sometimes with parameterset A (for dxf layers) and sometimes
for parameterset B (for defining a file export)? This would also
mean the export() calls would need to be nested as the layers belong
into a single file.

With just tagging the subtrees, it leaves the interpretation to
the actual export function which could even show that information
to the user and allow changing it.

Note1: The syntax is just the Java one, lots of other languages
have adopted this feature with a different syntax, we would be
free to choose.

Note2: The prototype implementing this is already there and it's
actually not very complicated. The complex part is as always the
GUI. I also like to point out how this prototype is for a completely
different feature (https://github.com/openscad/openscad/issues/722)
and that would also be covered using the same syntax, maybe at
other places in the code, like the module definition instead of
the module instantiation.

module something(s) {
square(s * 10);
}

module part(r) {
@DxfLayer("layer1")
rotate(r) something(10);

     @DxfLayer("layer2")
     rotate(r) something(20);

}

@Export(name = "part1")
part1(0);

@Export(name = "part2")
part1(45);

Basically this simply attaches a set of key/value pairs to the
nodes which then can be interpreted when traversing the models
node tree.

Slic3r supports annotations in AMF files, to define some
properties for slicing a model. Even that could be handled
like @AMFMetaData(name = "slic3r.extruder", value = 1) and
would be silently ignore for STL export which does not have
any means to store this information.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I think being able to put multiple layers in a DXF or multiple materials in an AMF is completely orthogonal functionality to being able to export multiple files using the export menu. They can both be implemented separately and will simple work together when you export a tree that makes a multi component file. I.e. If you export a DXF then it is exactly the same as removing a * or adding a !, doing F6 (or F5 if it is a png) and using the export menu. My proposed export simply automates what you can already with *,! and the export menu but is tedious. I don't see why designing a multi-material system needs to hold up this simple function. My preferred way of doing multi-materials would be to attach attributes exactly the same way color does, rather than borrowing more syntax from other languages. Keep it looking like C as much as possible. I wouldn't have chosen C myself as I prefer Python syntax but as it started out almost pure C syntax I think it should stay that way. On 10 January 2016 at 16:25, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 01/10/2016 01:13 PM, nop head wrote: > > There is no need for new syntax for meta data tagging. You can > > always explicitly put what you want exported under the export > > statement. > > > Ok, we also have https://github.com/openscad/openscad/issues/1044 > which asks for a way to control the layers that will be exported > to DXF. And there's a number of other similar requests already. How > would you do that with multiple file exports? Put all the various > possible inputs as parameters into one single export() which is then > called sometimes with parameterset A (for dxf layers) and sometimes > for parameterset B (for defining a file export)? This would also > mean the export() calls would need to be nested as the layers belong > into a single file. > > With just tagging the subtrees, it leaves the interpretation to > the actual export function which could even show that information > to the user and allow changing it. > > Note1: The syntax is just the Java one, lots of other languages > have adopted this feature with a different syntax, we would be > free to choose. > > Note2: The prototype implementing this is already there and it's > actually not very complicated. The complex part is as always the > GUI. I also like to point out how this prototype is for a completely > different feature (https://github.com/openscad/openscad/issues/722) > and that would also be covered using the same syntax, maybe at > other places in the code, like the module definition instead of > the module instantiation. > > module something(s) { > square(s * 10); > } > > module part(r) { > @DxfLayer("layer1") > rotate(r) something(10); > > @DxfLayer("layer2") > rotate(r) something(20); > } > > @Export(name = "part1") > part1(0); > > @Export(name = "part2") > part1(45); > > Basically this simply attaches a set of key/value pairs to the > nodes which then can be interpreted when traversing the models > node tree. > > Slic3r supports annotations in AMF files, to define some > properties for slicing a model. Even that could be handled > like @AMFMetaData(name = "slic3r.extruder", value = 1) and > would be silently ignore for STL export which does not have > any means to store this information. > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Sun, Jan 10, 2016 5:23 PM

On 01/10/2016 05:47 PM, nop head wrote:

I wouldn't have chosen C myself as I prefer Python syntax but as it
started out almost pure C syntax I think it should stay that way.

Interesting, even Python has similar features for functions.
http://python-future.org/func_annotations.html

And when looking at python decorators, the syntax almost matches
the Java syntax, I've used as example:
http://thecodeship.com/patterns/guide-to-python-function-decorators/
Although those are serving a bit different purpose, I think.

As I said, the specific syntax is just a prototype so far. It
does not really matter. Unfortunately C does not have annotations
so we can't borrow that syntax. But you could also argue that SCAD
looks like C# and we could try to use that syntax.

My preferred way of doing multi-materials would be to attach
attributes exactly the same way color does

I think the key word here is attach. And that's precisely what
color() right now does not do. It creates a new tree node, so
if you traverse the node tree, there's a separate color node.
This actually makes things more complicated internally.

ciao,
Torsten.

On 01/10/2016 05:47 PM, nop head wrote: > I wouldn't have chosen C myself as I prefer Python syntax but as it > started out almost pure C syntax I think it should stay that way. > Interesting, even Python has similar features for functions. http://python-future.org/func_annotations.html And when looking at python decorators, the syntax almost matches the Java syntax, I've used as example: http://thecodeship.com/patterns/guide-to-python-function-decorators/ Although those are serving a bit different purpose, I think. As I said, the specific syntax is just a prototype so far. It does not really matter. Unfortunately C does not have annotations so we can't borrow that syntax. But you could also argue that SCAD looks like C# and we could try to use that syntax. > My preferred way of doing multi-materials would be to attach > attributes exactly the same way color does > I think the key word here is *attach*. And that's precisely what color() right now does not do. It creates a new tree node, so if you traverse the node tree, there's a separate color node. This actually makes things more complicated internally. ciao, Torsten.
NH
nop head
Sun, Jan 10, 2016 5:46 PM

I think your last point is implementation details, which should not really
dictate language syntax.  From the outside I don't see any logical
difference between color and material and isn't everything a tree node in
openscad? It is however a big subject when you consider what happens with
respect to CGS ops (that isn't even right for colours yet). I don't think
it should hold up this or have any bearing on it.

I would prefer to keep the syntax as small as possible and not grabbed from
other, far more complicated, languages. Otherwise you might as well write
in those languages and generate scad files, as many people do.

module mydx() {
layer("outlines") { // note I have no idea what DXF layers names look
like.
...
}
layer("engrave") {
...
}
}

export("my.xdf) mydxf();

module myamf() {
material("PLA") {.....};
material("TEP") {.....};
}

export("my.amf") myamf();

Why does it need to be more complicated?

On 10 January 2016 at 17:23, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/10/2016 05:47 PM, nop head wrote:

I wouldn't have chosen C myself as I prefer Python syntax but as it
started out almost pure C syntax I think it should stay that way.

Interesting, even Python has similar features for functions.
http://python-future.org/func_annotations.html

And when looking at python decorators, the syntax almost matches
the Java syntax, I've used as example:
http://thecodeship.com/patterns/guide-to-python-function-decorators/
Although those are serving a bit different purpose, I think.

As I said, the specific syntax is just a prototype so far. It
does not really matter. Unfortunately C does not have annotations
so we can't borrow that syntax. But you could also argue that SCAD
looks like C# and we could try to use that syntax.

My preferred way of doing multi-materials would be to attach
attributes exactly the same way color does

I think the key word here is attach. And that's precisely what
color() right now does not do. It creates a new tree node, so
if you traverse the node tree, there's a separate color node.
This actually makes things more complicated internally.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I think your last point is implementation details, which should not really dictate language syntax. From the outside I don't see any logical difference between color and material and isn't everything a tree node in openscad? It is however a big subject when you consider what happens with respect to CGS ops (that isn't even right for colours yet). I don't think it should hold up this or have any bearing on it. I would prefer to keep the syntax as small as possible and not grabbed from other, far more complicated, languages. Otherwise you might as well write in those languages and generate scad files, as many people do. module mydx() { layer("outlines") { // note I have no idea what DXF layers names look like. ... } layer("engrave") { ... } } export("my.xdf) mydxf(); module myamf() { material("PLA") {.....}; material("TEP") {.....}; } export("my.amf") myamf(); Why does it need to be more complicated? On 10 January 2016 at 17:23, Torsten Paul <Torsten.Paul@gmx.de> wrote: > On 01/10/2016 05:47 PM, nop head wrote: > > I wouldn't have chosen C myself as I prefer Python syntax but as it > > started out almost pure C syntax I think it should stay that way. > > > Interesting, even Python has similar features for functions. > http://python-future.org/func_annotations.html > > And when looking at python decorators, the syntax almost matches > the Java syntax, I've used as example: > http://thecodeship.com/patterns/guide-to-python-function-decorators/ > Although those are serving a bit different purpose, I think. > > As I said, the specific syntax is just a prototype so far. It > does not really matter. Unfortunately C does not have annotations > so we can't borrow that syntax. But you could also argue that SCAD > looks like C# and we could try to use that syntax. > > > My preferred way of doing multi-materials would be to attach > > attributes exactly the same way color does > > > I think the key word here is *attach*. And that's precisely what > color() right now does not do. It creates a new tree node, so > if you traverse the node tree, there's a separate color node. > This actually makes things more complicated internally. > > ciao, > Torsten. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
TP
Torsten Paul
Mon, Jan 11, 2016 3:42 AM

On 01/10/2016 06:46 PM, nop head wrote:

I think your last point is implementation details, which should
not really dictate language syntax.

In some respects, yes, that's true. But there's one thing that
does make it relevant. When using "normal" builtin modules to
define meta-data, we will capture all those names. Part of that
might be fixable if there's ever an implementation for namespaces,
but that's a bigger project in itself.
I've seen quite some cases where trying to unify everything into
the same logic resulted in problems.

From the outside I don't see any logical difference between
color and material and isn't everything a tree node in openscad?

Yes, color() is obviously existing as node already as there is
currently no other means. It certainly could be an annotation too.
I'm not really convinced that because we currently only have
hammers^H^H^H^H^H^H^Hnodes we need to shape every new problem
into nails^H^H^H^H^Hnodes if there are other options too.

Well, actually that's not totally true that we only have nodes.
In fact the ! # and % modifiers already behave like an annotation
for the module they are written before. This explains why this is
a parse error:

! { cube(); sphere(); }

And if we are talking about how hugely complicated things look
with annotations, let me, just for illustration purposes, use _
instead of that scary @ and reformat a bit

module part(r) {
_layer("layer1") rotate(r) something(10);
_layer("layer2") rotate(r) something(20);
}

_export(name = "part1") part1(0);
_export(name = "part2") part1(45);

Hmm, I really don't see how that's more complicated. Although
export is probably a bad name anyway. Something like Volume
would probably be ok, or even better something that applies
nicely to both 3D and 2D objects. (That's basically the HTML
discussion: Do logical instead of presentational description
and leave the interpretation to the processor/browser).

In essence, I think the only real difference between using a
module and something special whatever it's called is that it
introduces a different global namespace that does not collide
with the other existing ones and is not evaluated in the
script itself but in the renderer/exporter/external-tool.

ciao,
Torsten.

On 01/10/2016 06:46 PM, nop head wrote: > I think your last point is implementation details, which should > not really dictate language syntax. > In some respects, yes, that's true. But there's one thing that does make it relevant. When using "normal" builtin modules to define meta-data, we will capture all those names. Part of that might be fixable if there's ever an implementation for namespaces, but that's a bigger project in itself. I've seen quite some cases where trying to unify everything into the same logic resulted in problems. > From the outside I don't see any logical difference between > color and material and isn't everything a tree node in openscad? > Yes, color() is obviously existing as node already as there is currently no other means. It certainly could be an annotation too. I'm not really convinced that because we currently only have hammers^H^H^H^H^H^H^Hnodes we need to shape every new problem into nails^H^H^H^H^Hnodes if there are other options too. Well, actually that's not totally true that we only have nodes. In fact the ! # and % modifiers already behave like an annotation for the module they are written before. This explains why this is a parse error: ! { cube(); sphere(); } And if we are talking about how hugely complicated things look with annotations, let me, just for illustration purposes, use _ instead of that scary @ and reformat a bit module part(r) { _layer("layer1") rotate(r) something(10); _layer("layer2") rotate(r) something(20); } _export(name = "part1") part1(0); _export(name = "part2") part1(45); Hmm, I really don't see how that's more complicated. Although export is probably a bad name anyway. Something like Volume would probably be ok, or even better something that applies nicely to both 3D and 2D objects. (That's basically the HTML discussion: Do logical instead of presentational description and leave the interpretation to the processor/browser). In essence, I think the only real difference between using a module and something special whatever it's called is that it introduces a different global namespace that does not collide with the other existing ones and is not evaluated in the script itself but in the renderer/exporter/external-tool. ciao, Torsten.
MV
Mihail Vasiliev
Mon, Jan 11, 2016 5:51 AM

Well, interpretation of any language feature is always up to the tool,
which reads this language. E.g. if it's web app, it can open a frame/new
window/whatever with such exported view.

Hmm, may be it should be called view() instead of export()?
11 янв. 2016 г. 6:43 AM пользователь "Torsten Paul" Torsten.Paul@gmx.de
написал:

On 01/10/2016 06:46 PM, nop head wrote:

I think your last point is implementation details, which should
not really dictate language syntax.

In some respects, yes, that's true. But there's one thing that
does make it relevant. When using "normal" builtin modules to
define meta-data, we will capture all those names. Part of that
might be fixable if there's ever an implementation for namespaces,
but that's a bigger project in itself.
I've seen quite some cases where trying to unify everything into
the same logic resulted in problems.

From the outside I don't see any logical difference between
color and material and isn't everything a tree node in openscad?

Yes, color() is obviously existing as node already as there is
currently no other means. It certainly could be an annotation too.
I'm not really convinced that because we currently only have
hammers^H^H^H^H^H^H^Hnodes we need to shape every new problem
into nails^H^H^H^H^Hnodes if there are other options too.

Well, actually that's not totally true that we only have nodes.
In fact the ! # and % modifiers already behave like an annotation
for the module they are written before. This explains why this is
a parse error:

! { cube(); sphere(); }

And if we are talking about how hugely complicated things look
with annotations, let me, just for illustration purposes, use _
instead of that scary @ and reformat a bit

module part(r) {
_layer("layer1") rotate(r) something(10);
_layer("layer2") rotate(r) something(20);
}

_export(name = "part1") part1(0);
_export(name = "part2") part1(45);

Hmm, I really don't see how that's more complicated. Although
export is probably a bad name anyway. Something like Volume
would probably be ok, or even better something that applies
nicely to both 3D and 2D objects. (That's basically the HTML
discussion: Do logical instead of presentational description
and leave the interpretation to the processor/browser).

In essence, I think the only real difference between using a
module and something special whatever it's called is that it
introduces a different global namespace that does not collide
with the other existing ones and is not evaluated in the
script itself but in the renderer/exporter/external-tool.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Well, interpretation of any language feature is always up to the tool, which reads this language. E.g. if it's web app, it can open a frame/new window/whatever with such exported view. Hmm, may be it should be called view() instead of export()? 11 янв. 2016 г. 6:43 AM пользователь "Torsten Paul" <Torsten.Paul@gmx.de> написал: > On 01/10/2016 06:46 PM, nop head wrote: > > I think your last point is implementation details, which should > > not really dictate language syntax. > > > In some respects, yes, that's true. But there's one thing that > does make it relevant. When using "normal" builtin modules to > define meta-data, we will capture all those names. Part of that > might be fixable if there's ever an implementation for namespaces, > but that's a bigger project in itself. > I've seen quite some cases where trying to unify everything into > the same logic resulted in problems. > > > From the outside I don't see any logical difference between > > color and material and isn't everything a tree node in openscad? > > > Yes, color() is obviously existing as node already as there is > currently no other means. It certainly could be an annotation too. > I'm not really convinced that because we currently only have > hammers^H^H^H^H^H^H^Hnodes we need to shape every new problem > into nails^H^H^H^H^Hnodes if there are other options too. > > Well, actually that's not totally true that we only have nodes. > In fact the ! # and % modifiers already behave like an annotation > for the module they are written before. This explains why this is > a parse error: > > ! { cube(); sphere(); } > > And if we are talking about how hugely complicated things look > with annotations, let me, just for illustration purposes, use _ > instead of that scary @ and reformat a bit > > module part(r) { > _layer("layer1") rotate(r) something(10); > _layer("layer2") rotate(r) something(20); > } > > _export(name = "part1") part1(0); > _export(name = "part2") part1(45); > > > Hmm, I really don't see how that's more complicated. Although > export is probably a bad name anyway. Something like Volume > would probably be ok, or even better something that applies > nicely to both 3D and 2D objects. (That's basically the HTML > discussion: Do logical instead of presentational description > and leave the interpretation to the processor/browser). > > In essence, I think the only real difference between using a > module and something special whatever it's called is that it > introduces a different global namespace that does not collide > with the other existing ones and is not evaluated in the > script itself but in the renderer/exporter/external-tool. > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
M
MichaelAtOz
Mon, Jan 11, 2016 7:43 AM

Mihail Vasiliev wrote

Hmm, may be it should be called view() instead of export()?

Wikpedia - AMF

Structure

An AMF can represent one object, or multiple objects arranged in a
constellation. Each object is described as a set of non-overlapping
volumes. Each volume is described by a triangular mesh that references a
set of points (vertices). These vertices can be shared among volumes. An
AMF file can also specify the material and the color of each volume, as
well as the color of each triangle in the mesh. The AMF file is compressed
using the zip compression format, but the ".amf" file extension is
retained. A minimal AMF reader implementation must be able to decompress
an AMF file and import at least geometry information (ignoring curvature).
Basic file structure

The AMF file begins with the XML declaration line specifying the XML
version and encoding. The remainder of the file is enclosed between an
opening
<amf>
element and a closing
</amf>
element. The unit system can also be specified (millimeter, inch, feet,
meter or micrometer). In absence of a units specification, millimeters are
assumed.

Within the AMF brackets, there are five top level elements. Only a single
object element is required for a fully functional AMF file.

 object - The object element defines a volume or volumes of material,

each of which are associated with a material ID for printing. At least one
object element must be present in the file. Additional objects are
optional.
material - The optional material element defines one or more materials
for printing with an associated material ID. If no material element is
included, a single default material is assumed.
texture - The optional texture element defines one or more images or
textures for color or texture mapping, each with an associated texture ID.
constellation - The optional constellation element hierarchically
combines objects and other constellations into a relative pattern for
printing.
metadata - The optional metadata element specifies additional
information about the object(s) and elements contained in the file.

"An AMF file can also specify the material and the color of each volume"
call it a volume()


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/export-function-tp15428p15645.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Mihail Vasiliev wrote > Hmm, may be it should be called view() instead of export()? Wikpedia - AMF > Structure > > An AMF can represent one object, or multiple objects arranged in a > constellation. Each object is described as a set of non-overlapping > volumes. Each volume is described by a triangular mesh that references a > set of points (vertices). These vertices can be shared among volumes. An > AMF file can also specify the material and the color of each volume, as > well as the color of each triangle in the mesh. The AMF file is compressed > using the zip compression format, but the ".amf" file extension is > retained. A minimal AMF reader implementation must be able to decompress > an AMF file and import at least geometry information (ignoring curvature). > Basic file structure > > The AMF file begins with the XML declaration line specifying the XML > version and encoding. The remainder of the file is enclosed between an > opening > <amf> > element and a closing > </amf> > element. The unit system can also be specified (millimeter, inch, feet, > meter or micrometer). In absence of a units specification, millimeters are > assumed. > > Within the AMF brackets, there are five top level elements. Only a single > object element is required for a fully functional AMF file. > > object - The object element defines a volume or volumes of material, > each of which are associated with a material ID for printing. At least one > object element must be present in the file. Additional objects are > optional. > material - The optional material element defines one or more materials > for printing with an associated material ID. If no material element is > included, a single default material is assumed. > texture - The optional texture element defines one or more images or > textures for color or texture mapping, each with an associated texture ID. > constellation - The optional constellation element hierarchically > combines objects and other constellations into a relative pattern for > printing. > metadata - The optional metadata element specifies additional > information about the object(s) and elements contained in the file. "An AMF file can also specify the material and the color of each volume" call it a volume() ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/export-function-tp15428p15645.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Thu, Jan 14, 2016 12:26 AM

I agree with Nop Head that we can and should keep the syntax simple., The
namespace management issue that Torsten brought up is really orthogonal to
this discussion, and can be solved in a different way.

There are several different use cases being discussed. Multi-part models,
as described by Ezra, are really a different problem than multiple
materials. We've discussed multi-material semantics in a different thread,
and we want to extend the semantics of the CSG operators to behave sensibly
when the argument shapes consist of multiple materials. That issue doesn't
arise for multi-part models.

AMF is relevant to multi-part models. The AMF file format can separately
describe each component of a multi-part model. And slic3r has support for
reading and writing multi-part models, as single AMF files. Ezra describes
the situation where you try to print a multi-part model: some of the parts
print successfully, some of them fail. Then you want to reprint only those
components that failed. Slic3r supports this workflow using multi-part AMF
files (in Expert mode).

I think OpenSCAD should provide a simple, high level syntax for tagging the
different parts of a multi-part model. The details of how that is
represented in the file system should depend on what export option you are
using. There's one option to export a multi-part model as a collection of
STL files, and there's another option to export it as a single AMF file. (A
third option is to export the entire assembly as a single STL file.)
Instead of export("filename"), we could have component("partname"). This
way, the model stays abstract, and the details of which file format you are
exporting to are kept out of the model.

Doug.

On 10 January 2016 at 12:46, nop head nop.head@gmail.com wrote:

I think your last point is implementation details, which should not really
dictate language syntax.  From the outside I don't see any logical
difference between color and material and isn't everything a tree node in
openscad? It is however a big subject when you consider what happens with
respect to CGS ops (that isn't even right for colours yet). I don't think
it should hold up this or have any bearing on it.

I would prefer to keep the syntax as small as possible and not grabbed
from other, far more complicated, languages. Otherwise you might as well
write in those languages and generate scad files, as many people do.

module mydx() {
layer("outlines") { // note I have no idea what DXF layers names look
like.
...
}
layer("engrave") {
...
}
}

export("my.xdf) mydxf();

module myamf() {
material("PLA") {.....};
material("TEP") {.....};
}

export("my.amf") myamf();

Why does it need to be more complicated?

On 10 January 2016 at 17:23, Torsten Paul Torsten.Paul@gmx.de wrote:

On 01/10/2016 05:47 PM, nop head wrote:

I wouldn't have chosen C myself as I prefer Python syntax but as it
started out almost pure C syntax I think it should stay that way.

Interesting, even Python has similar features for functions.
http://python-future.org/func_annotations.html

And when looking at python decorators, the syntax almost matches
the Java syntax, I've used as example:
http://thecodeship.com/patterns/guide-to-python-function-decorators/
Although those are serving a bit different purpose, I think.

As I said, the specific syntax is just a prototype so far. It
does not really matter. Unfortunately C does not have annotations
so we can't borrow that syntax. But you could also argue that SCAD
looks like C# and we could try to use that syntax.

My preferred way of doing multi-materials would be to attach
attributes exactly the same way color does

I think the key word here is attach. And that's precisely what
color() right now does not do. It creates a new tree node, so
if you traverse the node tree, there's a separate color node.
This actually makes things more complicated internally.

ciao,
Torsten.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I agree with Nop Head that we can and should keep the syntax simple., The namespace management issue that Torsten brought up is really orthogonal to this discussion, and can be solved in a different way. There are several different use cases being discussed. Multi-part models, as described by Ezra, are really a different problem than multiple materials. We've discussed multi-material semantics in a different thread, and we want to extend the semantics of the CSG operators to behave sensibly when the argument shapes consist of multiple materials. That issue doesn't arise for multi-part models. AMF *is* relevant to multi-part models. The AMF file format can separately describe each component of a multi-part model. And slic3r has support for reading and writing multi-part models, as single AMF files. Ezra describes the situation where you try to print a multi-part model: some of the parts print successfully, some of them fail. Then you want to reprint only those components that failed. Slic3r supports this workflow using multi-part AMF files (in Expert mode). I think OpenSCAD should provide a simple, high level syntax for tagging the different parts of a multi-part model. The details of how that is represented in the file system should depend on what export option you are using. There's one option to export a multi-part model as a collection of STL files, and there's another option to export it as a single AMF file. (A third option is to export the entire assembly as a single STL file.) Instead of export("filename"), we could have component("partname"). This way, the model stays abstract, and the details of which file format you are exporting to are kept out of the model. Doug. On 10 January 2016 at 12:46, nop head <nop.head@gmail.com> wrote: > I think your last point is implementation details, which should not really > dictate language syntax. From the outside I don't see any logical > difference between color and material and isn't everything a tree node in > openscad? It is however a big subject when you consider what happens with > respect to CGS ops (that isn't even right for colours yet). I don't think > it should hold up this or have any bearing on it. > > I would prefer to keep the syntax as small as possible and not grabbed > from other, far more complicated, languages. Otherwise you might as well > write in those languages and generate scad files, as many people do. > > module mydx() { > layer("outlines") { // note I have no idea what DXF layers names look > like. > ... > } > layer("engrave") { > ... > } > } > > export("my.xdf) mydxf(); > > module myamf() { > material("PLA") {.....}; > material("TEP") {.....}; > } > > export("my.amf") myamf(); > > Why does it need to be more complicated? > > > > On 10 January 2016 at 17:23, Torsten Paul <Torsten.Paul@gmx.de> wrote: > >> On 01/10/2016 05:47 PM, nop head wrote: >> > I wouldn't have chosen C myself as I prefer Python syntax but as it >> > started out almost pure C syntax I think it should stay that way. >> > >> Interesting, even Python has similar features for functions. >> http://python-future.org/func_annotations.html >> >> And when looking at python decorators, the syntax almost matches >> the Java syntax, I've used as example: >> http://thecodeship.com/patterns/guide-to-python-function-decorators/ >> Although those are serving a bit different purpose, I think. >> >> As I said, the specific syntax is just a prototype so far. It >> does not really matter. Unfortunately C does not have annotations >> so we can't borrow that syntax. But you could also argue that SCAD >> looks like C# and we could try to use that syntax. >> >> > My preferred way of doing multi-materials would be to attach >> > attributes exactly the same way color does >> > >> I think the key word here is *attach*. And that's precisely what >> color() right now does not do. It creates a new tree node, so >> if you traverse the node tree, there's a separate color node. >> This actually makes things more complicated internally. >> >> ciao, >> Torsten. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >