discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Working around CGAL color limitations, mesh post processing.

U
ufomorace
Thu, Sep 10, 2015 1:48 PM

Thanks Torsten,

I can definitely add an x3d file format output because it is very similar to
.amf output. It's trivial difficulty, if i add x3d to the switch(format)
case list and i add a  export_x3d() function, i figure that x3d would appear
in the /window options list>file>export>format selection list./ Perhaps no
because it is also listed in another file?

So then there would be x3d export, without colors. then things become
difficult.

So i have seen the cgal website for color, and there is some information
about adding color using a class called
Triangulation_vertex_base_with_info_3 , and there is an example here:
http://doc.cgal.org/latest/Triangulation_3/#title12
http://doc.cgal.org/latest/Triangulation_3/#title12

And judging from the number of references to color on the cgal website, it's
improbable that a color can be used from the input mesh.

Thanks for the advice for installing a dev environment, i will add x3d
support and at least it will be there if someone knows about the
triangulation_3 class or some other method for writing a color array.

If it were possible to have just the input mesh and the output mesh arrays i
could arrange a color comparison code, and inside the output.cc wouldnt be a
bad place to loop through both meshes and generate a new array for output
colors that could be written to an x3d output file.

I see std::ostream &output and root_geom variables, i can see that
ostream somehow results in arrays , i think they arent computed live they
are stored after the CGAL process... and the root_geom would be cool if it
was the input geometry arrays, probably it isn'st.

--
View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p13758.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thanks Torsten, I can definitely add an x3d file format output because it is very similar to .amf output. It's trivial difficulty, if i add x3d to the switch(format) case list and i add a export_x3d() function, i figure that x3d would appear in the /window options list>file>export>format selection list./ Perhaps no because it is also listed in another file? So then there would be x3d export, without colors. then things become difficult. So i have seen the cgal website for color, and there is some information about adding color using a class called Triangulation_vertex_base_with_info_3 , and there is an example here: http://doc.cgal.org/latest/Triangulation_3/#title12 <http://doc.cgal.org/latest/Triangulation_3/#title12> And judging from the number of references to color on the cgal website, it's improbable that a color can be used from the input mesh. Thanks for the advice for installing a dev environment, i will add x3d support and at least it will be there if someone knows about the triangulation_3 class or some other method for writing a color array. If it were possible to have just the input mesh and the output mesh arrays i could arrange a color comparison code, and inside the output.cc wouldnt be a bad place to loop through both meshes and generate a new array for output colors that could be written to an x3d output file. I see *std::ostream &output* and *root_geom* variables, i can see that ostream somehow results in arrays , i think they arent computed live they are stored after the CGAL process... and the root_geom would be cool if it was the input geometry arrays, probably it isn'st. -- View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p13758.html Sent from the OpenSCAD mailing list archive at Nabble.com.
TP
Torsten Paul
Thu, Sep 10, 2015 3:32 PM

Von: ufomorace ant.stewart@yahoo.com

i figure that x3d would appear in the /window options
list>file>export>format selection list./ Perhaps no
because it is also listed in another file?

The menu entry for the GUI would need to be added to the UI description
file (using the QtDesigner)
https://github.com/openscad/openscad/blob/master/src/MainWindow.ui

In case you don't want to dig into that, I guess it would be ok to
just add the part that's used from command line like for AMF:
https://github.com/openscad/openscad/blob/master/src/openscad.cc#L512
We can add the GUI part later.

So then there would be x3d export, without colors. then things become
difficult.

Yes, the color support will have to wait until the CSG engine
supports that.

I see std::ostream &output and root_geom variables, i can see that
ostream somehow results in arrays , i think they arent computed live they
are stored after the CGAL process... and the root_geom would be cool if it
was the input geometry arrays, probably it isn'st.

