Community
Hi all,
I need help as I need to create slots on each bend line on the back of a flat pattern on both sides (left and right).
I have attached a snap of the dimensions (extrusion require is 1/32") of the slot from the bend lines.
please help me to create an ilogic as soon as possible for the same.
Hello. This is a bit sloppy but it would require a lot more time fine tuning. It works for the part you provided but might not for other ones.
On Error Resume Next Dim oPartDoc As PartDocument = ThisDoc.Document Dim oSMCompDef As SheetMetalComponentDefinition oSMCompDef = oPartDoc.ComponentDefinition Dim oSketch As PlanarSketch oSketch = oSMCompDef.FlatPattern.Sketches.Add(oSMCompDef.FlatPattern.TopFace, False) 'point roughly at the center of flat pattern Dim oPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(5, 5) For Each oEdge As Edge In oSMCompDef.FlatPattern.GetEdgesOfType((FlatPatternEdgeTypeEnum.kBendDownFlatPatternEdge)) 'create two points at end point of bend lines then create slot Dim oSketchLine As SketchLine = oSketch.AddByProjectingEntity(oEdge) Dim oSketchPoint As SketchPoint = oSketch.SketchPoints.Add(oPoint) oSketch.GeometricConstraints.AddCoincident(oSketchPoint, oSketchLine) oDimConstraint = oSketch.DimensionConstraints.AddTwoPointDistance(oSketchLine.EndSketchPoint, oSketchPoint, DimensionOrientationEnum.kAlignedDim, oPoint) oDimConstraint.Parameter.Value = 3 / 32 * 2.54 Dim oSketchPoint1 As SketchPoint = oSketch.SketchPoints.Add(oPoint) oSketch.GeometricConstraints.AddCoincident(oSketchPoint1, oSketchLine) oDimConstraint1 = oSketch.DimensionConstraints.AddTwoPointDistance(oSketchPoint, oSketchPoint1, DimensionOrientationEnum.kAlignedDim, oPoint) oDimConstraint1.Parameter.Value = 1.5 * 2.54 oSlot = oSketch.AddStraightSlotByOverall(oSketchPoint, oSketchPoint1, 0.5 * 2.54) 'create two points at start point of bend lines then create slot Dim oSketchPoint2 As SketchPoint = oSketch.SketchPoints.Add(oPoint) oSketch.GeometricConstraints.AddCoincident(oSketchPoint2, oSketchLine) oDimConstraint2 = oSketch.DimensionConstraints.AddTwoPointDistance(oSketchLine.StartSketchPoint, oSketchPoint2, DimensionOrientationEnum.kAlignedDim, oPoint) oDimConstraint2.Parameter.Value = 3 / 32 * 2.54 Dim oSketchPoint3 As SketchPoint = oSketch.SketchPoints.Add(oPoint) oSketch.GeometricConstraints.AddCoincident(oSketchPoint3, oSketchLine) oDimConstraint3 = oSketch.DimensionConstraints.AddTwoPointDistance(oSketchPoint2, oSketchPoint3, DimensionOrientationEnum.kAlignedDim, oPoint) oDimConstraint3.Parameter.Value = 1.5 * 2.54 oSlot = oSketch.AddStraightSlotByOverall(oSketchPoint2, oSketchPoint3, 0.5 * 2.54) Next 'run again for other direction bends??? 'For Each oEdge As Edge In oSMCompDef.FlatPattern.GetEdgesOfType((FlatPatternEdgeTypeEnum.kBendUpFlatPatternEdge)) ' 'copy above 'Next oPartDoc.Update 'create extrusion Dim objCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection Dim oProfile As Profile = oSketch.Profiles.AddForSolid'(False, objCol) oExtrudeDef = oPartDoc.ComponentDefinition.FlatPattern.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kCutOperation) oExtrudeDef.SetDistanceExtent(1 / 32 * 2.54, kNegativeExtentDirection) oExtrude = oPartDoc.ComponentDefinition.FlatPattern.Features.ExtrudeFeatures.Add(oExtrudeDef)
Can't find what you're looking for? Ask the community or share your knowledge.