Author Topic: boolean subtract using c#  (Read 2787 times)

0 Members and 1 Guest are viewing this topic.

artisteroi

  • Guest
boolean subtract using c#
« on: July 23, 2010, 05:01:56 PM »
so we have this really cool add-on that indexes and inserts 3D architectural blocks for us. We have some parts such as doors, and windows that we would like to use in our add on. We want them to be automatcally cut into the walls upon insertion. Anyone know how to do that?

 

I was thinking that the block could carry a template (solid) with it at insertion and the api could look for that solid and subtract the solid from any other solid it was touching. Sort of a hole puncher you know. Does that sound plausible?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: boolean subtract using c#
« Reply #1 on: July 23, 2010, 06:25:50 PM »
I did it in VBA, so I'm sure it can be done via .Net
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: boolean subtract using c#
« Reply #2 on: July 23, 2010, 06:26:49 PM »
on a side note, have you noticed that when you use a solid of a different color to subtract, the remaining pieces get colored (your jamb is red)
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

fixo

  • Guest
Re: boolean subtract using c#
« Reply #3 on: July 24, 2010, 04:01:48 AM »
so we have this really cool add-on that indexes and inserts 3D architectural blocks for us. We have some parts such as doors, and windows that we would like to use in our add on. We want them to be automatcally cut into the walls upon insertion. Anyone know how to do that?

 

I was thinking that the block could carry a template (solid) with it at insertion and the api could look for that solid and subtract the solid from any other solid it was touching. Sort of a hole puncher you know. Does that sound plausible?


      Hi, mate
      You could to create the clones of both solids
      then add them both to the to the block table record and the transaction
      and commit transaction at the end as always:
           
                   
Code: [Select]
''snip>
                    Dim sol3 As Solid3d = sol1.Clone()

                    Dim sol4 As Solid3d = sol2.Clone()

                    btr.AppendEntity(sol3)

                    tr.AddNewlyCreatedDBObject(sol3, True)

                    btr.AppendEntity(sol4)

                    tr.AddNewlyCreatedDBObject(sol4, True)

                    sol3.BooleanOperation(BooleanOperationType.BoolSubtract, sol4)

                  tr.Commit()''<snip

                  ~'J'~