[solved] Finding the intersection of plane and shape

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
stefankorisnik3
Posts: 101
Joined: Sun Jul 24, 2022 12:49 pm

[solved] Finding the intersection of plane and shape

Post by stefankorisnik3 »

Given a plane:

Code: Select all

plane = Part.Plane(App.Vector(0,0,0), App.Vector(10, 20, 30), App.Vector(2,3,10))
and the solid object

Code: Select all

s1
doing

Code: Select all

s1.Shape.section(plane) 
gives me the error:

Code: Select all

TypeError: PyCXX: Error creating object of type class Py::SeqBase<class Py::Object> from <Plane object>
what means this error?

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * CurvedShapes 1.0.3
  * Curves 0.5.2
Last edited by stefankorisnik3 on Sun Aug 07, 2022 4:22 pm, edited 1 time in total.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Finding the intersection of plane and shape

Post by onekk »

Try to see if this post will help in some manner:

https://forum.freecadweb.org/viewtopic. ... 97#p565897

Or maybe:

https://forum.freecadweb.org/viewtopic. ... 1&start=10

I have used something similar in a project:

https://forum.freecadweb.org/viewtopic.php?f=22&t=65308

Not related, but maybe it will be of some inspiration

Hope it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
stefankorisnik3
Posts: 101
Joined: Sun Jul 24, 2022 12:49 pm

Re: Finding the intersection of plane and shape

Post by stefankorisnik3 »

Thanks.
Found the solution:
Need to change this line

Code: Select all

s1.Shape.section(plane) 
to

Code: Select all

s1.Shape.section(plane.toShape()) 
Post Reply