discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

preview and render problem

G
gmagyar6@gmail.com
Fri, Feb 24, 2023 1:57 AM
Hello!

I have some questions and I would like a solution.

I'm still learning openscade for now. However, I noticed that, considering the difference between two primitives, the preview does not appear. I can only see the result when I render it.
(Linux Mint 21 Cinnamon
Pentium© Dual-Core CPU E5400 @ 2.70GHz × 2
Intel Corporation 4 Series Chipset Integrated Graphics Controller 3.7GB)

Can it be solved with some setting so that the preview is also visible?


The other question must have been somewhere. Sorry!
I am importing a binary stl. It displays and renders nicely.
Then I would multiply this imported file with a for loop. The preview shows exactly what I want, but the rendering does not execute.

module head(){
  union(){

  difference(){
    translate([0, 0, 0]) {
      scale([1, 1, 1.7])
        import("horse3.stl");
    }


  $fn=32;
  // eye1
    translate([5, 11, 73]){
      sphere(2.5);
    } 
    
 // eye2
    translate([5, -3, 55]){
      sphere(2.5);
    } 
 } //difference
 } //union
} //module head

 for (i=[0 : 120 : 360]) {
    rotate([0, 0, i])
      translate([5,5,0])
        head();
  }

Throw a CGAL error (CGAL error in CGALUtils::applyUnion3D: CGAL ERROR: precondition violation! Expr: ! _is_valid (_succ2_P) || comp_f (node1_P->object, _succ2_P->object) != LARGER File: /usr/include/CGAL /Multiset.h Line: 2344 ), 

and a warning (No top level geometry to render).

And of course nothing appears.

Why? Why is rendering fine with plain import and not working with loop?
Is it possible to put the result of the cycle in a variable and display it?
``` Hello! I have some questions and I would like a solution. I'm still learning openscade for now. However, I noticed that, considering the difference between two primitives, the preview does not appear. I can only see the result when I render it. (Linux Mint 21 Cinnamon Pentium© Dual-Core CPU E5400 @ 2.70GHz × 2 Intel Corporation 4 Series Chipset Integrated Graphics Controller 3.7GB) Can it be solved with some setting so that the preview is also visible? The other question must have been somewhere. Sorry! I am importing a binary stl. It displays and renders nicely. Then I would multiply this imported file with a for loop. The preview shows exactly what I want, but the rendering does not execute. module head(){ union(){ difference(){ translate([0, 0, 0]) { scale([1, 1, 1.7]) import("horse3.stl"); } $fn=32; // eye1 translate([5, 11, 73]){ sphere(2.5); } // eye2 translate([5, -3, 55]){ sphere(2.5); } } //difference } //union } //module head for (i=[0 : 120 : 360]) { rotate([0, 0, i]) translate([5,5,0]) head(); } Throw a CGAL error (CGAL error in CGALUtils::applyUnion3D: CGAL ERROR: precondition violation! Expr: ! _is_valid (_succ2_P) || comp_f (node1_P->object, _succ2_P->object) != LARGER File: /usr/include/CGAL /Multiset.h Line: 2344 ), and a warning (No top level geometry to render). And of course nothing appears. Why? Why is rendering fine with plain import and not working with loop? Is it possible to put the result of the cycle in a variable and display it? ```
G
gmagyar6@gmail.com
Fri, Feb 24, 2023 2:12 AM
I have another problem with this job.
The preview isn't really good though.
The attached pictures shows that the surface is transparent. I checked and corrected the original file with FReecad.
``` I have another problem with this job. The preview isn't really good though. The attached pictures shows that the surface is transparent. I checked and corrected the original file with FReecad. ```
JB
Jordan Brown
Fri, Feb 24, 2023 2:52 AM

On 2/23/2023 6:12 PM, gmagyar6@gmail.com wrote:

I have another problem with this job. The preview isn't really good
though.

The attached pictures shows that the surface is transparent. I checked
and corrected the original file with FReecad.

That one's easy.  You need to set the "convexity" parameter in the import.

In theory you should set it to the largest number of times a ray passing
through the object might enter and exit the object.

In practice it's usually fine to set it to some large but not huge
number like 10.

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_are_some_parts_(e.g._holes)_of_the_model_not_rendered_correctly?

On 2/23/2023 6:12 PM, gmagyar6@gmail.com wrote: > > I have another problem with this job. The preview isn't really good > though. > > The attached pictures shows that the surface is transparent. I checked > and corrected the original file with FReecad. > That one's easy.  You need to set the "convexity" parameter in the import. In theory you should set it to the largest number of times a ray passing through the object might enter and exit the object. In practice it's usually fine to set it to some large but not huge number like 10. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_are_some_parts_(e.g._holes)_of_the_model_not_rendered_correctly?
JB
Jordan Brown
Fri, Feb 24, 2023 3:09 AM

On 2/23/2023 5:57 PM, gmagyar6@gmail.com wrote:

