View Issue Details

IDProjectCategoryView StatusLast Update
0003033FreeCADBugpublic2017-05-17 17:18
ReporterJPFrancoia Assigned Tokeithsloan52  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.16 
Summary0003033: rotate_extrude from Openscad
DescriptionHi, this is my first bug report for FreeCAD, I hope I'll do it well.

I made a moderately complicated design in OpenSCAD that uses custom (OpenSCAD) libraries. One of my libraries is called 'bend_pipe', I use it to make...bend pipes !

I use it like that in my design:

    
//Bend pipe, canula
    translate([0, -D_CANULA, LENGTH + EXT_D / 2 - REA_WALL + S_CANULA]) rotate([0, -90, 0]) bend_pipe(ed=D_CANULA, id=0, r=D_CANULA, quarter=true);

And here is the bend_pipe library:


//ed:      external diameter
//id:      internal diameter
//r:       bend radius
//quarter: if true, yields a 90° turn
//half:    if true, yields a 180° turn

//http://spolearninglab.com/curriculum/lessonPlans/hacking/resources/software/3d/openscad/openscad_helpers.html#

module bend_pipe(ed, id, r, quarter=false, half=false)
{
    difference()
    {

        intersection()
        {
            rotate_extrude(convexity=5) translate([r + id / 2, 0, 0]) circle(r=ed / 2);
            if(quarter)
            {
                translate([0,0,-r]) cube([r*2,r*2,r*2]);
            }
            else if(half)
            {
                translate([0,-r*2,-r]) cube([r*4,r*4,r*2]);
            }
        }
        rotate_extrude(convexity=5) translate([r + id / 2,0,0]) circle(r=id / 2);
    }
}

When I try to import the design with the bend_pipe line in freecad, I get this exception:

Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Draft/Draft.py", line 4190, in execute
    shape = Part.Face(shape)
<class 'Part.OCCError'>: Failed to create face from wire
Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/OpenSCAD/OpenSCADFeatures.py", line 233, in execute
    if fp.Base and fp.Base.Shape.isValid():
<type 'exceptions.RuntimeError'>: check failed, shape may be empty
Exception (Mon May 15 13:34:45 2017): Input shape is null 
Exception (Mon May 15 13:34:45 2017): Input shape is null

When I comment the bend_pipe line, I get no error in freecad and I can smoothly import my design.

I think the problem comes from the rotate_extrude lines in the bend_pipe library.

Can you help me ?
TagsOpenSCAD
FreeCAD Information

Activities

Kunda1

2017-05-15 14:51

administrator   ~0009021

Last edited: 2017-05-15 14:57

Please open a forum thread to discuss this directly with the community. Also remember to always mention your Help > About FreeCAD > Copy to clipboard version when posting for help.

Kunda1

2017-05-15 20:58

administrator   ~0009023

Soft ping @keithsloan52

keithsloan52

2017-05-15 21:10

developer   ~0009024

I just tried a quick test see pipe.scad and it all worked for me on my Mac which is still running 0.16.

Perhaps @JPFrancoia could provide a better test case that fails.
pipe.scad (821 bytes)
pipe.FCStd (7,578 bytes)

JPFrancoia

2017-05-15 21:41

reporter   ~0009025

@keithsloan52:

In your file pipe.scad, replace:


bend_pipe(5,4,10);

With:


bend_pipe(5,0,10);

Basically, it makes a full pipe (a bent cylinder). No internal diameter. While it might be stupid, it works in openscad.

keithsloan52

2017-05-17 04:55

developer   ~0009035

Last edited: 2017-05-17 11:00

Okay test files for problem pipe2

Problem should be fixed in FreeCAD Pull Request 758
Fix for circle with zero radius

pipe2.scad (826 bytes)
pipe2.fcstd (12,936 bytes)

keithsloan52

2017-05-17 04:56

developer   ~0009036

ping @JPFrancoia

JPFrancoia

2017-05-17 08:14

reporter   ~0009038

Nice, thanks !

Kunda1

2017-05-17 11:10

administrator   ~0009039

@keithsloan thank you very much!
FYI
Please familiarize yourself with the bugtracker markup https://freecadweb.org/wiki/tracker#MantisBT_Tips_and_Tricks

And with the bugtracker/github markup as well
specifically how to reference commits//diff/PRs from within the tracker:
https://freecadweb.org/wiki/tracker#MantisBT_.3C.3D.3E_GitHub_Markup
And how to reference the tracker from a github commit to auto magically link or close the tracker ticket:
https://freecadweb.org/wiki/tracker#GitHub_and_MantisBT

Issue History

Date Modified Username Field Change
2017-05-15 12:42 JPFrancoia New Issue
2017-05-15 14:51 Kunda1 Note Added: 0009021
2017-05-15 14:57 Kunda1 Note Edited: 0009021
2017-05-15 20:57 Kunda1 Tag Attached: OpenSCAD
2017-05-15 20:58 Kunda1 Note Added: 0009023
2017-05-15 21:10 keithsloan52 File Added: pipe.scad
2017-05-15 21:10 keithsloan52 File Added: pipe.FCStd
2017-05-15 21:10 keithsloan52 Note Added: 0009024
2017-05-15 21:41 JPFrancoia Note Added: 0009025
2017-05-17 04:55 keithsloan52 File Added: pipe2.scad
2017-05-17 04:55 keithsloan52 File Added: pipe2.fcstd
2017-05-17 04:55 keithsloan52 Note Added: 0009035
2017-05-17 04:56 keithsloan52 Note Added: 0009036
2017-05-17 08:14 JPFrancoia Note Added: 0009038
2017-05-17 11:00 Kunda1 Note Edited: 0009035
2017-05-17 11:10 Kunda1 Note Added: 0009039
2017-05-17 17:18 keithsloan52 Assigned To => keithsloan52
2017-05-17 17:18 keithsloan52 Status new => closed
2017-05-17 17:18 keithsloan52 Resolution open => fixed