There's basically 2 cases of input objects for the export. If the
mesh generation went though CGAL, that produces the CGAL_Nef_polyhedron
(https://github.com/openscad/openscad/blob/master/src/export.cc#L333),
for some cases, e.g. just linear_extrude() of a 2d shape, the input
is a simple (and OpenSCAD specific) PolySet object
(https://github.com/openscad/openscad/blob/master/src/export.cc#L321).
Both contain the whole computed mesh which could contain more than
one volume.

AMF export is currently just lazy and converts PolySet objects also
to CGAL_Nef_polyhedron which is not ideal, but works for now.

ciao,
Torsten.

Von: ufomorace <ant.stewart@yahoo.com> > i figure that x3d would appear in the /window options > list>file>export>format selection list./ Perhaps no > because it is also listed in another file? > The menu entry for the GUI would need to be added to the UI description file (using the QtDesigner) https://github.com/openscad/openscad/blob/master/src/MainWindow.ui In case you don't want to dig into that, I guess it would be ok to just add the part that's used from command line like for AMF: https://github.com/openscad/openscad/blob/master/src/openscad.cc#L512 We can add the GUI part later. > So then there would be x3d export, without colors. then things become > difficult. > Yes, the color support will have to wait until the CSG engine supports that. > I see *std::ostream &output* and *root_geom* variables, i can see that > ostream somehow results in arrays , i think they arent computed live they > are stored after the CGAL process... and the root_geom would be cool if it > was the input geometry arrays, probably it isn'st. > There's basically 2 cases of input objects for the export. If the mesh generation went though CGAL, that produces the CGAL_Nef_polyhedron (https://github.com/openscad/openscad/blob/master/src/export.cc#L333), for some cases, e.g. just linear_extrude() of a 2d shape, the input is a simple (and OpenSCAD specific) PolySet object (https://github.com/openscad/openscad/blob/master/src/export.cc#L321). Both contain the whole computed mesh which could contain more than one volume. AMF export is currently just lazy and converts PolySet objects also to CGAL_Nef_polyhedron which is not ideal, but works for now. ciao, Torsten.
U
ufomorace
Sat, Oct 17, 2015 1:58 PM

I've found an hitch with this project. Netfabb basic is necessary to correct
many complex STL's, and it doesn't support color. So if I arranged colors in
openscad they would be erased when fixing the STL with netfabb, and most of
us use basic version because consumer version costs 230.

--
View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p14160.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I've found an hitch with this project. Netfabb basic is necessary to correct many complex STL's, and it doesn't support color. So if I arranged colors in openscad they would be erased when fixing the STL with netfabb, and most of us use basic version because consumer version costs 230. -- View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p14160.html Sent from the OpenSCAD mailing list archive at Nabble.com.
J
jon
Sat, Oct 17, 2015 2:08 PM

I rarely need to fix OpenSCAD STL files.  Perhaps you need to refine
your code?

On 10/17/2015 9:58 AM, ufomorace wrote:

I've found an hitch with this project. Netfabb basic is necessary to correct
many complex STL's, and it doesn't support color. So if I arranged colors in
openscad they would be erased when fixing the STL with netfabb, and most of
us use basic version because consumer version costs 230.

I rarely need to fix OpenSCAD STL files. Perhaps you need to refine your code? On 10/17/2015 9:58 AM, ufomorace wrote: > I've found an hitch with this project. Netfabb basic is necessary to correct > many complex STL's, and it doesn't support color. So if I arranged colors in > openscad they would be erased when fixing the STL with netfabb, and most of > us use basic version because consumer version costs 230.
TP
Torsten Paul
Sat, Oct 17, 2015 2:14 PM

On 10/17/2015 03:58 PM, ufomorace wrote:

I've found an hitch with this project. Netfabb basic is necessary to correct
many complex STL's, and it doesn't support color. So if I arranged colors in
openscad they would be erased when fixing the STL with netfabb, and most of
us use basic version because consumer version costs 230.

There's no export format yet, where OpenSCAD supports colors (well, except
PNG, but I guess that does not count :-). So that's not much of an issue
yet.

At any rate, STL itself does not support any way of specifying colors,
so no program can support that without tricks like having multiple STL
files for different colors.

One option would be to use the newer AMF format which is supposed to
be STL 2.0. (they even use http://stl2.org/ as main web site).

ciao,
Torsten.

On 10/17/2015 03:58 PM, ufomorace wrote: > I've found an hitch with this project. Netfabb basic is necessary to correct > many complex STL's, and it doesn't support color. So if I arranged colors in > openscad they would be erased when fixing the STL with netfabb, and most of > us use basic version because consumer version costs 230. > There's no export format yet, where OpenSCAD supports colors (well, except PNG, but I guess that does not count :-). So that's not much of an issue yet. At any rate, STL itself does not support any way of specifying colors, so no program can support that without tricks like having multiple STL files for different colors. One option would be to use the newer AMF format which is supposed to be STL 2.0. (they even use http://stl2.org/ as main web site). ciao, Torsten.
U
ufomorace
Sat, Oct 17, 2015 7:16 PM

Sorry i meant encoding to a color .x3d. Some kinds of 3d i have errors, when
alot of objects are union i get errors. Here is a color x3d made from an
openscad file, It's from a random platonic weird algorythm, i thought it was
very cool, unfortunately all the resulting random shapes are made of radial
patterns which are aesthetically absurdist and mathematical and not human :
I colored this in another program using color relative to the angles of the
shapes. I am getting errors on most of these files stl files, then i fix
them in netfabb and use unity3d to color them in and save as x3d files. It's
viewable in meshlab.
PolyVTX__6409__13083.x3d
http://forum.openscad.org/file/n14170/PolyVTX__6409__13083.x3d

--
View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p14170.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Sorry i meant encoding to a color .x3d. Some kinds of 3d i have errors, when alot of objects are union i get errors. Here is a color x3d made from an openscad file, It's from a random platonic weird algorythm, i thought it was very cool, unfortunately all the resulting random shapes are made of radial patterns which are aesthetically absurdist and mathematical and not human :\ I colored this in another program using color relative to the angles of the shapes. I am getting errors on most of these files stl files, then i fix them in netfabb and use unity3d to color them in and save as x3d files. It's viewable in meshlab. PolyVTX__6409__13083.x3d <http://forum.openscad.org/file/n14170/PolyVTX__6409__13083.x3d> -- View this message in context: http://forum.openscad.org/Working-around-CGAL-color-limitations-mesh-post-processing-tp13698p14170.html Sent from the OpenSCAD mailing list archive at Nabble.com.