<?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: Modifying a Cylinder using Inventor API C# in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12013600#M22892</link>
    <description>&lt;P&gt;Hi. Can you provide a simple code example for this? I am new to this and I am unable to get ThickenFeature to work with the code.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jun 2023 05:48:25 GMT</pubDate>
    <dc:creator>lokit.khemka</dc:creator>
    <dc:date>2023-06-06T05:48:25Z</dc:date>
    <item>
      <title>Modifying a Cylinder using Inventor API C#</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12010920#M22890</link>
      <description>&lt;P&gt;I have the following code for obtaining the cylindrical faces in the open geometry. I want to modify the radius of the cylinder. How should I proceed with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; public static void HoleList(Inventor.Application mApplication)
    {
            PartDocument doc = (PartDocument)mApplication.ActiveDocument;
            PartComponentDefinition PartCompDef = doc.ComponentDefinition;

            SurfaceBody body = PartCompDef.SurfaceBodies[1];

            int holeCount = 0;
            int count = body.Faces.Count;

            foreach (Face face in body.Faces)
            {
                if (face.SurfaceType == SurfaceTypeEnum.kCylinderSurface)
                {
                    holeCount++;

                    Cylinder cylinder = (Cylinder)face.Geometry;
                    double ddepth = 0.0;
                    if (cylinder.AxisVector.Z == 1 || cylinder.AxisVector.Z == -1)
                    {
                        ddepth = System.Math.Abs(System.Math.Abs(face.Vertices[1].Point.Z) - System.Math.Abs(face.Vertices[2].Point.Z)) * 10;
                    }
                    else if (cylinder.AxisVector.Y == 1)
                    {
                        ddepth = System.Math.Abs(System.Math.Abs(face.Vertices[1].Point.Y) - System.Math.Abs(face.Vertices[2].Point.Y)) * 10;
                    }
                    else if (cylinder.AxisVector.X == 1)
                    {
                        ddepth = System.Math.Abs(System.Math.Abs(face.Vertices[1].Point.X) - System.Math.Abs(face.Vertices[2].Point.X)) * 10;
                    }

                    double diameter = 2 * cylinder.Radius;
                    Console.WriteLine("Diameter: " + cylinder.Radius * 2 * 10 + " mm" + "\t" + "Depth: " + ddepth + " mm");

                    foreach(Edge edge in face.Edges)
                    {
                        Console.WriteLine(edge.StartVertex.Point.X + " " + edge.StartVertex.Point.Y + " " + edge.StartVertex.Point.Z);
                        Console.WriteLine(edge.StopVertex.Point.X + " " + edge.StopVertex.Point.Y + " " + edge.StopVertex.Point.Z);
                    }
                }
            }
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;Any help will be greatly appreciated. Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 04:42:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12010920#M22890</guid>
      <dc:creator>lokit.khemka</dc:creator>
      <dc:date>2023-06-05T04:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying a Cylinder using Inventor API C#</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12011047#M22891</link>
      <description>&lt;P&gt;You can't modify surface body directly in this way, but you can use&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-4B2B9279-D6BA-42CD-A808-049F4096353C" target="_blank" rel="noopener"&gt;ThickenFeature&lt;/A&gt; for this.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 06:19:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12011047#M22891</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-06-05T06:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying a Cylinder using Inventor API C#</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12013600#M22892</link>
      <description>&lt;P&gt;Hi. Can you provide a simple code example for this? I am new to this and I am unable to get ThickenFeature to work with the code.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 05:48:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12013600#M22892</guid>
      <dc:creator>lokit.khemka</dc:creator>
      <dc:date>2023-06-06T05:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying a Cylinder using Inventor API C#</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12013657#M22893</link>
      <description>&lt;P&gt;This is simple iLogic sample how to create ThicknessFeature from all cylindrical faces&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Sub Main()
    Dim part As PartDocument = ThisDoc.Document
    Dim partDef As PartComponentDefinition = part.ComponentDefinition

    'Iterate all faces in first surface body
    For Each face As Face In partDef.SurfaceBodies(1).Faces

        'Check if face is cylindrical face
        Dim cylinder As Cylinder = TryCast(face.Geometry, Cylinder)
        If cylinder Is Nothing Then Continue For
        
        'Get radius for future use. Not used yet
        Dim radius As Double = cylinder.Radius

        'Build face collection for each face
        Dim faceCollection As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection()
        faceCollection.Add(face)

        'Set offset/thickness distance. It can depend on current radius
        Dim distance As Double = 0.1 ' 1 mm

        'Create thickness feature
        Dim thicknessFeature = partDef.Features.ThickenFeatures.Add(
            faceCollection, 
            distance,
            PartFeatureExtentDirectionEnum.kPositiveExtentDirection, 
            PartFeatureOperationEnum.kJoinOperation, 
            False)
    Next
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2023 06:29:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/modifying-a-cylinder-using-inventor-api-c/m-p/12013657#M22893</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-06-06T06:29:19Z</dc:date>
    </item>
  </channel>
</rss>

