Would love an option to auto-open STLs that are generated

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Would love an option to auto-open STLs that are generated

laird
My workflow is to generate STLs in OpenSCAD, then open and view and then 3D print them. It would eliminate a fair amount of clicking around if OpenSCAD had an option to automatically "open" STLs after they are generated.

To keep it simple, IMO it would be sufficient to tell the OS to open the file, rather than to configure a specific tool into OpenSCAD to launch on the files, as the various OSs already have mechanisms to let users control what app opens to handle what file type.
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Miro Hrončok
Well, "let the OS open the file in default app" is a complicated task in multiplatform app (unless Qt handles that somehow already)..

Miro Hrončok

Telefon: +420777974800


2014-02-10 15:01 GMT+01:00 laird <[hidden email]>:
My workflow is to generate STLs in OpenSCAD, then open and view and then 3D
print them. It would eliminate a fair amount of clicking around if OpenSCAD
had an option to automatically "open" STLs after they are generated.

To keep it simple, IMO it would be sufficient to tell the OS to open the
file, rather than to configure a specific tool into OpenSCAD to launch on
the files, as the various OSs already have mechanisms to let users control
what app opens to handle what file type.



--
View this message in context: http://forum.openscad.org/Would-love-an-option-to-auto-open-STLs-that-are-generated-tp6825.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Alan Cox
On Mon, 10 Feb 2014 15:21:17 +0100
Miro Hrončok <[hidden email]> wrote:

> Well, "let the OS open the file in default app" is a complicated task in
> multiplatform app (unless Qt handles that somehow already)..

For Linux at least its just a packaging question.

http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

http://freedesktop.org/wiki/Software/desktop-file-utils/

has the supporting tools.

However it seems a bit odd to try and use OpenSCAD as an STL viewer as
it's not a very good STL viewer and not intended to be one. Binding it to
open .scad files is however quite handy.

Alan
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

tp3
Alan Cox wrote
For Linux at least its just a packaging question.
Yup, I just did that some days ago on my Notebook running Debian. What's needed is first the mentioned .desktop file and additionally a mime registration file for *.scad. (e.g. see http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html). After that xdg-open file.scad should do what's expected.
A nicely built Linux package should have those registrations included. Otherwise it's possible to create both in .local/share/applications and .local/share/mime.

I think for Mac there's also an event handler that should allow to trigger an "Open File" in a running OpenSCAD, but I did not try that myself.
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

kintel
Administrator
In reply to this post by Alan Cox
On Feb 10, 2014, at 09:31 AM, Alan Cox <[hidden email]> wrote:
>
> For Linux at least its just a packaging question.
>
For Mac, OpenSCAD already registers as a viewer for STL, and if set to the default viewer, it will generate an import() command whenever you double-click on anSTL file, same as if you drag&drop an STL file into an OpenSCAD window.

I don’t really think an “auto-import-after-save” function fits in the OpenSCAD GUI, but this can be solved externally:
o Script-open the STL files
o Double-click STL files
o Always save with the same name, and have an automatic reload show it in another OpenSCAD window

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Doug Mcnutt
At 10:10 -0500 2/10/14, Marius Kintel wrote:

>On Feb 10, 2014, at 09:31 AM, Alan Cox <[hidden email]> wrote:
>>
>> For Linux at least its just a packaging question.
>>
>For Mac, OpenSCAD already registers as a viewer for STL, and if set to the default viewer, it will generate an import() command whenever you double-click on anSTL file, same as if you drag&drop an STL file into an OpenSCAD window.
>
>I don't really think an "auto-import-after-save" function fits in the OpenSCAD GUI, but this can be solved externally:
>o Script-open the STL files
>o Double-click STL files
>o Always save with the same name, and have an automatic reload show it in another OpenSCAD window
>
> -Marius

When opening a StL file openscad receives a whole lot of vertices as 32 bit floating point vectors or as decimal  text neither of which will match up exactly with openscad's original vertices. It's likely that many vertices are repeated and some of the repeated values may not be identical.

