<?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: Is there any way to create a surface or region by point3d array? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664551#M33946</link>
    <description>&lt;P&gt;I know the points must belong to the same plane to create Region, but is there anyway to create a object like region or surface by these points? thanks a lot!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2016 11:12:48 GMT</pubDate>
    <dc:creator>zhongbo.wu</dc:creator>
    <dc:date>2016-11-03T11:12:48Z</dc:date>
    <item>
      <title>Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662495#M33942</link>
      <description>&lt;P&gt;I have a&amp;nbsp;point3d array, and i should create a surface or region by them, but i faild:&lt;/P&gt;&lt;P&gt;-2717.21,-2745.87,-72135&lt;BR /&gt;-2717.21,-2745.87,-71835&lt;BR /&gt;-2662.88,-2661.92,-71835&lt;BR /&gt;-2662.88,-2661.92,-71847&lt;BR /&gt;-2711.78,-2737.47,-71854.2&lt;BR /&gt;-2711.78,-2737.47,-72115.8&lt;BR /&gt;-2662.88,-2661.92,-72123&lt;BR /&gt;-2662.88,-2661.92,-72135&lt;BR /&gt;-2717.21,-2745.87,-72135&lt;/P&gt;&lt;P&gt;First, i create eight&amp;nbsp;lines by these point3d, the use&amp;nbsp;Region.CreateFromCurves() to create region but faild, then i try to create the region in AutoCAD, but it's faild too and show me: Open objects must be coplanar.&lt;/P&gt;&lt;P&gt;Is there anybody can give me some help? thanks a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 15:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662495#M33942</guid>
      <dc:creator>zhongbo.wu</dc:creator>
      <dc:date>2016-11-02T15:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662592#M33943</link>
      <description>&lt;P&gt;You can create a region from any closed loop. &amp;nbsp;See this article.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUID-9CD22AE5-8F66-4925-A155-95852BAFD565-htm.html" target="_self"&gt;https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUID-9CD22AE5-8F66-4925-A155-95852BAFD565-htm.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your point array defines a closed loop, you can create a closed polyline from it and then create the region.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 15:09:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662592#M33943</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2016-11-02T15:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662609#M33944</link>
      <description>&lt;P&gt;I have try to draw a 3dpoly by these point3d in AutoCAD, then create region by this 3dpoly, but faild too with a message:1 closed, degenerate or unsupported object rejected.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 15:15:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6662609#M33944</guid>
      <dc:creator>zhongbo.wu</dc:creator>
      <dc:date>2016-11-02T15:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6663085#M33945</link>
      <description>&lt;P&gt;If points do not belong to the same plane it is impossible to create Region from those points.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:41:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6663085#M33945</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-02T17:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664551#M33946</link>
      <description>&lt;P&gt;I know the points must belong to the same plane to create Region, but is there anyway to create a object like region or surface by these points? thanks a lot!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:12:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664551#M33946</guid>
      <dc:creator>zhongbo.wu</dc:creator>
      <dc:date>2016-11-03T11:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664582#M33947</link>
      <description>&lt;P&gt;It is impossible create Region with this set of points.&lt;/P&gt;
&lt;P&gt;I do not understand what can be done from this set of points in general. This set of points looks like a set of vertical bars.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:28:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664582#M33947</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-03T11:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664650#M33948</link>
      <description>&lt;P&gt;These data are come from another 3D software, in this software these points can create a polyhedron as shown below. So i'm try to create it in AutoCAD with these points:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="polyhedron.png" style="width: 294px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/288878i61B4DC1039EBA384/image-size/large?v=v2&amp;amp;px=999" role="button" title="polyhedron.png" alt="polyhedron.png" /&gt;&lt;/span&gt;﻿&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2016 11:54:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6664650#M33948</guid>
      <dc:creator>zhongbo.wu</dc:creator>
      <dc:date>2016-11-03T11:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6666573#M33949</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2803729"&gt;@zhongbo.wu﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok. As far as all points in your set is on one plane - it is possible to create Region.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;

#pragma warning disable 0618

[assembly: CommandClass(typeof(CreateRegion.MyCommands))]

namespace CreateRegion
{
  public class MyCommands
  {
    [CommandMethod("CreateRegsFromPoints")]
    public void MyCommand() // This method can have any name
    {
      // Put your command code here
      Document doc = Application.DocumentManager.MdiActiveDocument;
      if (doc == null) return;
      Editor ed = doc.Editor;
      Point3dCollection pts = GetPoints();

      Plane plane = new Plane(pts[0], pts[1], pts[2]);

      for (int i = 0; i &amp;lt; pts.Count; i++)
      {
        pts[i] = pts[i].OrthoProject(plane);
      }

      ObjectId plineId = ObjectId.Null;
      using (Polyline pline = new Polyline())
      {
        pline.Normal = plane.Normal;
        Matrix3d mat = Matrix3d.PlaneToWorld(plane).Inverse();

        for (int i = 0; i &amp;lt; pts.Count; i++)
        {
          Point3d p = pts[i].TransformBy(mat);
          pline.AddVertexAt(i, new Point2d(p.X, p.Y), 0, 0, 0);
        }

        mat = Matrix3d.Displacement(pts[0] - pline.GetPoint3dAt(0));
        pline.TransformBy(mat);

        using (BlockTableRecord btr =
          doc.Database.CurrentSpaceId.Open(OpenMode.ForWrite) as BlockTableRecord)
        {
          // plineId = btr.AppendEntity(pline);
          DBObjectCollection objs = new DBObjectCollection();
          objs.Add(pline);
          DBObjectCollection regs = Region.CreateFromCurves(objs);

          if (regs != null)
          {
            for (int i = 0; i &amp;lt; regs.Count; i++)
            {
              using (regs[i])
              {
                Entity ent = regs[i] as Entity;
                if (ent != null)
                  btr.AppendEntity(ent);
              }
            }
          }
        }
      }
    }

    Point3dCollection GetPoints()
    {
      Point3dCollection pts = new Point3dCollection();
      pts.Add(new Point3d(-2717.21, -2745.87, -72135));
      pts.Add(new Point3d(-2717.21, -2745.87, -71835));
      pts.Add(new Point3d(-2662.88, -2661.92, -71835));
      pts.Add(new Point3d(-2662.88, -2661.92, -71847));
      pts.Add(new Point3d(-2711.78, -2737.47, -71854.2));
      pts.Add(new Point3d(-2711.78, -2737.47, -72115.8));
      pts.Add(new Point3d(-2662.88, -2661.92, -72123));
      pts.Add(new Point3d(-2662.88, -2661.92, -72135));
      pts.Add(new Point3d(-2717.21, -2745.87, -72135));
      return pts;
    }
  }
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="iframe-container"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/58b3d7d5-f45e-4ffc-9ace-aeeab5f58311" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;" height="680" frameborder="0" width="640"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 04 Nov 2016 00:20:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6666573#M33949</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2016-11-04T00:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to create a surface or region by point3d array?</title>
      <link>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6670202#M33950</link>
      <description>&lt;P&gt;Hi, Alex, thanks for your help, i get it!&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2016 14:27:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/is-there-any-way-to-create-a-surface-or-region-by-point3d-array/m-p/6670202#M33950</guid>
      <dc:creator>zhongbo.wu</dc:creator>
      <dc:date>2016-11-06T14:27:32Z</dc:date>
    </item>
  </channel>
</rss>

