<?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 can i get the Faces of a SurfaceBody in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010489#M120078</link>
    <description>&lt;P&gt;Yes, i think this schould do the same thing.&lt;/P&gt;&lt;P&gt;In C# the CalculatesFacet Function crashes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the Trianglefaces of the Surfacebody.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 17:51:29 GMT</pubDate>
    <dc:creator>ynapeu</dc:creator>
    <dc:date>2021-01-18T17:51:29Z</dc:date>
    <item>
      <title>How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009466#M120065</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want the faces of a SurfaceBody.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the Function&amp;nbsp;CalculateFacets creates a crash.&lt;/P&gt;&lt;P&gt;I have checked the&amp;nbsp;oBodybox the have Vertices and so on.&lt;/P&gt;&lt;P&gt;Is there some trick to get the Facets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public SurfaceBody tempTest(Inventor.Application oApp)&lt;BR /&gt;{&lt;BR /&gt;TransientGeometry oTransGeom = oApp.TransientGeometry;&lt;BR /&gt;TransientBRep oTransientBRep = oApp.TransientBRep;&lt;/P&gt;&lt;P&gt;Box box1 = oApp.TransientGeometry.CreateBox();&lt;BR /&gt;box1.MinPoint = (oApp.TransientGeometry.CreatePoint(0, 0, 0));&lt;BR /&gt;box1.MaxPoint = (oApp.TransientGeometry.CreatePoint(30, 30, 40));&lt;BR /&gt;SurfaceBody oBodybox = oTransientBRep.CreateSolidBlock(box1);&lt;/P&gt;&lt;P&gt;int count1 = 0;&lt;BR /&gt;int facecount1 = 0;&lt;BR /&gt;double[] Vertex1 = { };&lt;BR /&gt;double[] Normalvect1 = { };&lt;BR /&gt;int[] vertexindeces1 = { };&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;{&lt;BR /&gt;oBodybox.CalculateFacets(0.001, out count1, out facecount1, out Vertex1, out Normalvect1, out vertexindeces1);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception e)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show(e.ToString());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;return (oBodybox);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 11:27:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009466#M120065</guid>
      <dc:creator>ynapeu</dc:creator>
      <dc:date>2021-01-18T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009705#M120068</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/848846"&gt;@ynapeu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you are doing in code is creating an imaginary box using Transient geometry and transient Brep, are you looking for a real face of a surface body and or the transient one?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can explain, exactly what you are trying to achieve, it will be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 13:10:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009705#M120068</guid>
      <dc:creator>dutt.thakar</dc:creator>
      <dc:date>2021-01-18T13:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009828#M120069</link>
      <description>&lt;P&gt;I will create a surfacebody, with diffrent operation, BOX, DoBoolean and so on.&lt;/P&gt;&lt;P&gt;Than i want the faces of this Object.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested, i get the VOlume of the Body but not the Faces.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 13:56:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009828#M120069</guid>
      <dc:creator>ynapeu</dc:creator>
      <dc:date>2021-01-18T13:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009922#M120070</link>
      <description>&lt;P&gt;If all you want is the Faces of the SurfaceBody object, the SurfaceBody object has a Property called Faces that should give you what you want.&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-B640A6A9-2E9D-43BB-8D3D-5151D5CADC04" target="_self"&gt;SurfaceBody.Faces Property&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click 'LIKE' &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 14:35:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009922#M120070</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-01-18T14:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009978#M120071</link>
      <description>&lt;P&gt;Also, I believe &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/848846"&gt;@ynapeu&lt;/a&gt;'s posted code was in C#, and I believe this would be the iLogic equivalent of it:&lt;/P&gt;&lt;P&gt;(minus the Sub Main ... End Sub portion)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	Dim oBody As SurfaceBody = tempTest(ThisApplication)
End Sub