A useful addition to openscad would be to compare the vertices in a just-generated StL with what was just there in openscad's tables. Perhaps report errors more than some quantum limit.

--
-->  There are 10 kinds of people:  those who understand binary, and those who don't <--
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

kintel
Administrator
On Feb 10, 2014, at 14:24 PM, Doug Mcnutt <[hidden email]> wrote:
>
> A useful addition to openscad would be to compare the vertices in a just-generated StL with what was just there in openscad's tables. Perhaps report errors more than some quantum limit.
>
Yes, we’re thinking about implementing something like that for the test framework.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Alan Cox
In reply to this post by Doug Mcnutt
> When opening a StL file openscad receives a whole lot of vertices as 32 bit floating point vectors or as decimal  text neither of which will match up exactly with openscad's original vertices. It's likely that many vertices are repeated and some of the repeated values may not be identical.

If you are writing a binary STL you should never introduce ambiguity. The
correct behaviour is to identify all points which map to the same 32bit
float values but are not the same in native format and then either

- simplify the mesh to remain correct in 32bit float format
  (arguably the correct behaviour)
- slightly jiggle the points so they take up the nearest binary unique
  32bit float value while maintaining sort order (much easier and nobody
  will notice)

a program which blindly casts and writes is plain busted. Admittedly the
underlying bug is the design of STL but we are stuck with that. A good
reader will also do the same on reading if its internal format can be
ambiguous for two unique float bit patterns.

Below that there is a more fundamental problem that turning it into
a load of 3D vertices is *stupid* and what should be stored is the
resulting mathematical description which is then sliced directly.
Basically the model is an equation - you just need to keep solving it for
a new z.

Alan
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Miro Hrončok
In reply to this post by tp3
For packaging purposes, do we have a mime type for scad? That would be great. Currently, the OpenSCAD desktop file has no MimeType specified and to work with text files *and* STLs, we'd need:

MimeType=text/plain;application/octet-stream;application/sla;



Miro Hrončok

Telefon: +420777974800


2014-02-10 15:53 GMT+01:00 tp3 <[hidden email]>:
Alan Cox wrote
> For Linux at least its just a packaging question.

Yup, I just did that some days ago on my Notebook running Debian. What's
needed is first the mentioned .desktop file and additionally a mime
registration file for *.scad. (e.g. see
http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html).
After that xdg-open file.scad should do what's expected.
A nicely built Linux package should have those registrations included.
Otherwise it's possible to create both in .local/share/applications and
.local/share/mime.

I think for Mac there's also an event handler that should allow to trigger
an "Open File" in a running OpenSCAD, but I did not try that myself.




-----
-- Torsten
--
View this message in context: http://forum.openscad.org/Would-love-an-option-to-auto-open-STLs-that-are-generated-tp6825p6831.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
tp3
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

tp3
Miro Hrončok wrote
For packaging purposes, do we have a mime type for scad? That would be
great. Currently, the OpenSCAD desktop file has no MimeType specified and
to work with text files *and* STLs, we'd need:

MimeType=text/plain;application/octet-stream;application/sla;
I've used application/x-openscad on my system, but I'm not sure if that matches any official naming convention. I've also seen something like application/x-extension-scad.

I have as /home/tp/.local/share/applications/OpenSCAD.desktop

[Desktop Entry]
Name=OpenSCAD
Exec=/opt/bin/openscad %f
Icon=/opt/share/pixmaps/openscad.png
Type=Application
MimeType=application/x-openscad

And as /usr/share/mime/packages/openscad.xml

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
   <mime-type type="application/x-openscad">
     <comment>OpenSCAD Model</comment>
     <glob pattern="*.scad"/>
     <icon name="openscad"/>
   </mime-type>
</mime-info>

-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

Miro Hrončok
I will do some research. Opened a tracking issue https://github.com/openscad/openscad/issues/647

Miro Hrončok

Telefon: +420777974800


