<?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: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308063#M5191</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7472042"&gt;@soonhui&lt;/a&gt;&amp;nbsp;I modified your sample codes and it should run successfully.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("FromMeshTestFixed")]
        public void FromMeshTestFixed()
        {
            try
            {
                ObjectId polyMeshId;
                using (var ts = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    
                    

                    var bt = (BlockTable)ts.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead, false);
                    var btr = (BlockTableRecord)ts.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                    var polyMesh = new PolyFaceMesh();
                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    ts.AddNewlyCreatedDBObject(polyMesh, true);
                    polyMeshId = polyMesh.Id;
                    var vertex1 = new PolyFaceMeshVertex(new Point3d(0, 0, 0));
                    polyMesh.AppendVertex(vertex1);
                    ts.AddNewlyCreatedDBObject(vertex1, true);
                    var vertex2 = new PolyFaceMeshVertex(new Point3d(10, 0, 0));
                    polyMesh.AppendVertex(vertex2);
                    ts.AddNewlyCreatedDBObject(vertex2, true);
                    var vertex3 = new PolyFaceMeshVertex(new Point3d(10, 10, 0));
                    polyMesh.AppendVertex(vertex3);
                    ts.AddNewlyCreatedDBObject(vertex3, true);

                    var faceRecord = new FaceRecord(1, 2, 3, 0);  //this is one based right? Furthermore, this is a triangle, so the last argument is 0. I hope my intepretation is correct!
                    polyMesh.AppendFaceRecord(faceRecord);
                    ts.AddNewlyCreatedDBObject(faceRecord, true);
                    
                    ts.Commit();
                }

                using (var ts2 = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
                    var platformSurface = ts2.GetObject(surfaceId2, OpenMode.ForWrite) as TINSurface;
                    platformSurface.DrawingObjectsDefinition.AddFromPolyFaces(new ObjectIdCollection(new[] { polyMeshId }),
                       true, $"Normal Platform");
                    platformSurface.Rebuild();
                    ts2.Commit();
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message);
            }

        }
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My primary change is to move the creation of PolyMeshFace object and surface operations into two different transactions.&amp;nbsp; We often meet problems when using a new created object before bounded transaction is committed.&lt;BR /&gt;I strongly suggest you could try this way to solve similar issues.&lt;BR /&gt;The other minor change is&lt;BR /&gt;Add&amp;nbsp;&lt;STRONG&gt;ts.AddNewlyCreatedDBObject(polyMesh, true);&amp;nbsp;&lt;/STRONG&gt;so that the mesh object could be added successfully.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    ts.AddNewlyCreatedDBObject(polyMesh, true);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jul 2022 07:47:17 GMT</pubDate>
    <dc:creator>Tristone</dc:creator>
    <dc:date>2022-07-20T07:47:17Z</dc:date>
    <item>
      <title>System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11298947#M5186</link>
      <description>&lt;P&gt;I'm trying to add a mesh ( well, in this case, it's just a triangle) to Surface, via the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    
 private Editor ACADEditor =&amp;gt; ActiveACADDocument.Editor;

        private static Document ActiveACADDocument =&amp;gt; ACADDocumentManager.MdiActiveDocument;

        private static DocumentCollection ACADDocumentManager =&amp;gt; Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager;

        private CivilDocument ActiveCivil3DDocument=&amp;gt; CivilApplication.ActiveDocument;
 
       [CommandMethod("FromMeshTest")]
        public void FromMesh()
        {
            try
            {
                using (var ts = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
                    var platformSurface = ts.GetObject(surfaceId2, OpenMode.ForWrite) as TINSurface;

                    var bt = (BlockTable)ts.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead, false);
                    var btr = (BlockTableRecord)ts.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                    var polyMesh = new PolyFaceMesh();
                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    var vertex1 = new PolyFaceMeshVertex(new Point3d(0, 0, 0));
                    polyMesh.AppendVertex(vertex1);
                    ts.AddNewlyCreatedDBObject(vertex1, true);
                    var vertex2 = new PolyFaceMeshVertex(new Point3d(10, 0, 0));
                    polyMesh.AppendVertex(vertex2);
                    ts.AddNewlyCreatedDBObject(vertex2, true);
                    var vertex3 = new PolyFaceMeshVertex(new Point3d(10, 10, 0));
                    polyMesh.AppendVertex(vertex3);
                    ts.AddNewlyCreatedDBObject(vertex3, true);

                    var faceRecord = new FaceRecord(1, 2, 3, 0);  //this is one based right? Furthermore, this is a triangle, so the last argument is 0. I hope my intepretation is correct!
                    polyMesh.AppendFaceRecord(faceRecord);
                    ts.AddNewlyCreatedDBObject(faceRecord, true);
                    platformSurface.DrawingObjectsDefinition.AddFromPolyFaces(new ObjectIdCollection(new[] { polyMesh.Id }),
                        true, $"Normal Platform");
                    platformSurface.Rebuild();
                    ts.Commit();
                    ACADEditor.ZoomExtents();
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.ToString());
            }
      
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, running the above code will throw me an exception at:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;  Autodesk.Civil.DatabaseServices.SurfaceDefinitionDrawingObjects.AddFromPolyFaces(Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection, bool, string)
 
	
System.ArgumentException: 'Value does not fall within the expected range.'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is strange because I thought that I am passing in the correct arguments; as my ObjectIdCollection is a list of&amp;nbsp;&lt;SPAN&gt;PolyFaceMesh, the kind of object types that&lt;A href="https://help.autodesk.com/view/CIV3D/2023/ENU/?guid=8ef46b24-88e1-643d-aada-0da94aff22a6" target="_blank" rel="noopener"&gt; the guide&lt;/A&gt; approves!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Anything that I miss?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 02:48:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11298947#M5186</guid>
      <dc:creator>soonhui</dc:creator>
      <dc:date>2022-07-18T02:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11300143#M5187</link>
      <description>&lt;P&gt;I don't know what that method is failing, I was unable to get it to work as well. However, going with 3Dfaces instead of a PolyMesh this does work.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("FromMeshTest2")]
        public void FromMesh2()
        {
            try
            {
                var faces = new ObjectIdCollection();
                using (var ts = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
                    var platformSurface = ts.GetObject(surfaceId2, OpenMode.ForWrite) as TinSurface;

                    var bt = (BlockTable)ts.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead, false);
                    var btr = (BlockTableRecord)ts.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                    var vertex1 = new Point3d(0, 0, 0);
                    var vertex2 = new Point3d(10, 0, 0);
                    var vertex3 = new Point3d(10, 10, 0);
                    var polyMesh = new Face(vertex1,vertex2,vertex3,true,true,true,true);
                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    ts.AddNewlyCreatedDBObject(polyMesh, true);
                    faces.Add(polyMesh.ObjectId);
                    platformSurface.DrawingObjectsDefinition.AddFrom3DFaces(faces, true, $"Normal Platform");
                    platformSurface.Rebuild();

                    //ACADEditor.ZoomExtents();
                    ts.Commit();
                }

            }
            catch (System.Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString());
            }

        }
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Jul 2022 18:30:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11300143#M5187</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2022-07-15T18:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11302964#M5188</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt;&amp;nbsp;, I &lt;STRONG&gt;&lt;EM&gt;do&lt;/EM&gt;&lt;/STRONG&gt; think that the exception is a bug. Would you want to file a case on this on the internal Autodesk bug tracker? If not I would want to find a way to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Secondly, I can also get&amp;nbsp;AddFrom3DFaces to work. But my concern now is that since I already know that my data is in the form of&amp;nbsp;PolyFaceMeshVertex, using Face ( and hence the AddFrom3DFaces ) to store/process it is quite a wastage because it would store/process a lot of duplicated Edges and Points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is my understanding correct?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 02:38:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11302964#M5188</guid>
      <dc:creator>soonhui</dc:creator>
      <dc:date>2022-07-18T02:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11304678#M5189</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/523981"&gt;@TimYarris&lt;/a&gt;&amp;nbsp;is there anyone still working on updating the Civil 3D .NET API? If so, could you ask them to provide a working example of how this method works? If they end up with the same issue as posted here, perhaps they could get it corrected?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for looking ta this Tim.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 18:02:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11304678#M5189</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2022-07-18T18:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11305289#M5190</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/523981"&gt;@TimYarris&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me describe my use case to illuminate the importance of this post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have mesh(es) as my surface(s). Mesh as in the sense of a list of points and triangles, and the triangles can be disjointed ( ie: visually you can see two separated "meshes"&amp;nbsp; in this one big Mesh data structure), or it can contain holes ( you can imagine it as a mesh where some internal triangles and edges and points are being deleted).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So as you can see, AddFromPolyFaces is the most suitable method, as it directly maps to my data structure (&lt;A href="https://adndevblog.typepad.com/autocad/2012/07/get-facet-information-from-polyfacemesh.html" target="_blank" rel="noopener"&gt;PolyFaceMesh is used&lt;/A&gt; exactly like how I would use my Mesh). With the condition that the method works as we think it should ( ie: &lt;A href="https://forums.autodesk.com/t5/civil-3d-customization/add-from-3dfaces/m-p/11298762" target="_blank" rel="noopener"&gt;edges and triangles and points are &lt;EM&gt;really&lt;/EM&gt; maintained&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do hope that this issue is resolved, because I've explored some alternatives like using &lt;A href="https://forums.autodesk.com/t5/civil-3d-customization/addfrom3dfaces-creates-additional-area/m-p/11305280/highlight/true#M21889" target="_blank" rel="noopener"&gt;AddFrom3DFaces and I do think that it's not suitable&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 02:19:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11305289#M5190</guid>
      <dc:creator>soonhui</dc:creator>
      <dc:date>2022-07-19T02:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308063#M5191</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7472042"&gt;@soonhui&lt;/a&gt;&amp;nbsp;I modified your sample codes and it should run successfully.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("FromMeshTestFixed")]
        public void FromMeshTestFixed()
        {
            try
            {
                ObjectId polyMeshId;
                using (var ts = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    
                    

                    var bt = (BlockTable)ts.GetObject(ActiveACADDocument.Database.BlockTableId, OpenMode.ForRead, false);
                    var btr = (BlockTableRecord)ts.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false);
                    var polyMesh = new PolyFaceMesh();
                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    ts.AddNewlyCreatedDBObject(polyMesh, true);
                    polyMeshId = polyMesh.Id;
                    var vertex1 = new PolyFaceMeshVertex(new Point3d(0, 0, 0));
                    polyMesh.AppendVertex(vertex1);
                    ts.AddNewlyCreatedDBObject(vertex1, true);
                    var vertex2 = new PolyFaceMeshVertex(new Point3d(10, 0, 0));
                    polyMesh.AppendVertex(vertex2);
                    ts.AddNewlyCreatedDBObject(vertex2, true);
                    var vertex3 = new PolyFaceMeshVertex(new Point3d(10, 10, 0));
                    polyMesh.AppendVertex(vertex3);
                    ts.AddNewlyCreatedDBObject(vertex3, true);

                    var faceRecord = new FaceRecord(1, 2, 3, 0);  //this is one based right? Furthermore, this is a triangle, so the last argument is 0. I hope my intepretation is correct!
                    polyMesh.AppendFaceRecord(faceRecord);
                    ts.AddNewlyCreatedDBObject(faceRecord, true);
                    
                    ts.Commit();
                }

                using (var ts2 = ActiveACADDocument.TransactionManager.StartOpenCloseTransaction())
                {
                    var surfaceId2 = TinSurface.Create(ActiveACADDocument.Database, "FromMeshTest");
                    var platformSurface = ts2.GetObject(surfaceId2, OpenMode.ForWrite) as TINSurface;
                    platformSurface.DrawingObjectsDefinition.AddFromPolyFaces(new ObjectIdCollection(new[] { polyMeshId }),
                       true, $"Normal Platform");
                    platformSurface.Rebuild();
                    ts2.Commit();
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message);
            }

        }
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My primary change is to move the creation of PolyMeshFace object and surface operations into two different transactions.&amp;nbsp; We often meet problems when using a new created object before bounded transaction is committed.&lt;BR /&gt;I strongly suggest you could try this way to solve similar issues.&lt;BR /&gt;The other minor change is&lt;BR /&gt;Add&amp;nbsp;&lt;STRONG&gt;ts.AddNewlyCreatedDBObject(polyMesh, true);&amp;nbsp;&lt;/STRONG&gt;so that the mesh object could be added successfully.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;                    polyMesh.SetDatabaseDefaults();
                    btr.AppendEntity(polyMesh);
                    ts.AddNewlyCreatedDBObject(polyMesh, true);&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 07:47:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308063#M5191</guid>
      <dc:creator>Tristone</dc:creator>
      <dc:date>2022-07-20T07:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308077#M5192</link>
      <description>&lt;P&gt;BTW, it's better to use e.Message instead of e.ToString() to get detail description from Exception.&amp;nbsp;&lt;BR /&gt;"&lt;SPAN&gt;'Value does not fall within the expected range.'&lt;/SPAN&gt;" is the general description for ArgumentException from Microsoft.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 07:56:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308077#M5192</guid>
      <dc:creator>Tristone</dc:creator>
      <dc:date>2022-07-20T07:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308308#M5193</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/707204"&gt;@Tristone&lt;/a&gt;&amp;nbsp;, thanks, your solution works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BUT,&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;SPAN&gt;&amp;nbsp;We often meet problems when using a new created object before bounded transaction is committed.&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is this a bug?&amp;nbsp; Because "often" here means that sometimes it's OK, but sometimes it's problematic. Shouldn't everything be made consistent: either you definitely can use a newly created object before the transaction is committed, or you definitely can't?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 09:37:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11308308#M5193</guid>
      <dc:creator>soonhui</dc:creator>
      <dc:date>2022-07-20T09:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11309038#M5194</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/707204"&gt;@Tristone&lt;/a&gt;&amp;nbsp;Thanks for this. What I find odd is that I tested nearly identical code and it was still failing. I didn't save that version of the tests so not sure what you did different. Glad to see it does work.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 14:49:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11309038#M5194</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2022-07-20T14:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11310452#M5195</link>
      <description>&lt;P&gt;That's a good question,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7472042"&gt;@soonhui&lt;/a&gt;.&lt;BR /&gt;It led me to have a deeper investigation, and I found the root cause is you were using the StartOpenCloseTransation(). If you change it to StartTransaction(), you'll find you don't have to use two transactions at all.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;using (var ts = ActiveACADDocument.TransactionManager.StartTransaction())&lt;/LI-CODE&gt;
