Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

need help on offesetting geometry in sketch (notch tool for sheet metal)

0 REPLIES 0
Reply
Message 1 of 1
ToreM82
273 Views, 0 Replies

need help on offesetting geometry in sketch (notch tool for sheet metal)

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

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report