Regression of Linear extrude in 0.17

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Regression of Linear extrude in 0.17

Postby keithsloan52 » Tue Oct 04, 2016 12:11 pm

I was trying to track down a bug so decided to try the latest version of FreeCAD but found that version 0.17 has introduced a regression that has made things even worse.

With a latest version of importCSG.py see https://www.dropbox.com/sh/zrm51sctaew0 ... KNVEa?dl=0
I am able to load this scad file in 0.16
testtext.scad
(44 Bytes) Downloaded 13 times
And the result is
testText.fcstd
(404.07 KiB) Downloaded 37 times
On version 0.17 I get
testText-V17..fcstd
(223.72 KiB) Downloaded 13 times
with an error message "shape must be a wire edge or compound, Something else was supplied.

If I cannot load a DXF file and then extrude it a lot of OpenSCAD function is going to be broken,

The versions of FreeCAD are

OS: Ubuntu 14.04.5 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6703 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 2ce5c8d2e3020d05005ed71f710e09e9aa561f40
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

and

OS: Ubuntu 14.04.5 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.17.8576 (Git)
Build type: None
Branch: master
Hash: 65a935f9ae164aa6857b77afcb2be6792435914c
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 12:44 pm

Try setting "Solid" property of Extrude to false. You seem to be extruding a face, so a solid will result anyway.

I made the behavior of "Solid" strict on purpose, but I think it might be worth changing it back to ignore "Solid" if extruding faces...
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Regression of Linear extrude in 0.17

Postby keithsloan52 » Tue Oct 04, 2016 1:09 pm

DeepSOIC wrote:Try setting "Solid" property of Extrude to false. You seem to be extruding a face, so a solid will result anyway.

I made the behavior of "Solid" strict on purpose, but I think it might be worth changing it back to ignore "Solid" if extruding faces...
I will see what I can do, but when I encounter a linear extrude in the CSG, I don't know if what it finds on the object stack i.e the thing to be extruded is a solid or a face without doing a lot of checking
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 1:17 pm

So, it looks like openscad's linear_extrude always makes solids from wires, right? I'm not familiar with openscad.
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 1:20 pm

You can add:

Code: Select all

    if hasattr(mylinear, "FaceMakerClass")
        mylinear.FaceMakerClass = "Part::FaceMakerExtrusion"
This will switch it to full legacy.
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 3:34 pm

keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Regression of Linear extrude in 0.17

Postby keithsloan52 » Tue Oct 04, 2016 3:43 pm

DeepSOIC wrote:So, it looks like openscad's linear_extrude always makes solids from wires, right? I'm not familiar with openscad.
A lot of the time its wires, but could be a solid it depends on what somebody has coded. The parser finds the linear_extrude statement and what it is to extrude is on an object stack. The object could be a solid or a wire, it depends on what the user codes.
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 3:44 pm

keithsloan52 wrote:solid or a wire
I guess you meant "face", not "solid", since Part Extrude can't extrude solids...
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Regression of Linear extrude in 0.17

Postby keithsloan52 » Tue Oct 04, 2016 5:00 pm

Okay I changed the following code in importCSG.py to change Solid from True to False

Code: Select all

mylinear = doc.addObject("Part::Extrusion","LinearExtrude")
    mylinear.Base = newobj #obj
    mylinear.Dir = (0,0,h)
    mylinear.Placement=FreeCAD.Placement()
    # V17 change to False mylinear.Solid = True
    mylinear.Solid = False
And the file now loads fine in FreeCAD v0.17

The problem I was originally trying to track down ( before problem with v0.17) is that the following scad file the Text should be hollow all the way through the block.
testHello.scad
(111 Bytes) Downloaded 18 times
testHello.fcstd
(181.04 KiB) Downloaded 15 times
Where as if I leave out the translate from the scad file it works
testHello2.scad
(91 Bytes) Downloaded 17 times
testHello2.fcstd
(237.27 KiB) Downloaded 31 times
But the text is not in the desired position

The translate gets converted to an MultiMatrix statement by OpenSCAD and the code for handling the MultiMatrix does some manipulation of a matrix and a FreeCAD.Placement request. I don't see how this affects the linear extrude other than the object being extruded is subject to the Placement request.

Any ideas how I can debug further.

The extrude has Dir[0.0 0.0 30.0] where 30 is the size of the extrude request.
The problem occurs in FreeCAD v0.16 as well as the latest v0.17
User avatar
DeepSOIC
Posts: 7821
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Regression of Linear extrude in 0.17

Postby DeepSOIC » Tue Oct 04, 2016 9:53 pm

Extrude should be fixed now. git commit d21f339a0f3fffd8f6b1caae0a861ae59d29f4a5

As for your original bug, I don't know. If I read the scad file, and compare it to freecad projects you posted, I think they are what I would expect them to be. But as I said, I don't know openscad.