question about intersection

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
jmount
Posts: 2
Joined: Tue Nov 15, 2011 7:24 pm

question about intersection

Post by jmount »

Hi,

I am modeling pedestrian movement through space-time in order to address alibi queries and I am using ribbons to represent potential times-to-occupy locations in 3D space. In order to satisfy the query I need to compute the intersections of polygons in 3D space - i.e. using faces. There are two possible scenarios in the query - 1) that the ribbons are coplanar and 2) the ribbons are non-coplanar. In the case of the coplanar ribbons, I can compute the intersection of the ribbons (i.e. faces) and the results are correct (polygons/faces in 3d space). In the non-coplanar case - where faces may intersect from different planes I can calculate the intersection which should be a line in my example but I get an error that Inventor
cannot represent this shape.

Here is my code - this is just a toy example to make sure the process will work:

Code: Select all

#first face
pt1 = FreeCAD.Base.Vector(25,0,0)
pt2 = FreeCAD.Base.Vector(25,0,10)
pt3 = FreeCAD.Base.Vector(25,100,10)
pt4 = FreeCAD.Base.Vector(25,100,0)
linepart = [pt1,pt2,pt3,pt4,pt1]
poly1 = Part.makePolygon(linepart)
face3 = Part.Face(poly1)

#second face
pt5 = FreeCAD.Base.Vector(50,50,0)
pt6 = FreeCAD.Base.Vector(0,50,0)
pt7 = FreeCAD.Base.Vector(0,50,5)
pt8 = FreeCAD.Base.Vector(50,50,5)
linepart2 = [pt5,pt6,pt7,pt8,pt5]
poly2 = Part.makePolygon(linepart2)
face4 = Part.Face(poly2)

common2 = face3.common(face4)
I get an error message in the lower left corner of FreeCAD when I attempt to show the intersection that says:
"Cannot compute Inventor representation for the shape of Shape003". The result should be a line representing the intersection of the faces but I can't get any information about this line. Does anyone have any suggestion about returning the intersection line, point, or null if they don't intersect?

Sorry for the long question and thanks for any information,
Sincerely,
Jerry
jmount
Posts: 2
Joined: Tue Nov 15, 2011 7:24 pm

Re: question about intersection

Post by jmount »

Ok - sorry for the post. It looks like I can get the results using the section command instead of the common command. In my example, I can get the intersection using the following code:

Code: Select all

>>> section = face3.section(face4)
>>> section.Length
5.0
>>> section.Edges
[<Edge object at 10B45540>]
>>> section.Vertexes
[<Vertex object at 107A9720>, <Vertex object at 107A9740>]
>>> 
Thanks to the developers for FreeCAD. What a cool product.
wmayer
Founder
Posts: 20303
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: question about intersection

Post by wmayer »

I get an error message in the lower left corner of FreeCAD when I attempt to show the intersection that says:
"Cannot compute Inventor representation for the shape of Shape003". The result should be a line representing the intersection of the faces but I can't get any information about this line. Does anyone have any suggestion about returning the intersection line, point, or null if they don't intersect?
Boolean operations should only be used with solids because this is the shape type they are designed for. Sometimes it also works to use with simple faces but in most cases it fails.
Post Reply