Hello, I’m trying to troubleshoot an issue. I’ve offset an edge using a distance parameter, but I’ve realized that sometimes the offset extends outside the face, which is problematic because I need to perform an operation (extrude cut) on the face. I attempted a different method, but it doesn’t seem to be working as expected (offsetSign
but the value of offsetDistance
doesn't change).
Any assistance would be greatly appreciated. Thank you!
'usual variable declarations ' Get the face normal swFaceNormal = swFace.Normal ' Determine the offset direction based on the normal If swFaceNormal(2) < 0 Then offsetSign = -1 ' Reverse offset direction if the normal is negative Else offsetSign = 1 ' Use positive offset direction End If ' Adjust offsetDistance based on the normal's direction offsetDistance = offsetDistance * offsetSign ' Select and project the longest edge into the sketch swLongestEdge.Select4 True, swSelectData boolstatus = swSketchMgr.SketchUseEdge3(False, True) ' Use the part file name for engraving Dim strEngrave As String strEngrave = partFileName Debug.Print "engraving to add : " & strEngrave ' Get the active sketch Set swSketch = swSketchMgr.ActiveSketch If Not swSketch Is Nothing Then ' Get all sketch segments swSketchSegs = swSketch.GetSketchSegments ' Select the last added segment (assuming it's the projection) If Not IsEmpty(swSketchSegs) Then Set swSegment = swSketchSegs(UBound(swSketchSegs)) swSegment.Select4 False, Nothing End If End If ' Offset the projected sketch segment with the calculated offset distance swSketchMgr.SketchOffset2 offsetDistance, False, False, swSkOffsetCapEndType_e.swSkOffsetNoCaps, swSkOffsetMakeConstructionType_e.swSkOffsetMakeOffsConstruction, False