TheSwamp

Code Red => .NET => Topic started by: artisteroi on July 23, 2010, 05:01:56 PM

Title: boolean subtract using c#
Post by: artisteroi 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?
Title: Re: boolean subtract using c#
Post by: David Hall on July 23, 2010, 06:25:50 PM
I did it in VBA, so I'm sure it can be done via .Net
Title: Re: boolean subtract using c#
Post by: David Hall 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)
Title: Re: boolean subtract using c#
Post by: fixo 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'~