<?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: FaceShell OrientedRangeBox in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10499635#M47915</link>
    <description>&lt;P&gt;I have abandoned the delete faces workflow, in favor of a build SurfaceBodyDefinition from FaceShell Properties workflow.&amp;nbsp; It works where the previous workflow was failing [bodies affected by Combine(Cut).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm now using "ThisApplication.TransientBRep.CreateSurfaceBodyDefinition" method to build a definition based on the FaceShell's face &amp;amp; EdgleLoop Properties.&amp;nbsp; This is superior to the delete face workflow.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 14:50:54 GMT</pubDate>
    <dc:creator>J-Camper</dc:creator>
    <dc:date>2021-07-27T14:50:54Z</dc:date>
    <item>
      <title>FaceShell OrientedRangeBox</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10472442#M47913</link>
      <description>&lt;P&gt;I'm trying to upgrade the sub routine below to used the OrientedMinimumRangeBox Method on Each FaceShell of a Multi-FaceShell SurfaceBody:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Function BuildDescription(pDef As PartComponentDefinition, bIndex As Integer) As String
	Dim Result As String = Nothing
	Dim BoxCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	Dim oSolid As SurfaceBody = pDef.SurfaceBodies.Item(bIndex)
	If oSolid.FaceShells.Count &amp;gt; 1
		Logger.Trace("Multi body: " &amp;amp; oSolid.FaceShells.Count &amp;amp; " only works with normal rangebox")
		For Each fs As FaceShell In oSolid.FaceShells
			If fs.IsVoid Then Continue For
			Dim DeltaX, DeltaY, DeltaZ As Double
			Dim fsBox As Box = fs.RangeBox
			DeltaX = fsBox.MaxPoint.X - fsBox.MinPoint.X
			DeltaY = fsBox.MaxPoint.Y - fsBox.MinPoint.Y
			DeltaZ = fsBox.MaxPoint.Z - fsBox.MinPoint.Z
'			Dim AddRoughString As String = FormulateString(DeltaX, DeltaY, DeltaZ)
'			Result += AddRoughString
		Next

	Else If oSolid.FaceShells.Count = 1
		Logger.Trace("Single")
		BoxCollection.Add(oSolid.OrientedMinimumRangeBox)
	End If
	Logger.Trace("Collected: " &amp;amp; BoxCollection.Count)
'	For Each ItemRangeBox As OrientedBox In BoxCollection
'		Dim AddString As String = FormulateString(ItemRangeBox.DirectionOne.Length, ItemRangeBox.DirectionTwo.Length, ItemRangeBox.DirectionThree.Length)
'		Result += AddString
'	Next
	Return Result
End Function&lt;/LI-CODE&gt;&lt;P&gt;Don't worry about the commented out lines, they work and don't need to be tested.&amp;nbsp; I just want all the FaceShells to put an OrientedMinimumRangeBox Into the BoxCollection to be processed at the bottom.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current workflow up to this point:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;user selects ComponentOccurrence From Main Assembly&lt;/LI&gt;&lt;LI&gt;user selects a SurfaceBody from List&lt;/LI&gt;&lt;LI&gt;The above Function is called with ComponentDefinition and Index of SurfaceBody&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have tried several processes that all failed, so I'm reaching out for help.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 21:46:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10472442#M47913</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-07-15T21:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: FaceShell OrientedRangeBox</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10472676#M47914</link>
      <description>&lt;P&gt;Okay, I got it working except It has issues with bodies AffectedBy Combine(Cut) Features?&amp;nbsp; I'm not sure why, but maybe there is another way that won't fail?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the current state:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Function BuildDescription(pDef As PartComponentDefinition, oSolid As SurfaceBody) As String
	Dim Result As String = Nothing
	Dim BoxCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
	If oSolid.FaceShells.Count &amp;gt; 1
		Logger.Trace("Multi body: " &amp;amp; oSolid.FaceShells.Count)
		Dim TransBody As SurfaceBody = ThisApplication.TransientBRep.Copy(oSolid)
		For Each fs As FaceShell In  TransBody.FaceShells
			Dim keepFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection()
			'Collect Faces To Keep
			For Each f As Face In fs.Faces
				keepFaces.Add(f)
			Next
			


'Delete All Faces Except those you want to keep [False Boolean]
			ThisApplication.TransientBRep.DeleteFaces(keepFaces, False) 'Has Issues with Combine(Cut) Features for some reason???
			


'Get OrientedRangeBox
			BoxCollection.Add(TransBody.OrientedMinimumRangeBox)
			'Reset Transient Body
			TransBody = ThisApplication.TransientBRep.Copy(oSolid)
		Next

	Else If oSolid.FaceShells.Count = 1
		'Logger.Trace("Single")
		BoxCollection.Add(oSolid.OrientedMinimumRangeBox)
	End If
	Logger.Trace("Collected: " &amp;amp; BoxCollection.Count)
	For Each ItemRangeBox As OrientedBox In BoxCollection
		Dim AddString As String = FormulateString(ItemRangeBox.DirectionOne.Length, ItemRangeBox.DirectionTwo.Length, ItemRangeBox.DirectionThree.Length)
		Result += AddString
	Next
	Return Result
End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone get this to work for a multi-FaceShell SurfaceBody AffectedBy a Combine(Cut) Feature?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 00:30:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10472676#M47914</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-07-16T00:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: FaceShell OrientedRangeBox</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10499635#M47915</link>
      <description>&lt;P&gt;I have abandoned the delete faces workflow, in favor of a build SurfaceBodyDefinition from FaceShell Properties workflow.&amp;nbsp; It works where the previous workflow was failing [bodies affected by Combine(Cut).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm now using "ThisApplication.TransientBRep.CreateSurfaceBodyDefinition" method to build a definition based on the FaceShell's face &amp;amp; EdgleLoop Properties.&amp;nbsp; This is superior to the delete face workflow.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 14:50:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/10499635#M47915</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2021-07-27T14:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: FaceShell OrientedRangeBox</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/12342729#M47916</link>
      <description>&lt;P&gt;Have you an expample how to do that?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 08:29:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/12342729#M47916</guid>
      <dc:creator>dg2405</dc:creator>
      <dc:date>2023-10-31T08:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: FaceShell OrientedRangeBox</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/12343629#M47917</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2724827"&gt;@dg2405&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the main process for each SolidBody:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;For Each fs As FaceShell In oSolid.FaceShells
	'Define Objects to create transient copy
	Dim sbDef As SurfaceBodyDefinition = ThisApplication.TransientBRep.CreateSurfaceBodyDefinition 
	Dim lumpDef As LumpDefinition = sbDef.LumpDefinitions.Add()
	Dim fsDef As FaceShellDefinition = lumpDef.FaceShellDefinitions.Add()
	'Start to fill Definition
	For Each f As Face In fs.Faces
		If f.SurfaceType &amp;lt;&amp;gt; SurfaceTypeEnum.kEllipticalCylinderSurface
			Dim fDef As FaceDefinition = fsDef.FaceDefinitions.Add(f.Geometry, f.IsParamReversed)
			Dim elDef As EdgeLoopDefinition = fDef.EdgeLoopDefinitions.Add()
			For Each ed As Edge In f.EdgeLoops.Item(1).Edges
				elDef.EdgeUseDefinitions.Add(sbDef.EdgeDefinitions.Add(sbDef.VertexDefinitions.Add(ed.StartVertex.Point), sbDef.VertexDefinitions.Add(ed.StopVertex.Point), ed.Geometry), ed.IsParamReversed)
			Next
		Else If f.SurfaceType = SurfaceTypeEnum.kEllipticalCylinderSurface
			'Logger.Debug("Skipping " &amp;amp; CType(f.SurfaceType, SurfaceTypeEnum).ToString &amp;amp; " for now")
		End If
	Next
	'Logger.Trace("Attempt Body creation")
	Dim oErrors As NameValueMap
	Dim TransBody As SurfaceBody = sbDef.CreateTransientSurfaceBody(oErrors)
Next&lt;/LI-CODE&gt;&lt;P&gt;[oSolid is a Surfacebody that has volume and more than 1 FaceShell]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The transient SurfaceBody "TransBody" can then return the OrientedRangeBox Property.&amp;nbsp; I was getting errors with some combine cut faces that were affected by elliptical curve geometry, so I ignore them in my transient body.&amp;nbsp; They were non-impactful surfaces for my needs so&amp;nbsp; it was not something i spent time to fully investigate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions, or if something is not working for you&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 14:04:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/faceshell-orientedrangebox/m-p/12343629#M47917</guid>
      <dc:creator>J-Camper</dc:creator>
      <dc:date>2023-10-31T14:04:47Z</dc:date>
    </item>
  </channel>
</rss>

