static public MirrorFeature addMirror(SheetMetalComponentDefinition smcd, ObjectCollection objs, string name, UnitVector vec) { SheetMetalFeatures smf = (SheetMetalFeatures)smcd.Features; WorkPlane wp = smcd.WorkPlanes.OfType <WorkPlane>().First(e => InvDoc.u.eq(vec, e.Plane.Normal)); MirrorFeature mir = smf.MirrorFeatures.Add(objs, wp, false, PatternComputeTypeEnum.kAdjustToModelCompute); mir.Name = name; return(mir); }
//Зеркальное отражение детали public void Mirror_Obj(RevolveFeature feature, PartDocument part) { PartComponentDefinition partCompDef = part.ComponentDefinition; PlanarSketch sketch = partCompDef.Sketches.Add(partCompDef.WorkPlanes[1]); sketch.Visible = false; TransientGeometry transGeom = InventorApplication.TransientGeometry; SketchLine line_1 = sketch.SketchLines.AddByTwoPoints(transGeom.CreatePoint2d(-6, -5), transGeom.CreatePoint2d(-6, 5)); SketchLine line_2 = sketch.SketchLines.AddByTwoPoints(transGeom.CreatePoint2d(6, -5), transGeom.CreatePoint2d(6, 5)); WorkPlane wp = partCompDef.WorkPlanes.AddByTwoLines(line_1, line_2, true); ObjectCollection obj_collection = InventorApplication.TransientObjects.CreateObjectCollection(); obj_collection.Add(feature); MirrorFeature mirror = partCompDef.Features.MirrorFeatures.Add(obj_collection, wp, false, PatternComputeTypeEnum.kAdjustToModelCompute); }