&lt;P&gt;StartOpenCloseTransation will not start a real transaction, please refer to &lt;A href="https://forums.autodesk.com/t5/net/difference-between-startopenclosetransaction-vs-starttransaction/td-p/7290717" target="_blank" rel="noopener"&gt;Difference between: StartOpenCloseTransaction vs StartTransaction. &lt;/A&gt;&lt;BR /&gt;The direct error we are facing is to open a db object(PolyMeshFace here) before it was created and closed. A real transaction can handle it well, and we suggest AutoCAD API user use TransactionManager.StartTransaction rather than TransactionManager.StartCloseTransaction in most cases.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2022 03:36:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11310452#M5195</guid>
      <dc:creator>Tristone</dc:creator>
      <dc:date>2022-07-21T03:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: System.ArgumentException: 'Value does not fall within the expected range.' when AddFromPolyFaces</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11310454#M5196</link>
      <description>You're welcome. Maybe in your first try, you haven't added the below code line?    &lt;BR /&gt; ts.AddNewlyCreatedDBObject(polyMesh, true);</description>
      <pubDate>Thu, 21 Jul 2022 03:37:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/system-argumentexception-value-does-not-fall-within-the-expected/m-p/11310454#M5196</guid>
      <dc:creator>Tristone</dc:creator>
      <dc:date>2022-07-21T03:37:46Z</dc:date>
    </item>
  </channel>
</rss>

