Possible bug: Cutting array of cylinders into cube fails

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!
PedjaS
Posts: 52
Joined: Sat Jan 18, 2020 6:35 pm

Possible bug: Cutting array of cylinders into cube fails

Postby PedjaS » Sat Sep 05, 2020 9:25 pm

I have Created simple array of Cylinders and Cube, and I want to use array of Cylinders to cut holes into Cube.

It fails. Instead cutting holes both objects vanish. This is not first time I have this issue. It started with upgrade to 0.19.

It seems bug to me but I would like to check with others before reporting.

Here is file that fails to me:
holes.FCStd
(12.69 KiB) Downloaded 20 times


OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git)
Build type: Release
Branch: master
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
chrisb
Posts: 26920
Joined: Tue Mar 17, 2015 9:14 am

Re: Possible bug: Cutting array of cylinders into cube fails

Postby chrisb » Sat Sep 05, 2020 10:05 pm

It works if you use a normal array instead of a link array. Although it works, there is some danger in your model: boolean operations such as cut tend to fail if coplanar faces are involved. You can eliminate this by makeing the cylinders slightly bigger.
vocx
Posts: 4977
Joined: Thu Oct 18, 2018 9:18 pm

Re: Possible bug: Cutting array of cylinders into cube fails

Postby vocx » Sat Sep 05, 2020 10:23 pm

PedjaS wrote:
Sat Sep 05, 2020 9:25 pm
I have Created simple array of Cylinders and Cube, and I want to use array of Cylinders to cut holes into Cube...
When you perform boolean operations it is usually better to use the regular array instead of the Link array; uncheck the Link checkbox in the task panel when launching Draft OrthoArray.
realthunder wrote: ping
It is not entirely clear to me if the Link array can be used perfectly in boolean operations, or whether there is a pending commit that fixes some issues with this. Does the Link array provide a compound of the duplicated Shapes, just like the regular array?

This is the message that I get when using a link array as cutting tool. The Part Cut is correctly produced but I get this message.

Code: Select all

17:16:50  <Gui> Document.cpp(818): Memory exception in holes#Cut thrown: Not enough memory available
Part_Cut_LinkArray.png
Part_Cut_LinkArray.png (38 KiB) Viewed 211 times

Code: Select all

OS: Ubuntu 18.04.5 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22366 (Git)
Build type: Release
Branch: master
Hash: 34c11fcc63efa2fc72cbc74c75c76e9f19d5c84c
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
PedjaS
Posts: 52
Joined: Sat Jan 18, 2020 6:35 pm

Re: Possible bug: Cutting array of cylinders into cube fails

Postby PedjaS » Sat Sep 05, 2020 10:41 pm

It works when I create array with Link array unchecked. However, that is checked by default, so if it does not work it should be unchecked.

It seems it is not possible to disable Link array afterwards? If that is the case than it is one more reason to have it unchecked by default, as when user finds out that is the issue, he may be far in complex project that removing array and replacing it with another one could be hard or not possible.

I did at first set cylinders slightly bigger. Then I tried to set them exact as base to see if that matters and left it that way.

In mean while, I redo project in 0.18 and there it works as expected (it seems not to have Link array option).

Thanks a lot for help.
vocx
Posts: 4977
Joined: Thu Oct 18, 2018 9:18 pm

Re: Possible bug: Cutting array of cylinders into cube fails

Postby vocx » Sun Sep 06, 2020 3:54 am

PedjaS wrote:
Sat Sep 05, 2020 10:41 pm
It works when I create array with Link array unchecked. However, that is checked by default, so if it does not work it should be unchecked.
...
App Links are more efficient when you just want to duplicate objects many times; this is a workflow intended for assembly, for example, to duplicate many bolts or screws or nuts.

And you can set the default to create normal arrays. You just need to uncheck the Link array checkbox. Then next time that you open the Draft OrthoArray tool, it will remember the option used last time. This is controlled with the parameter "Draft_array_Link", that you can see in the Parameter editor, under Mod/Draft.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Posts: 26920
Joined: Tue Mar 17, 2015 9:14 am

Re: Possible bug: Cutting array of cylinders into cube fails

Postby chrisb » Sun Sep 06, 2020 5:26 am

Behaviour of LinkArray seems to be a bit unpredictable: Yesterday the cut definitely didn't work. That's why I tried the regular array instead. I'm not sure about any error message but I'm quite sure I didn't get one. Today I wanted to check for the message - and the cut succeeds! Without any message.
realthunder
Posts: 1712
Joined: Tue Jan 03, 2017 10:55 am

Re: Possible bug: Cutting array of cylinders into cube fails

Postby realthunder » Sun Sep 06, 2020 8:13 am

PR submitted here.

The problem is not really about cutting using Link, but unsafe pointer casting in cut view provider. Because ViewProviderLink overrides Part.Feature (type of draft link array)'s original view provider, cut view provider must not assume its child object's view provider type.

Regarding the use of link array for boolean operation, there is indeed a disadvantage with current upstream. The color in the array will NOT be passed to boolean feature. This problem will be solved once my topo naming feature is merged.
Try Assembly3 (latest version 0.11) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
chrisb
Posts: 26920
Joined: Tue Mar 17, 2015 9:14 am

Re: Possible bug: Cutting array of cylinders into cube fails

Postby chrisb » Sun Sep 06, 2020 8:31 am

realthunder wrote:
Sun Sep 06, 2020 8:13 am
PR submitted
Thanks for the quick fix.