discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Evaluating imported STL's

U
username
Wed, Jun 15, 2016 6:07 AM

Hi everyone, first time poster here. Just learned about OpenSCAD and I really
like the concept, being familiar with coding it's quite easy to get the hang
of it.

Would like to create a batch script which would load and STL (no faults,
procedurally generated by another app), check for certain
features/measurements...append some geometry in function of those
measurements then save it back into an STL. Currently doing this manually,
which is time consuming given the number of models we have to go though.

Question is: are there any functions available to check where two objects
would intersect or collide ? I mean kinda like raytracing form a given
coordinate with a given vector and see where that ray would intersect our
loaded mesh ? Or is there any feedback I could use ?

Thanks.

--
View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hi everyone, first time poster here. Just learned about OpenSCAD and I really like the concept, being familiar with coding it's quite easy to get the hang of it. Would like to create a batch script which would load and STL (no faults, procedurally generated by another app), check for certain features/measurements...append some geometry in function of those measurements then save it back into an STL. Currently doing this manually, which is time consuming given the number of models we have to go though. Question is: are there any functions available to check where two objects would intersect or collide ? I mean kinda like raytracing form a given coordinate with a given vector and see where that ray would intersect our loaded mesh ? Or is there any feedback I could use ? Thanks. -- View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Wed, Jun 15, 2016 6:25 AM

No.


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/Evaluating-imported-STL-s-tp17682p17683.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

No. ----- 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/Evaluating-imported-STL-s-tp17682p17683.html Sent from the OpenSCAD mailing list archive at Nabble.com.
LV
Lucas Vinicius Hartmann
Wed, Jun 15, 2016 11:34 AM

I am going to take Michael's word that there is no immediate way to do
that, but since you are procedurally generating solids I assume you are no
stranger to some programming.

You may use project(...) to grab a slice from your solid. From the command
line you can then modify a transformation so that project(...) gets a slice
of your interest, and export slices to dxf. Coding a 2D raytracer should be
an order of magnitude easier than a 3D one.

If all you need to know is IF 2 objects are colliding, then you may use
intersection(), export via commandline, and check for a non-empty resulting
STL (filesize maybe?).

If you need to know WHERE they are colliding then again use intersection(),
but this time you will need to parse the output STL and read the
coordinates. Still easier than calculating the collision yourself.
Em 15/06/2016 03:08, "username" atex76@shaw.ca escreveu:

Hi everyone, first time poster here. Just learned about OpenSCAD and I
really
like the concept, being familiar with coding it's quite easy to get the
hang
of it.

Would like to create a batch script which would load and STL (no faults,
procedurally generated by another app), check for certain
features/measurements...append some geometry in function of those
measurements then save it back into an STL. Currently doing this manually,
which is time consuming given the number of models we have to go though.

Question is: are there any functions available to check where two objects
would intersect or collide ? I mean kinda like raytracing form a given
coordinate with a given vector and see where that ray would intersect our
loaded mesh ? Or is there any feedback I could use ?

Thanks.

--
View this message in context:
http://forum.openscad.org/Evaluating-imported-STL-s-tp17682.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

I am going to take Michael's word that there is no immediate way to do that, but since you are procedurally generating solids I assume you are no stranger to some programming. You may use project(...) to grab a slice from your solid. From the command line you can then modify a transformation so that project(...) gets a slice of your interest, and export slices to dxf. Coding a 2D raytracer should be an order of magnitude easier than a 3D one. If all you need to know is IF 2 objects are colliding, then you may use intersection(), export via commandline, and check for a non-empty resulting STL (filesize maybe?). If you need to know WHERE they are colliding then again use intersection(), but this time you will need to parse the output STL and read the coordinates. Still easier than calculating the collision yourself. Em 15/06/2016 03:08, "username" <atex76@shaw.ca> escreveu: > Hi everyone, first time poster here. Just learned about OpenSCAD and I > really > like the concept, being familiar with coding it's quite easy to get the > hang > of it. > > Would like to create a batch script which would load and STL (no faults, > procedurally generated by another app), check for certain > features/measurements...append some geometry in function of those > measurements then save it back into an STL. Currently doing this manually, > which is time consuming given the number of models we have to go though. > > Question is: are there any functions available to check where two objects > would intersect or collide ? I mean kinda like raytracing form a given > coordinate with a given vector and see where that ray would intersect our > loaded mesh ? Or is there any feedback I could use ? > > Thanks. > > > > -- > View this message in context: > http://forum.openscad.org/Evaluating-imported-STL-s-tp17682.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 >
J
jon
Wed, Jun 15, 2016 11:42 AM

Seems like it would be possible to change the language to create an
intersects() function that returns a boolean

On 6/15/2016 7:34 AM, Lucas Vinicius Hartmann wrote:

If all you need to know is IF 2 objects are colliding, then you may
use intersection(), export via commandline, and check for a non-empty
resulting STL (filesize maybe?).

Seems like it would be possible to change the language to create an intersects() function that returns a boolean On 6/15/2016 7:34 AM, Lucas Vinicius Hartmann wrote: > If all you need to know is IF 2 objects are colliding, then you may > use intersection(), export via commandline, and check for a non-empty > resulting STL (filesize maybe?).
P
Parkinbot
Wed, Jun 15, 2016 12:07 PM

lhartmann wrote

If all you need to know is IF 2 objects are colliding, then you may use
intersection(), export via commandline, and check for a non-empty
resulting
STL (filesize maybe?).

This could work, but I doubt OpenSCAD will export an empty STL. So you'd
have to catch some error, which is viable.

