<?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: How to replace torus as cylinder in Autocad via .net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6982666#M32114</link>
    <description>&lt;P&gt;Great Thank you !&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2017 20:25:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-29T20:25:55Z</dc:date>
    <item>
      <title>How to replace torus as cylinder in Autocad via .net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6981177#M32112</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have autocad file with 600 torus solid3d inside and the question is how to replace this torus as cylinders with this same property?&lt;/P&gt;&lt;P&gt;Maybe more specific how to take info from solid3d SolidType = "torus" like TorusRadius ?&lt;/P&gt;&lt;P&gt;It is possible ?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 13:01:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6981177#M32112</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T13:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace torus as cylinder in Autocad via .net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6981496#M32113</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example using the Boudary Representation API (acmgdbrep.dll have to be referenced):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("TEST")]
        public void Test()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var opts = new PromptEntityOptions("\nSelect a torus: ");
            opts.SetRejectMessage("\nSelected object is not a Solid 3D.");
            opts.AddAllowedClass(typeof(Solid3d), true);
            var res = ed.GetEntity(opts);
            if (res.Status != PromptStatus.OK)
                return;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var solid = (Solid3d)tr.GetObject(res.ObjectId, OpenMode.ForRead);
                using (var brep = new Autodesk.AutoCAD.BoundaryRepresentation.Brep(solid))
                {
                    if (brep.Faces.Count() != 1)
                    {
                        ed.WriteMessage("\nSelected object is not a torus.");
                        return;
                    }
                    var surf = (ExternalBoundedSurface)brep.Faces.First().Surface;
                    var torus = surf.BaseSurface as Torus;
                    if (torus == null)
                    {
                        ed.WriteMessage("\nSelected object is not a torus.");
                        return;
                    }
                    ed.WriteMessage("\nTorus" +
                        $"\n\tCenter: {torus.Center}" +
                        $"\n\tAxis: {torus.AxisOfSymmetry}" +
                        $"\n\tMajor radius: {torus.MajorRadius}" +
                        $"\n\tMinor radius: {torus.MinorRadius}");
                }
                    tr.Commit();
          &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 14:42:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6981496#M32113</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-29T14:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace torus as cylinder in Autocad via .net</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6982666#M32114</link>
      <description>&lt;P&gt;Great Thank you !&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 20:25:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-replace-torus-as-cylinder-in-autocad-via-net/m-p/6982666#M32114</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T20:25:55Z</dc:date>
    </item>
  </channel>
</rss>