I'm still learning openscade for now. However, I noticed that,
considering the difference between two primitives, the preview does
not appear. I can only see the result when I render it.

Can it be solved with some setting so that the preview is also visible?

||

That's really surprising.  Did you perhaps mix this up with your next
problem, where you can preview but cannot render?  Can you provide a
sample program that demonstrates this problem?

I am importing a binary stl. It displays and renders nicely.

Try this:

|import("horse3.stl"); cube(1); |

My bet is that F5 will be fine and on F6 you will get the same CGAL
error, and that you will get only a cube.

The problem is probably that your STL is not good enough for OpenSCAD's
picky CGAL processing.

Q:  Why does it fail only with F6, and not with F5?
A:  Because F6 does much more comprehensive processing.

Q:  Why does it fail with a cube, and not alone?
A:  Because that comprehensive processing is triggered only when it's
"necessary", typically when there's a boolean operation like the implied
union between the two.

Here's a discussion of the problem, with some possible techniques for
fixing the STL:
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6?

Is it possible to put the result of the cycle in a variable and
display it?

Mostly "no", but please elaborate on what you're thinking of.

On 2/23/2023 5:57 PM, gmagyar6@gmail.com wrote: > > I'm still learning openscade for now. However, I noticed that, > considering the difference between two primitives, the preview does > not appear. I can only see the result when I render it. > > Can it be solved with some setting so that the preview is also visible? > > || > That's really surprising.  Did you perhaps mix this up with your next problem, where you can preview but cannot render?  Can you provide a sample program that demonstrates this problem? > I am importing a binary stl. It displays and renders nicely. > Try this: |import("horse3.stl"); cube(1); | My bet is that F5 will be fine and on F6 you will get the same CGAL error, and that you will get only a cube. The problem is probably that your STL is not good enough for OpenSCAD's picky CGAL processing. Q:  Why does it fail only with F6, and not with F5? A:  Because F6 does much more comprehensive processing. Q:  Why does it fail with a cube, and not alone? A:  Because that comprehensive processing is triggered only when it's "necessary", typically when there's a boolean operation like the implied union between the two. Here's a discussion of the problem, with some possible techniques for fixing the STL: https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6? > Is it possible to put the result of the cycle in a variable and > display it? Mostly "no", but please elaborate on what you're thinking of.
G
gmagyar6@gmail.com
Fri, Feb 24, 2023 10:27 AM
Thanks, convexity solved the preview. :)


- ”try this”
As you can see in the picture, the cube appears in the preview, but the render does not display the cube either. The CGAL error and "no renderable surface" remained.

  • variable

I mean, something like this:  $Head= cycle;

I tried this and it didn't work either.

module heads(){
 for (i=[0 : 120 : 360]) {
    rotate([0, 0, i])
      translate([5,5,0])
        //scale([1,1, 1.3])
        head();  } // for i
}

heads();
``` Thanks, convexity solved the preview. :) ``` \ \- ”try this”\ As you can see in the picture, the cube appears in the preview, but the render does not display the cube either. The CGAL error and "no renderable surface" remained. - variable I mean, something like this: $Head= cycle; I tried this and it didn't work either. ``` module heads(){ ``` ``` for (i=[0 : 120 : 360]) { ``` ``` rotate([0, 0, i]) ``` ``` translate([5,5,0]) ``` ``` //scale([1,1, 1.3]) ``` ``` head(); } // for i } heads(); ```
G
gmagyar6@gmail.com
Fri, Feb 24, 2023 10:30 AM

The problem is probably that your STL is not good enough for OpenSCAD's
picky CGAL processing.

What mean is it? And what can I do?

> The problem is probably that your STL is not good enough for OpenSCAD's \ > picky CGAL processing. What mean is it? And what can I do?
JB
Jordan Brown
Fri, Feb 24, 2023 7:22 PM

On 2/24/2023 2:30 AM, gmagyar6@gmail.com wrote:

 The problem is probably that your STL is not good enough for
 OpenSCAD's
 picky CGAL processing.

What mean is it? And what can I do?

I'm not an expert in isolating STL problems.  See the entry in the FAQ
for some hints

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6

or maybe one of the people who is an expert in STL problems can look
at your STL.


The first thing I would do is to set View/Thrown Together, and
preview... anything purple is bad.  The outside of the model is yellow
and the inside is purple, so if you can see anything purple, it means
that something is inside-out.

But beyond that, alas, I don't know.

On 2/24/2023 2:30 AM, gmagyar6@gmail.com wrote: > > The problem is probably that your STL is not good enough for > OpenSCAD's > picky CGAL processing. > > What mean is it? And what can I do? > I'm not an expert in isolating STL problems.  See the entry in the FAQ for some hints https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6 or maybe one of the people who *is* an expert in STL problems can look at your STL. --- The first thing I would do is to set View/Thrown Together, and preview... anything purple is bad.  The outside of the model is yellow and the inside is purple, so if you can see anything purple, it means that something is inside-out. But beyond that, alas, I don't know.