/// <summary> /// Метод создает фаску в 45' /// </summary> public bool Create(double dist, Point3d coor) { try { ksEntityCollection edge = (ksEntityCollection)_app.Part.EntityCollection((short)Obj3dType.o3d_edge); if ((edge != null) && (edge.SelectByPoint(coor.X, coor.Y, coor.Z)) && (edge.GetCount() != 0)) { ksEntity chamfer = (ksEntity)_app.Part.NewEntity((short)Obj3dType.o3d_chamfer); ksChamferDefinition chDef = (ksChamferDefinition)chamfer.GetDefinition(); if (chDef != null) { chDef.tangent = true; chDef.SetChamferParam(false, dist, dist); ksEntityCollection chamferCollection = (ksEntityCollection)chDef.array(); chamferCollection.Clear(); chamferCollection.Add(edge.GetByIndex(0)); chamfer.Create(); } } return(true); } catch { return(false); } }
/// <summary> /// создание фаски /// </summary> /// <param name="param"></param> public void CreateChamfer(Parameters param) { double Lenght1 = param.Lenght1; double Lenght2 = param.Lenght2; double Angle1 = param.Angle1; var doc = (ksDocument3D)_kompas.ActiveDocument3D(); ksPart part2 = (ksPart)doc.GetPart((short)Part_Type.pTop_Part); // новый компонент if (part2 != null) { ksEntityCollection collect2 = (ksEntityCollection)part2.EntityCollection((short)Obj3dType.o3d_face); if (collect2 != null && collect2.SelectByPoint(0, 0, Lenght1 + 5 + Lenght2) && collect2.GetCount() != 0) { ksEntity entityChamfer = (ksEntity)part2.NewEntity((short)Obj3dType.o3d_chamfer); if (entityChamfer != null) { ksChamferDefinition ChamferDef = (ksChamferDefinition)entityChamfer.GetDefinition(); if (ChamferDef != null) { ChamferDef.tangent = false; ChamferDef.SetChamferParam(true, Angle1, Angle1); ksEntityCollection arr = (ksEntityCollection)ChamferDef.array(); // динамический массив объектов if (arr != null) { for (int i = 0, count = collect2.GetCount(); i < count; i++) { arr.Add(collect2.GetByIndex(i)); } entityChamfer.Create(); } } } } } }