why BooleanOperation does not work for database resident regions?!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi every one. I have a jig class and Im trying to subtract a region from some other ones while in jig.
this is the main drawing I have:
when I run the command, first this regions are create(I colored them so they can be seen):
I have another region which is jigged. now, Im willing to subtract the new colored regions from the main region that I have.
its working ok:
Till I move the cursor and I get this:
protected override SamplerStatus Sampler(JigPrompts prompts)
{
_dwg.Database.Orthomode = true;
var jigOptions = new JigPromptPointOptions();
jigOptions.SetMessageAndKeywords("\nInsert Sprinkler or [Rotate]:", "Rotate");
var jigResult = prompts.AcquirePoint(jigOptions);
switch (jigResult.Status)
{
case PromptStatus.Keyword:
//do stuff
break;
case PromptStatus.OK:
switch (_movingPoint.Equals(_wallsAndSoffits.BaseLine.GetClosestPointTo(
jigResult.Value, false)))
{
case true:
return SamplerStatus.NoChange;
case false:
var reflectedPoint = _wallsAndSoffits.BaseLine.GetClosestPointTo(
jigResult.Value, false);
_sideWallBlkReference.Position = reflectedPoint;
_pca = PCA.Region(_roomInfo, _wallsAndSoffits.WaterSprayOrientation
, _dwg.Editor, reflectedPoint);
ModifyPCAAccordingToRoomWalls();
ModifyPCAAccordingToSoffits();
_movingPoint = reflectedPoint;
return SamplerStatus.OK;
}
_movingPoint = jigResult.Value;
break;
default:
return SamplerStatus.Cancel;
}
return SamplerStatus.NoChange;
}
private void ModifyPCAAccordingToRoomWalls()
{
_pcaInRoom = _pca.Clone() as Region;
_pcaInRoom.BooleanOperation(BooleanOperationType.BoolIntersect, _wallsAndSoffits.WallRegion);
}
private void ModifyPCAAccordingToSoffits()
{
_soffitLessPCA = _pcaInRoom.Clone() as Region;
foreach(Soffit soffit in _wallsAndSoffits.Soffits)
{
_soffitLessPCA.BooleanOperation(BooleanOperationType.BoolSubtract,soffit.Region);
}
}
I also noticed some thing. when the sofft regions are added to the database I get an error:
why do I get this error when Im not manipulating the soffit regions?
also, the mainRegion is not in the database at all.
another question is:
my final aim is to hatch my _soffitlessPCA region. but since it has to update by the cursor move, I have to remove it and add it again in the world draw. is there any better way instead of adding and removing the region and hatch to the database every time the cursor moves?