why BooleanOperation does not work for database resident regions?!

why BooleanOperation does not work for database resident regions?!

a.kouchakzadeh
Advocate Advocate
170 Views
0 Replies
Message 1 of 1

why BooleanOperation does not work for database resident regions?!

a.kouchakzadeh
Advocate
Advocate

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:

akouchakzadeh_2-1700984512186.png

when I run the command, first this regions are create(I colored them so they can be seen):

akouchakzadeh_1-1700984431613.png

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: 

akouchakzadeh_3-1700984976910.png

Till I move the cursor and I get this:

 

akouchakzadeh_4-1700985308842.png

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?

 

akouchakzadeh_0-1700984372952.png

 

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?

 

0 Likes
171 Views
0 Replies
Replies (0)