OpenSCAD import potential bug with process_linear_extrude_with_transform

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
0jviq
Posts: 1
Joined: Mon Aug 08, 2022 11:16 pm

OpenSCAD import potential bug with process_linear_extrude_with_transform

Post by 0jviq »

I'm not 100% sure this is a bug, so I thought I'de put the steps up here and see if anyone else is able to reproduce it.

Issue:
There appears to be some kind of issue with from importCSG.py that generates invalid geometry that does not match the object operations in the tree when viewed from FreeCAD. Specifically a difference on the unioned object is treated like a second union in the case I am concerned about, and in another case it just crashes. This issue does not occur and importCSG.py works fine when process_linear_extrude from importCSG.py is used.

I've attached the scad file to generate the gears (you will need the BOSL2 library I link to at the top of the scad file), also two images are attached, one showing it working without helical set and one with the broken top level difference with helical set.

Environment:
- Ubuntu 20.04
- FreeCAD AppImage (FreeCAD_weekly-builds-29997-2022-08-07-conda-Linux-x86_64-py310.AppImage)
unpacked and repacked with fix below.
- The fix from https://forum.freecadweb.org/viewtopic.php?p=609157 mentioned in https://github.com/FreeCAD/FreeCAD-Bundle/issues/107
- OpenSCAD AppImage (OpenSCAD-2022.05.15.ai11886-x86_64.AppImage)


Summary of the results of importing the the above script with the values specified.

1) Using rotator_gear_teeth of=20 and helical=0 works when importing into FreeCAD.

2) Using rotator_gear_teeth of=20 and helical=10 throws the following error when importing into FreeCAD.

08:01:40 Traceback (most recent call last):
File "/tmp/.mount_FreeCAtz5vD0/usr/Mod/OpenSCAD/OpenSCADFeatures.py", line 409, in execute
self.createGeometry(fp)
File "/tmp/.mount_FreeCAtz5vD0/usr/Mod/OpenSCAD/OpenSCADFeatures.py", line 450, in createGeometry
pipe_shell.build()
<class 'Part.OCCError'>: Approx_CurvlinFunc::GetUParameter

3) Using rotator_gear_teeth of=40 and helical=0 works when importing into FreeCAD.

4) Using rotator_gear_teeth of=40 and helical=10 imports fine, but doesn't perform the difference operation and instead shows computes it as a union when importing into FreeCAD. (note the operations in the model tree are correct, they are just not generating the correct geometry.

EDIT:

Just afew other points after some additional testing.
Deleting the difference and union in FreeCAD and re-creating them based on the base objects, still results in the same incorrect geometry.
So I'm not sure it's purely an import issue, there may be something about how the union of transform_extrude operation in FreeCAD is performed that is at fault. The trouble is I don't actually know what an imported "transform_extrude" operation corresponds to as a FreeCAD operation. importCSG.py has the following for the transform_extrude "doc.addObject("Part::FeaturePython",'transform_extrude')", But I don't know what that corresponds to in the UI to attempt to recreate it entirely manually in FreeCAD.
Lastly performing a difference between the shaft hole and any of the non-unioned parts independently works fine too. It only fails when I attempt to generate the difference with the union of the part that includes a "transform_extrude" part.
Attachments
valid_top_level_difference_with_process_linear_extrude.png
valid_top_level_difference_with_process_linear_extrude.png (23.37 KiB) Viewed 615 times
helical_gear_test.scad
(2.96 KiB) Downloaded 10 times
invalid_difference_with_process_linear_extrude_with_transform.png
invalid_difference_with_process_linear_extrude_with_transform.png (28.77 KiB) Viewed 615 times
Post Reply