Public Function tempTest(oApp As Inventor.Application) As SurfaceBody
	Dim oTransGeom As TransientGeometry = oApp.TransientGeometry
	Dim oTransientBRep As TransientBRep = oApp.TransientBRep
	Dim box1 As Box = oApp.TransientGeometry.CreateBox()
	box1.MinPoint = (oApp.TransientGeometry.CreatePoint(0, 0, 0))
	box1.MaxPoint = (oApp.TransientGeometry.CreatePoint(30, 30, 40))
	Dim oBodybox As SurfaceBody = oTransientBRep.CreateSolidBlock(box1)
	Dim count1 As Integer = 0
	Dim facecount1 As Integer = 0
	Dim Vertex1() As Double = { }
	Dim Normalvect1() As Double = { }
	Dim vertexindeces1() As Integer = { }
	Try
		oBodybox.CalculateFacets(0.001, count1, facecount1, Vertex1, Normalvect1, vertexindeces1)
	Catch E As Exception
		MessageBox.Show(E.ToString())
	End Try
	Return oBodybox
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 14:50:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10009978#M120071</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-01-18T14:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010489#M120078</link>
      <description>&lt;P&gt;Yes, i think this schould do the same thing.&lt;/P&gt;&lt;P&gt;In C# the CalculatesFacet Function crashes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the Trianglefaces of the Surfacebody.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 17:51:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010489#M120078</guid>
      <dc:creator>ynapeu</dc:creator>
      <dc:date>2021-01-18T17:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010694#M120082</link>
      <description>&lt;P&gt;I attempted this using regular iLogic and the natural process of extruding a new solid body, then attempting to get its 'facets' using that same function, but have had no success with this route yet either.&amp;nbsp; Just in case others want to continue the research, I will post what I've got so far.&amp;nbsp; I've honestly never attempted to retrieve or use 'facet' data before, so maybe I'm missing something that someone else will notice and pick-up on.&lt;/P&gt;&lt;P&gt;Here's what I have so far (iLogic):&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kPartDocumentObject Then
		MsgBox("A Part Document must be active for this rule to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
		Exit Sub
	End If
	Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oSketch As PlanarSketch = oPDef.Sketches.Add(oPDef.WorkPlanes.Item(2)) 'XZ Plane
	Dim oCorner1 As Point2d = oTG.CreatePoint2d(0, 0)
	Dim oCorner2 As Point2d = oTG.CreatePoint2d(30,30)
	oSketch.SketchLines.AddAsTwoPointRectangle(oCorner1, oCorner2)
	Dim oProfile As Inventor.Profile = oSketch.Profiles.AddForSolid
	Dim oExtDef As ExtrudeDefinition = oPDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, PartFeatureOperationEnum.kNewBodyOperation)
	oExtDef.SetDistanceExtent(40, PartFeatureExtentDirectionEnum.kPositiveExtentDirection)
	Dim oExt As ExtrudeFeature = oPDef.Features.ExtrudeFeatures.Add(oExtDef)
	Dim oBody As SurfaceBody = oExt.SurfaceBodies.Item(1)
	
	Dim oVCount As Integer
	Dim oFacetCount As Integer
	Dim oVCoords() As Double
	Dim oNormVectors() As Double
	Dim oVIndices() As Integer
	Try
		oBody.CalculateFacets(0.01, oVCount, oFacetCount, oVCoords, oNormVectors, oVIndices)
	Catch oEx As Exception
		MsgBox("Error Message:" &amp;amp; vbCrLf &amp;amp; _
		oEx.Message &amp;amp; vbCrLf &amp;amp;  vbCrLf &amp;amp; _
		"StackTrace:" &amp;amp; vbCrLf &amp;amp; _
		oEx.StackTrace &amp;amp; vbCrLf &amp;amp; vbCrLf &amp;amp; _
		"Source:" &amp;amp; vbCrLf &amp;amp; _
		oEx.Source, vbOKOnly + vbExclamation, "Title")
		'delete the Extrusion feature, its source sketch, and all its dependants
		oExt.Delete(False, False, False)
	End Try
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 19:27:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010694#M120082</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-01-18T19:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How can i get the Faces of a SurfaceBody</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010762#M120086</link>
      <description>&lt;P&gt;&lt;U&gt;Many Thanks.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Your Works fine.&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Restquestiuon, why crashes the original cose?&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 19:57:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-can-i-get-the-faces-of-a-surfacebody/m-p/10010762#M120086</guid>
      <dc:creator>ynapeu</dc:creator>
      <dc:date>2021-01-18T19:57:03Z</dc:date>
    </item>
  </channel>
</rss>

