[Fixed] Regression : Intersect do not accept plane as argument

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Cyril
Posts: 123
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

[Fixed] Regression : Intersect do not accept plane as argument

Postby Cyril » Mon Sep 28, 2020 9:59 am

Hi,

There is apparently a regression with intersect. It does not accept anymore a plane as argument :
  • Using my build on commit 2a510a23b480a24bac424383a663200e2c293f10 doesn't work

    Code: Select all

    >>> pl1 = Part.Plane()
    >>> pl2 = Part.Plane(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(1, 0, 0))
    >>> pl1.intersect(pl2)
    Traceback (most recent call last):
      File "<input>", line 1, in <module>
    TypeError: argument 1 must be Part.Curve, not Part.Plane
  • Using my build on commit f09d48d0fe00590997b88b52b610210ac606951c works :

    Code: Select all

    >>> pl1 = Part.Plane()
    >>> pl2 = Part.Plane(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(1, 0, 0))
    >>> pl1.intersect(pl2)
    [<Line object>]
Raw code to reproduce :

Code: Select all

pl1 = Part.Plane()
pl2 = Part.Plane(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(1, 0, 0))
pl1.intersect(pl2)
Edit : intersectSS which is specialized for this case also return an error :

Code: Select all

>>> pl1.intersectSS(pl2)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
SystemError: Objects/listobject.c:353: bad argument to internal function
OS: Manjaro Linux (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19 (Git)
Build type: Release
Branch: master
Hash: see above
Python version: 3.8.5
Qt version: 5.15.0
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
Last edited by Kunda1 on Sat Oct 17, 2020 9:45 am, edited 1 time in total.
Reason: Added [Fixed] to thread title
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
User avatar
Cyril
Posts: 123
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Regression : Intersect do not accept plane as argument

Postby Cyril » Fri Oct 09, 2020 3:07 pm

Anyone can confirm so I can open an issue on bug tracker ?
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
User avatar
Kunda1
Posts: 8378
Joined: Thu Jan 05, 2017 9:03 pm

Re: Regression : Intersect do not accept plane as argument

Postby Kunda1 » Fri Oct 09, 2020 3:30 pm

<off topic> I would love it if there was an option to copy/paste from code snippets but automagically edit out the preceding >>> so I can easily paste in to Python console
Can anyone tweak phpbb to do that?
</off topic>
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 8378
Joined: Thu Jan 05, 2017 9:03 pm

Re: Regression : Intersect do not accept plane as argument

Postby Kunda1 » Fri Oct 09, 2020 3:34 pm

Can reproduce on

Code: Select all

OS: Manjaro Linux (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22665 (Git) AppImage
Build type: Release
Branch: master
Hash: b0d7850406e046f3b7a8cd5da261e7d54df6bd99
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)

Here is the output:

Code: Select all

>>> pl1 = Part.Plane()
>>> pl2 = Part.Plane(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(1, 0, 0))
>>> pl1.intersect(pl2)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: argument 1 must be Part.Curve, not Part.Plane
Edit:

Also breaks with intersectSS()

Code: Select all

>>> pl1 = Part.Plane()
>>> pl2 = Part.Plane(FreeCAD.Vector(0, 0, 0), FreeCAD.Vector(1, 0, 0))
>>> pl1.intersectSS(pl2)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
SystemError: /home/conda/feedstock_root/build_artifacts/python-split_1602094424782/work/Objects/listobject.c:353: bad argument to internal function
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Regression : Intersect do not accept plane as argument

Postby vocx » Fri Oct 09, 2020 6:05 pm

Cyril wrote:
Mon Sep 28, 2020 9:59 am

[*] Using my build on commit 2a510a23b480a24bac424383a663200e2c293f10 doesn't work
...
[*] Using my build on commit f09d48d0fe00590997b88b52b610210ac606951c works :
This is a month of difference.
* git commit 2a510a23b4, 2020 September 28
* git commit f09d48d0fe, 2020 August 26

A lot of commits were made in that period which could be responsible. It would be good if you tried narrowing down the issue.

I can confirm as well with 0.19.22668.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Kunda1
Posts: 8378
Joined: Thu Jan 05, 2017 9:03 pm

Re: Regression : Intersect do not accept plane as argument

Postby Kunda1 » Fri Oct 09, 2020 6:18 pm

Mod edit: Moved to Developer Corder
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Cyril
Posts: 123
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Regression : Intersect do not accept plane as argument

Postby Cyril » Fri Oct 09, 2020 7:41 pm

Kunda1 wrote:
Fri Oct 09, 2020 3:30 pm
<off topic> I would love it if there was an option to copy/paste from code snippets but automagically edit out the preceding >>> so I can easily paste in to Python console
Can anyone tweak phpbb to do that?
</off topic>
This is why I added a raw code to reproduce section :lol:
vocx wrote:
Fri Oct 09, 2020 6:05 pm
This is a month of difference.
* git commit 2a510a23b4, 2020 September 28
* git commit f09d48d0fe, 2020 August 26

A lot of commits were made in that period which could be responsible. It would be good if you tried narrowing down the issue.

I can confirm as well with 0.19.22668.
I know there is a long period between these commits I compiled before my holidays then when I came back I compiled once see the issue and waited for while to make sure it was not a temporary issue.
I tried to investigate myself in the C++ code but git blame shows that there was no change in intersect / intersectSS for years. I really don't know from where this issue come from and I don't know how to perform a step by step debug with C++ code.
Kunda1 wrote:
Fri Oct 09, 2020 6:18 pm
Mod edit: Moved to Developer Corder
I did not understand why you moved the post. It is an issue in Part. I thought Part Design sub-forum was the right place to post.

Thank you all for your confirmations.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
User avatar
Kunda1
Posts: 8378
Joined: Thu Jan 05, 2017 9:03 pm

Re: Regression : Intersect do not accept plane as argument

Postby Kunda1 » Fri Oct 09, 2020 8:07 pm

Cyril wrote:
Fri Oct 09, 2020 7:41 pm
I did not understand why you moved the post. It is an issue in Part. I thought Part Design sub-forum was the right place to post.
Because we want wmayer to see it.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Cyril
Posts: 123
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Regression : Intersect do not accept plane as argument

Postby Cyril » Fri Oct 09, 2020 8:34 pm

I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Regression : Intersect do not accept plane as argument

Postby vocx » Fri Oct 09, 2020 8:41 pm

Cyril wrote:
Fri Oct 09, 2020 7:41 pm
...
I tried to investigate myself in the C++ code but git blame shows that there was no change in intersect / intersectSS for years.
...
Intersect is a method of the Part TopoShape class, so the change may not be in the method itself, but somewhere in the TopoShape pipeline. You can see Werner made tons of changes to Part in that period, maybe something isn't passed to the internal classes as it was done before.

git commit 2a510a23b4

You can browse all commits before this one, and see if there is something interesting in the Part module. Compile a few versions and see if you can narrow it down.

https://github.com/FreeCAD/FreeCAD/commits/2a510a23b4
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.