06-01-2022
01:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-01-2022
01:17 PM
Hi @johnPGNFG
Here is an iLogic example, based on the "Is cylindrical face interior or exterior?" API Help files Sample
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oHLSet As HighlightSet oHLSet = oDoc.CreateHighlightSet Dim oRed As Color oRed = ThisApplication.TransientObjects.CreateColor(255, 0, 0) oRed.Opacity = 0.1 oHLSet.Color = oRed Dim oHLSet2 As HighlightSet oHLSet2 = oDoc.CreateHighlightSet Dim oGreen As Color oGreen = ThisApplication.TransientObjects.CreateColor(0, 255, 0) oHLSet2.Color = oGreen For Each oSolid In oDoc.ComponentDefinition.SurfaceBodies Dim oFace As Face For Each oFace In oSolid.Faces If Not oFace.SurfaceType = SurfaceTypeEnum.kCylinderSurface Then Continue For If oFace.Edges.Count = 2 Then Continue For 'skip holes or full circle cuts Dim oCylinder As Cylinder oCylinder = oFace.Geometry Dim params(1) As Double params(0) = 0.5 params(1) = 0.5 ' Get point on surface at param .5,.5 Dim points(2) As Double Call oFace.Evaluator.GetPointAtParam(params, points) ' Create point object Dim oPoint As Point oPoint = ThisApplication.TransientGeometry.CreatePoint _ (points(0), points(1), points(2)) ' Get normal at this point Dim normals(2) As Double Call oFace.Evaluator.GetNormal(params, normals) ' Create normal vector object Dim oNormal As Vector oNormal = ThisApplication.TransientGeometry.CreateVector _ (normals(0), normals(1), normals(2)) ' Scale vector by radius of the cylinder oNormal.ScaleBy(oCylinder.Radius) ' Find the sampler point on the normal by adding the ' scaled normal vector to the point at .5,.5 param. Dim oSamplePoint As Point oSamplePoint = oPoint oSamplePoint.TranslateBy(oNormal) ' Check if the sample point lies on the cylinder axis. ' If it does, we have a hollow face. ' Create a line describing the cylinder axis Dim oAxisLine As Line oAxisLine = ThisApplication.TransientGeometry.CreateLine _ (oCylinder.BasePoint, oCylinder.AxisVector.AsVector) 'Create a line parallel to the axis passing thru the sample point. Dim oSampleLine As Line oSampleLine = ThisApplication.TransientGeometry.CreateLine _ (oSamplePoint, oCylinder.AxisVector.AsVector) If oSampleLine.IsColinearTo(oAxisLine) Then oHLSet.AddItem(oFace) MsgBox("Interior face.", , "iLogic") Else oHLSet2.AddItem(oFace) MsgBox("Exterior face.", , "iLogic") End If Next Next