[OpenSCAD] avoiding assertion violation

Parkinbot rudolf at digitaldocument.de
Wed Jul 17 08:16:13 EDT 2019


Ronaldo wrote
>  In some sense this is a bug of rotate_extrude(). OpenScad complains when
> some edge of the polygon crosses the Y Axis because that would generate a
> self-intersection 3D object. The current case is a limit case of the
> forbiden crossing and OpenScad should issue an error as well.

It would be a progress to have a procrusting rotate_extrude() which performs
an (internal) intersection with the positive y-half of the XY plane on its
operands. This would eliminate at least some of the strange rotate_extrude()
issues. 
Another (natural) semantics would be to cut the operand into two halfs,
rotate them separately, and union the results. 

Here an implementation which I meanwhile use in my shortcuts.scad library:

Re() polygon([ [0,2], [-10,1.3],[2.5,0],[3,3], [2,4]]);
// Re2() polygon([ [0,2], [-10,1.3],[2.5,0],[3,3], [2,4]]);
cube();


module Re(angle = 360) // procrust operand to half XY-plane
{
  rotate_extrude(angle = angle)
  intersection() 
  {
    translate([0, -1e5])square([1e5, 2e5]); 
    children(); 
  }
}

module Re2(angle = 360)  // allow for all operands 
{
  rotate_extrude(angle = angle)
  intersection() 
  {
    translate([1e10, 0])square([2e10, 1e10], center = true); 
    children(); 
  }
  rotate_extrude(angle = angle)
  intersection() 
  {
    translate([-1e10, 0])square([2e10, 1e10], center = true); 
    children(); 
  }
}



--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list