Community
Hi! i'm making a Notch tool for sheet metal, and i've run into some problems...
It works by choosing one plane and one part and cutting away the intersecting metal of the active edit part.
Works fine now but i want to add an offset to the cut edges i transfer, but i cant seem to get the sketch entiteities in the right way...
I think Sketch.OffsetSketchEntitiesUsingDistance is the way to go, found a sample in programming help.
Thank you!
Sub NothTool() 'Made to work in ActiveEdit only Dim oApp As Inventor.Application Set oApp = GetObject(, "Inventor.Application") Dim oDoc As Inventor.Document Set oDoc = oApp.ActiveEditObject Dim oPartDoc As Document Set oPartDoc = oApp.ActiveDocument Dim partcomp As SheetMetalComponentDefinition Set partcomp = oDoc.ComponentDefinition 'Select face to notch Dim face1 As Face Set face1 = ThisApplication.CommandManager.Pick( _ SelectionFilterEnum.kPartFacePlanarFilter, _ "Select face to notch.") 'Get nativeface of chosen face above Dim oNativeFace As Face Set oNativeFace = face1.NativeObject 'Make plane in middle of sheetmetal Dim oWPlane As WorkPlane Set oWPlane = partcomp.WorkPlanes.AddByPlaneAndOffset(oNativeFace, -partcomp.Thickness.Value / 2, True) 'add sketch to plane Dim oSketch As Sketch Set oSketch = partcomp.Sketches.Add(oWPlane, True) 'Pick part intersecting part Dim oPart As ComponentOccurrence Set oPart = ThisApplication.CommandManager.Pick( _ SelectionFilterEnum.kAssemblyOccurrenceFilter, _ "Select a intersecting part.") 'Make selectset of of chosen part above Dim oSelSet As SelectSet Set oSelSet = ThisApplication.ActiveDocument.SelectSet 'edit the sketch oSketch.Edit Call oSelSet.Select(oPart) 'project cut edges Dim oDef As ControlDefinition Set oDef = ThisApplication.CommandManager.ControlDefinitions.Item("SketchProjectCutEdgesCmd") oDef.Execute 'cancel cut edges ThisApplication.CommandManager.StopActiveCommand '**************** 'Need code here to offset profiles in sketch '**************** 'Exit sketch oSketch.ExitEdit 'Add all profiles in sketch Dim oProfile As Profile Set oProfile = oSketch.Profiles.AddForSolid 'Creats an "adaptive" extrusion Dim oExtrude As ExtrudeFeature Set oExtrude = partcomp.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, "Thickness*2", kSymmetricExtentDirection, kCutOperation, "10") End Sub