3D polygons boolean operations

3D polygons boolean operations

c_hanschen
Advocate Advocate
696 Views
6 Replies
Message 1 of 7

3D polygons boolean operations

c_hanschen
Advocate
Advocate

Hello,

 

Is there a way to construct 3D polygons (not in model, just for calculations) and perform boolean operations?

(substract, union)

 

I'm looking for a way to substract a face from a face, but both faces are not actual faces but result of calculations.

There is no 'New' available for Face.

 

see attached image for more info.

 

looking for: 

 dim Face1 as List (Of XYZ) From {p1,p2,p3,p4,.......}

 dim Face2 as List (Of XYZ) From {p10,p11,p12,p13,.......}

 

NewFace = Face1.substract(Face2)

 

Revit makes these calculations posible for Points (XYZ) and Lines, calculate distance, intersections, etc.

 

Thanks in Advance,

 

Chris Hanschen

LKSVDD architecten 

The Netherlands

 

0 Likes
697 Views
6 Replies
Replies (6)
Message 2 of 7

KM_Yotsuha
Advocate
Advocate

you can try Clipper~~~

 

first,you create a local coordinate system where  z of point in this coordinate is 0;

then, use method in clipper.dll to perform boolean operarion,get  result points;

transform the coordinate to globle coordinate~~

0 Likes
Message 3 of 7

c_hanschen
Advocate
Advocate
thanks for your comment, I will give this a try!
I thought maybe Revit has it own 'clipper', but i will try this!

Thanks!

Chris
0 Likes
Message 4 of 7

KM_Yotsuha
Advocate
Advocate

Plan B:

1、create curveloop by points;

2、create solid by extrusion

3、boolean operation on the solids

4、get face from result solid~~~

I have not tryed this way yet,hope it can work for you~

Message 5 of 7

jeremy_tammik
Alumni
Alumni

Performing a 3D Boolean operation to calculate a 2D Boolean result is a huge waste of resources.  If your 2D faces of interest are planar polygons, there are much simpler solutions available:

  

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.2

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 6 of 7

c_hanschen
Advocate
Advocate

@jeremy_tammik , thanks for your reply.

I understand what you are saying, but my planar polygons can be horizontal, vertical or everything in between.

So I thought there would be a simple solution for this, calculation to 2D, substract and calculate back to 3D would also be not so simple.

I think I am going to give clipper a try.

 

Thanks again!

 

Chris

0 Likes
Message 7 of 7

jeremy_tammik
Alumni
Alumni

Yes, it simplifies things a lot to transform the planar polygon in 3D space into a simple 2D XY coordinate system. I explained how to do so early on in my exploration of the Revit API, 14 years ago:

  

https://thebuildingcoder.typepad.com/blog/2008/12/polygon-transformation.html

  

So, you can imagine how fundamental and also simple this task is.

  

It is vastly simpler than trying to perform a 3D Boolean operation; probably several orders of magnitude less computation effort.

    

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open