Message 1 of 4
Sheet Metal Bend FrontFaces and BackFaces Not Working?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there. I have an iLogic rule that has been working fine until recently and I can't figure out why it now has a problem. It seems to be with Bend.FrontFaces or Bend.BackFaces. The troublesome part of my code is below. Does anyone see anything wrong with what I have, or know of something that happened with Inventor 2016 to make it not work? Again, this used to work perfectly well.
Thanks!
SyntaxEditor Code Snippet
Sub Main() Dim oApp As Inventor.Application = ThisApplication If oApp.ActiveDocument.Subtype <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'not sheet metal document Exit Sub End If oApp.SilentOperation = True Dim oPartDoc As PartDocument = oApp.ActiveDocument Dim oSMDef As SheetMetalComponentDefinition oSMDef = oPartDoc.ComponentDefinition Dim oFeatures As SheetMetalFeatures = oSMDef.Features Dim oFace As Face Dim oBend As Bend Dim oBends As BendsEnumerator = oSMDef.Bends() Dim i As Integer = 0 'Get a valid face for unfolding and flat sketch For i = 1 To 80 oPartDoc.SelectSet.Clear oFace = oSMDef.SurfaceBodies.Item(1).Faces.Item(i) If oFace.SurfaceType = 5890 Then oPartDoc.SelectSet.Select(oFace) Try oFeatures.UnfoldFeatures.Add(oFace) oApp.CommandManager.ControlDefinitions("AppUndoCmd").Execute oFace = oSMDef.SurfaceBodies.Item(1).Faces.Item(i) Exit For Catch oPartDoc.SelectSet.Clear End Try End If Next If i=80 Then 'failed to find a good face MessageBox.Show("Couldn't unfold.", "Failure") Exit Sub End If System.Threading.Thread.CurrentThread.Sleep(100) oPartDoc.SelectSet.Select(oFace) oFeatures.UnfoldFeatures.Add(oFace) System.Threading.Thread.CurrentThread.Sleep(100) Try oSketch = oSMDef.Sketches.Add(oFace, False) 'Do not project face edges Catch Exit Sub End Try System.Threading.Thread.CurrentThread.Sleep(100) Dim oBackFaces As Faces Dim oFrontFaces As Faces oSketch.Edit For Each oBend In oBends oBackFaces = oBend.BackFaces oFrontFaces = oBend.FrontFaces
'It doesn't make it to here!