There is also a fast heuristic way to do a batched collision test, with no
extra rendering involved

  • count the number of vertices v_i and faces f_i in all ingoing STLs and
    v_a, f_i of the combined STL.
  • test for sum(v_i) != v_a && sum(f_i) != f_a

Its heuristic, because depending on your problem, there might be a very
small probability to get a false result. This is, when two shapes intersect
and have the same number of vertices AND faces.

--
View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17688.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

lhartmann wrote > If all you need to know is IF 2 objects are colliding, then you may use > intersection(), export via commandline, and check for a non-empty > resulting > STL (filesize maybe?). This could work, but I doubt OpenSCAD will export an empty STL. So you'd have to catch some error, which is viable. There is also a fast heuristic way to do a batched collision test, with no extra rendering involved - count the number of vertices v_i and faces f_i in all ingoing STLs and v_a, f_i of the combined STL. - test for sum(v_i) != v_a && sum(f_i) != f_a Its heuristic, because depending on your problem, there might be a *very* small probability to get a false result. This is, when two shapes intersect and have the same number of vertices AND faces. -- View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17688.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Wed, Jun 15, 2016 12:32 PM

jon_bondy wrote

Seems like it would be possible to change the language to

As I said, NO.

There have/are proposals to...

but now, NO.

Even then, F5 v's F6 (full render) make such proposals reliant on full F6
render, thus losing the advantage of fast development which current F5
provides.

Any such proposals further weaken the current OpenSCAD advantages, which the
progression to things like resize() etc. which denude the F5 performance
advantage.


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/Evaluating-imported-STL-s-tp17682p17689.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

jon_bondy wrote > Seems like it would be possible to change the language to As I said, NO. There have/are proposals to... but now, NO. Even then, F5 v's F6 (full render) make such proposals reliant on full F6 render, thus losing the advantage of fast development which current F5 provides. Any such proposals further weaken the current OpenSCAD advantages, which the progression to things like resize() etc. which denude the F5 performance advantage. ----- 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/Evaluating-imported-STL-s-tp17682p17689.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Wed, Jun 15, 2016 12:37 PM

lhartmann wrote

but since you are procedurally generating solids I assume you are no
stranger to some programming.

You may use ...

Coding a 2D raytracer should be
an order of magnitude easier than a 3D one.

you may use intersection(), export via commandline, and check for a
non-empty resulting
STL (filesize maybe?).

Still easier than calculating the collision yourself.

You could probably do it with a batch script...

But then you would be better off using a language designed to do the job.

Sorry, I have elevated Grump-Old-Man levels ATM...


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/Evaluating-imported-STL-s-tp17682p17690.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

lhartmann wrote > but since you are procedurally generating solids I assume you are no > stranger to some programming. > > You may use ... > > Coding a 2D raytracer should be > an order of magnitude easier than a 3D one. > > you may use intersection(), export via commandline, and check for a > non-empty resulting > STL (filesize maybe?). > > Still easier than calculating the collision yourself. You could probably do it with a batch script... But then you would be better off using a language designed to do the job. Sorry, I have elevated Grump-Old-Man levels ATM... ----- 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/Evaluating-imported-STL-s-tp17682p17690.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Wed, Jun 15, 2016 1:02 PM

sorry, there was a typo:

  • test for sum(v_i) == v_a && sum(f_i) == f_a

Parkinbot wrote

There is also a fast heuristic way to do a batched collision test, with no
extra rendering involved

  • count the number of vertices v_i and faces f_i in all ingoing STLs and
    v_a, f_i of the combined STL.
  • test for sum(v_i) != v_a && sum(f_i) != f_a

--
View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17692.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

sorry, there was a typo: - test for sum(v_i) == v_a && sum(f_i) == f_a Parkinbot wrote > There is also a fast heuristic way to do a batched collision test, with no > extra rendering involved > - count the number of vertices v_i and faces f_i in all ingoing STLs and > v_a, f_i of the combined STL. > - test for sum(v_i) != v_a && sum(f_i) != f_a -- View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17692.html Sent from the OpenSCAD mailing list archive at Nabble.com.
A
arnholm@arnholm.org
Wed, Jun 15, 2016 2:10 PM

On 2016-06-15 13:34, Lucas Vinicius Hartmann wrote:

If all you need to know is IF 2 objects are colliding, then you may
use intersection(), export via commandline, and check for a non-empty
resulting STL (filesize maybe?).

Based on 2 STL files (or better: 2 AMF files), it would be trivially
easy and fast to determine many cases of non-intersection, based on
bounding boxes. However, there will be cases where bounding boxes
intersect but where the bodies still do not intersect. For these cases a
more detailed intersection algorithm is needed.

However, I am not aware of any way something like this can be done in
OpenSCAD.

Carsten Arnholm

On 2016-06-15 13:34, Lucas Vinicius Hartmann wrote: > If all you need to know is IF 2 objects are colliding, then you may > use intersection(), export via commandline, and check for a non-empty > resulting STL (filesize maybe?). Based on 2 STL files (or better: 2 AMF files), it would be trivially easy and fast to determine many cases of non-intersection, based on bounding boxes. However, there will be cases where bounding boxes intersect but where the bodies still do not intersect. For these cases a more detailed intersection algorithm is needed. However, I am not aware of any way something like this can be done in OpenSCAD. Carsten Arnholm
U
username
Wed, Jun 15, 2016 2:39 PM

Thanks for the responses

--
View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17694.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks for the responses -- View this message in context: http://forum.openscad.org/Evaluating-imported-STL-s-tp17682p17694.html Sent from the OpenSCAD mailing list archive at Nabble.com.