TheSwamp

Code Red => .NET => Topic started by: Andrey Bushman on June 03, 2014, 04:31:35 PM

Title: Region meshing
Post by: Andrey Bushman on June 03, 2014, 04:31:35 PM
It is necessary to mesh the target regions. Each output "cell" must to be a region too. It is not difficult for common cases:

(http://3.bp.blogspot.com/-4Hr4DtKAjBY/U43vIk9clOI/AAAAAAAABdI/CedfssNmpqY/s1600/p4.png)

But sometime some output regions can to be consisting of several parts:

(http://1.bp.blogspot.com/-P1Y43RC2-1Q/U43v_xq9k1I/AAAAAAAABdg/Hmhr0auIg_8/s1600/7.png)

I need exclude such results. Each output region must to be as a single one. How can I to separate such regions to the certain regions?

Can I create the Region based on a Face object from the Brep.Faces collection?
Title: Re: Region meshing
Post by: SEANT on June 03, 2014, 06:20:22 PM
If the Brep of the Region has more than one Complex, Explode the Region.  That should return a DBObjectCollection of Regions that were the individual pieces of the original.  Delete the original Region if necessary.
Title: Re: Region meshing
Post by: Andrey Bushman on June 04, 2014, 03:17:43 AM
If the Brep of the Region has more than one Complex, Explode the Region.  That should return a DBObjectCollection of Regions that were the individual pieces of the original.  Delete the original Region if necessary.
Thank you! Explode works fine! In my code I cheked the Faces instead of Complex.
Code - C#: [Select]
  1. using(Br.Brep brep = new Br.Brep(rowClone)) {
  2.   if(brep.Faces != null && brep.Faces.Count() > 1) {
  3.     using(Db.DBObjectCollection explodeResult =
  4.       new Db.DBObjectCollection()) {
  5.       rowClone.Explode(explodeResult);
  6.       foreach(Db.DBObject item in explodeResult) {
  7.         result.Add((Db.Region)item);
  8.       }
  9.     }
  10.  
  11.     if(!rowClone.IsDisposed)
  12.       rowClone.Dispose();
  13.   }
  14.   else
  15.     result.Add(rowClone);
  16. }
Can I get a problem this case?
Title: Re: Region meshing
Post by: SEANT on June 04, 2014, 06:24:49 AM
For Regions that probably will work.