<?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 Re: XCLIP - No Boundary Found in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/xclip-no-boundary-found/m-p/13200492#M19368</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the same problem when trying to clip a block reference. I've been trying to find the solution and have come across your topic. Have you found the solution yet? If you have one, please share it. I can't find any information about this problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I saved and reopened the drawing, it fixed the problem. But it's inconvenient when creating multiple clippings because the drawing doesn't show correctly.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2024 03:48:21 GMT</pubDate>
    <dc:creator>tvhlong93</dc:creator>
    <dc:date>2024-12-09T03:48:21Z</dc:date>
    <item>
      <title>XCLIP - No Boundary Found</title>
      <link>https://forums.autodesk.com/t5/net-forum/xclip-no-boundary-found/m-p/9577153#M19367</link>
      <description>&lt;P&gt;I'm attempting to XCLIP an External Reference DWG. The code appears to work, except for AutoCAD recognizing it. If I press the Remove Clipping Boundary from the ribbon, AutoCAD indicates "No clip boundary found." I have to create a new clipping boundary to remove the clipping boundary added via code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using code based on this blog post:&lt;/P&gt;
&lt;P&gt;&lt;FONT style="background-color: #ffffff;"&gt;&lt;A href="https://www.keanw.com/2010/11/adding-a-2d-spatial-filter-to-perform-a-simple-xclip-on-an-external-reference-in-autocad-using-net.html" target="_blank"&gt;https://www.keanw.com/2010/11/adding-a-2d-spatial-filter-to-perform-a-simple-xclip-on-an-external-reference-in-autocad-using-net.html&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this a known issue or is there a method that gives the expected results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using AutoCAD Civil 3D 2020.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        public static bool AddXClip(Transaction tr, List&amp;lt;Point2d&amp;gt; points)
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var typVals = new List&amp;lt;TypedValue&amp;gt;
                    {
                        new TypedValue((int)DxfCode.Operator, "&amp;lt;OR"),
                        new TypedValue((int)DxfCode.Start, typeof(BlockReference)),
                        new TypedValue((int)DxfCode.Start, "INSERT"),
                        new TypedValue((int)DxfCode.Operator, "OR&amp;gt;")
                    };

            var xrefObjId = ed.GetEntityByTypes(typVals, "Select external reference to XCLIP: ", "", out Point3d pickPt);

            if (xrefObjId.IsNull)
            {
                return false;
            }

            try
            {
                var pt2DCollection = new Point2dCollection();

                foreach (var pt in points)
                {
                    pt2DCollection.Add(pt);
                }

                var acFilterDictName = "ACAD_FILTER";
                var acSpatialName = "SPATIAL";

                var blkRef = xrefObjId.GetObject(OpenMode.ForWrite) as BlockReference;

                var acSpatialFilterDef = new SpatialFilterDefinition(pt2DCollection, blkRef.Normal, 0.0, 0.0, 0.0, true);
                var acSpatialFilter = new SpatialFilter { Definition = acSpatialFilterDef };

                if (blkRef.ExtensionDictionary.IsNull)
                {
                    blkRef.CreateExtensionDictionary();
                }

                var extensionDict = blkRef.ExtensionDictionary.GetObject(OpenMode.ForWrite) as DBDictionary;

                if (extensionDict.Contains(acFilterDictName))
                {
                    var filterDict = extensionDict.GetAt(acFilterDictName).GetObject(OpenMode.ForWrite) as DBDictionary;

                    if (filterDict.Contains(acSpatialName))
                    {
                        filterDict.Remove(acSpatialName);
                    }

                    filterDict.SetAt(acSpatialName, acSpatialFilter);
                }
                else
                {
                    var filterDict = new DBDictionary();
                    extensionDict.SetAt(acFilterDictName, filterDict);
                    tr.AddNewlyCreatedDBObject(filterDict, true);
                    filterDict.SetAt(acSpatialName, acSpatialFilter);
                }

                tr.AddNewlyCreatedDBObject(acSpatialFilter, true);
                return true;
            }
            catch (System.Exception ex)
            {
                return false;
            }
            
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 18:32:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xclip-no-boundary-found/m-p/9577153#M19367</guid>
      <dc:creator>Civil3DReminders_com</dc:creator>
      <dc:date>2020-06-12T18:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: XCLIP - No Boundary Found</title>
      <link>https://forums.autodesk.com/t5/net-forum/xclip-no-boundary-found/m-p/13200492#M19368</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the same problem when trying to clip a block reference. I've been trying to find the solution and have come across your topic. Have you found the solution yet? If you have one, please share it. I can't find any information about this problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I saved and reopened the drawing, it fixed the problem. But it's inconvenient when creating multiple clippings because the drawing doesn't show correctly.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 03:48:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/xclip-no-boundary-found/m-p/13200492#M19368</guid>
      <dc:creator>tvhlong93</dc:creator>
      <dc:date>2024-12-09T03:48:21Z</dc:date>
    </item>
  </channel>
</rss>

