<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic why BooleanOperation does not work for database resident regions?! in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/why-booleanoperation-does-not-work-for-database-resident-regions/m-p/12400794#M6479</link>
    <description>&lt;P&gt;Hi every one. I have a jig class and Im trying to subtract a region from some other ones while in jig.&lt;/P&gt;&lt;P&gt;this is the main drawing I have:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_2-1700984512186.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297311iA7A05C1E86A41C8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_2-1700984512186.png" alt="akouchakzadeh_2-1700984512186.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;when I run the command, first this regions are create(I colored them so they can be seen):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_1-1700984431613.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297310iCA41F9EA70283938/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_1-1700984431613.png" alt="akouchakzadeh_1-1700984431613.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have another region which is jigged. now, Im willing to subtract the new colored regions from the main region that I have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;its working ok:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_3-1700984976910.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297312iF341789A695E0E47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_3-1700984976910.png" alt="akouchakzadeh_3-1700984976910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Till I move the cursor and I get this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_4-1700985308842.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297316i5AD49A6249FD1B1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_4-1700985308842.png" alt="akouchakzadeh_4-1700985308842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;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;
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt; 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);
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also noticed some thing. when the sofft regions are added to the database I get an error:&lt;/P&gt;&lt;P&gt;why do I get this error when Im not manipulating the soffit regions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_0-1700984372952.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297309iC755C559DB2C3EC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1700984372952.png" alt="akouchakzadeh_0-1700984372952.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also, the mainRegion is not in the database at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;another question is:&lt;BR /&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Nov 2023 08:56:21 GMT</pubDate>
    <dc:creator>a.kouchakzadeh</dc:creator>
    <dc:date>2023-11-26T08:56:21Z</dc:date>
    <item>
      <title>why BooleanOperation does not work for database resident regions?!</title>
      <link>https://forums.autodesk.com/t5/net-forum/why-booleanoperation-does-not-work-for-database-resident-regions/m-p/12400794#M6479</link>
      <description>&lt;P&gt;Hi every one. I have a jig class and Im trying to subtract a region from some other ones while in jig.&lt;/P&gt;&lt;P&gt;this is the main drawing I have:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_2-1700984512186.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297311iA7A05C1E86A41C8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_2-1700984512186.png" alt="akouchakzadeh_2-1700984512186.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;when I run the command, first this regions are create(I colored them so they can be seen):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_1-1700984431613.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297310iCA41F9EA70283938/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_1-1700984431613.png" alt="akouchakzadeh_1-1700984431613.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have another region which is jigged. now, Im willing to subtract the new colored regions from the main region that I have.&amp;nbsp;&lt;/P&gt;&lt;P&gt;its working ok:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_3-1700984976910.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297312iF341789A695E0E47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_3-1700984976910.png" alt="akouchakzadeh_3-1700984976910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Till I move the cursor and I get this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_4-1700985308842.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297316i5AD49A6249FD1B1F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_4-1700985308842.png" alt="akouchakzadeh_4-1700985308842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;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;
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt; 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);
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also noticed some thing. when the sofft regions are added to the database I get an error:&lt;/P&gt;&lt;P&gt;why do I get this error when Im not manipulating the soffit regions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_0-1700984372952.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1297309iC755C559DB2C3EC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1700984372952.png" alt="akouchakzadeh_0-1700984372952.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also, the mainRegion is not in the database at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;another question is:&lt;BR /&gt;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?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 08:56:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/why-booleanoperation-does-not-work-for-database-resident-regions/m-p/12400794#M6479</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-11-26T08:56:21Z</dc:date>
    </item>
  </channel>
</rss>

