/// <summary> /// Метод для создание массива шариков по концентрической сетке /// </summary> /// <param name="part">деталь</param> /// <param name="sketch">Эскиз</param> /// <param name="type">направлние</param> /// <param name="planeXOZ">плоскость XOZ</param> /// <param name="planeYOZ">плоскость YOZ</param> private static void BallsConcentricArray(ksPart part, ksEntity sketch, short type, ksEntity planeXOZ, ksEntity planeYOZ) { ksEntity rotate = part.NewEntity((short)Obj3dType.o3d_bossRotated); ksBossRotatedDefinition rotDef = rotate.GetDefinition(); rotDef.directionType = type; rotDef.SetSketch(sketch); rotDef.SetSideParam(true, 360); ksRotatedParam rotateParam = rotDef.RotatedParam(); rotate.Create(); //ОСЬ ksEntity axis = part.NewEntity((short)Obj3dType.o3d_axis2Planes); ksAxis2PlanesDefinition axisdef = axis.GetDefinition(); axisdef.SetPlane(1, planeXOZ); axisdef.SetPlane(2, planeYOZ); axis.Create(); //Массив по Кругу ksEntity circrotate = part.NewEntity((short)Obj3dType.o3d_circularCopy); ksCircularCopyDefinition cpyRotDef = circrotate.GetDefinition(); cpyRotDef.SetAxis(axis); cpyRotDef.SetCopyParamAlongDir(8, 45, false, false); EntityCollection circcoll = (cpyRotDef.GetOperationArray()); circcoll.Clear(); circcoll.Add(rotate); circrotate.Create(); }
/// <summary> /// Метод для выдавливание вращением в КОМПАС-3D /// </summary> /// <param name="part">деталь</param> /// <param name="sketch">эскиз</param> /// <param name="type">направление</param> private static void BossRotatedExtrusion(ksPart part, ksEntity sketch, short type) { ksEntity bossRotated = part.NewEntity((short)Obj3dType.o3d_bossRotated); ksBossRotatedDefinition bossRotatedDef = bossRotated.GetDefinition(); bossRotatedDef.directionType = type; bossRotatedDef.SetSketch(sketch); bossRotatedDef.SetSideParam(true, 360); ksRotatedParam rotateParam = bossRotatedDef.RotatedParam(); bossRotated.Create(); }
/// <summary> /// Построение детали "шайба с пазом" /// </summary> /// <param name="shimSettings">Параметры шайбы</param> /// <returns>Возвращает компонент сборки</returns> private ksPart CreateShim(ShimSettings shimSettings) { // Создание документа детели ksDocument3D document3D = _kompas.Document3D(); document3D.Create(); // Получим верхнюю часть сборки ksPart part = document3D.GetPart((short)Part_Type.pTop_Part); // Создание эскиза для шайбы ksEntity sketchShim; ksSketchDefinition sketchShimDefinition; CreateSketch(part, out sketchShim, out sketchShimDefinition, (short)Obj3dType.o3d_planeXOY); // Рисуем на эскизе шайбу ksDocument2D shimEdit = sketchShimDefinition.BeginEdit(); DrawShim(shimSettings, shimEdit); sketchShimDefinition.EndEdit(); // Вращением выдавливаем шайду ksEntity rotate = (ksEntity)part.NewEntity((short)Obj3dType.o3d_bossRotated); ksBossRotatedDefinition rotateDefinition = (ksBossRotatedDefinition)rotate.GetDefinition(); rotateDefinition.directionType = (short)Direction_Type.dtNormal; rotateDefinition.SetSideParam(true, 360); rotateDefinition.toroidShapeType = false; rotateDefinition.SetSketch(sketchShim); rotate.Create(); return(part); }