2014-02-10 22:00 GMT+01:00 tp3 <[hidden email]>:
Miro Hrončok wrote
> For packaging purposes, do we have a mime type for scad? That would be
> great. Currently, the OpenSCAD desktop file has no MimeType specified and
> to work with text files *and* STLs, we'd need:
>
> MimeType=text/plain;application/octet-stream;application/sla;

I've used application/x-openscad on my system, but I'm not sure if that
matches any official naming convention. I've also seen something like
application/x-extension-scad.

I have as /home/tp/.local/share/applications/OpenSCAD.desktop

[Desktop Entry]
Name=OpenSCAD
Exec=/opt/bin/openscad %f
Icon=/opt/share/pixmaps/openscad.png
Type=Application
MimeType=application/x-openscad

And as /usr/share/mime/packages/openscad.xml

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
   <mime-type type="application/x-openscad">
     <comment>OpenSCAD Model</comment>
     <glob pattern="*.scad"/>
     <icon name="openscad"/>
   </mime-type>
</mime-info>





-----
-- Torsten
--
View this message in context: http://forum.openscad.org/Would-love-an-option-to-auto-open-STLs-that-are-generated-tp6825p6845.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

MichaelAtOz
Administrator
The way I read the OP wants to open the STL in the next program in his toolchain, not open it in OpenSCAD. With the suggestion to use the OS's 'open' mechanism, hence (in windows) the file association for STL can be pointed to, for example, his slicer.

It was unclear, but I would think something like a command line parameter '--openoutput', which would work for all types (.stl / .off / .dxf, .csg), probably good for .png too (?). Rather than after using Export as STL from the GUI.

Perhaps laird clarify his desire?
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

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!
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

laird
To clarify, the scenario I'm in is that I'm using the GUI to edit and render the OpenSCAD, and when I like it I compile and export STL, then I have to switch to the slicer, file/open, navigate, etc., which is a lot of clicking around for a very frequent piece of my workflow. So all I'm looking for is an option to set so that when I export the file, it tells the OS to open the file, which opens it into my slicer to preview and slice.

For command-line use of OpenSCAD, I can (and do) invoke OpenSCAD to render the STL, then open the STL into the slicer. So nothing more is needed for that use case.
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

laird
In reply to this post by Alan Cox
For Windows and Mac OS X, the user can select a file and tell the OS what application to use to open that file or that type of file (which uses file extension).

Opening .scad files opens OpenSCAD.

I don't want to open STL files in OpenSCAD. I want to open STL files in my slicer, which is already how my OS is set up. The only part that's missing is that I'd like OpenSCAD to tell the OS to open the file after it's written, after which the OS figures out what app the user wants to open the file and then does so.
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

tjhowse
I'd suggest rigging up some kind of watch script that monitors the STL
output folder and opens the STL in your slicer upon change.

On 20 February 2014 01:20, laird <[hidden email]> wrote:

> For Windows and Mac OS X, the user can select a file and tell the OS what
> application to use to open that file or that type of file (which uses file
> extension).
>
> Opening .scad files opens OpenSCAD.
>
> I don't want to open STL files in OpenSCAD. I want to open STL files in my
> slicer, which is already how my OS is set up. The only part that's missing
> is that I'd like OpenSCAD to tell the OS to open the file after it's
> written, after which the OS figures out what app the user wants to open the
> file and then does so.
>
>
>
> --
> View this message in context: http://forum.openscad.org/Would-love-an-option-to-auto-open-STLs-that-are-generated-tp6825p6918.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566
_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

eexpss
ubuntu, openscad in repo has right mime-type and desktop setting.

but openscad-nightly.deb lost mime-type.
Reply | Threaded
Open this post in threaded view
|

Re: Would love an option to auto-open STLs that are generated

kintel
Administrator

> On Jan 24, 2017, at 00:10, eexpss <[hidden email]> wrote:
>
> ubuntu, openscad in repo has right mime-type and desktop setting.
>
> but openscad-nightly.deb lost mime-type.
>
Could you summarize that into a new github issue?

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org