示例#1
0
        public Opening(OpeningTask task)
        {
            Task      = task;
            FrameList = new TFCOM.TFFrameListClass();

            BCOM.Level level = ElementHelper.GetOrCreateLevel(LEVEL_NAME);

            contour_ = task.GetContourShape();

            BCOM.SmartSolidElement body =
                App.SmartSolid.ExtrudeClosedPlanarCurve(contour_, task.Depth, 0.0, false);
            body.Level = level;
            ElementHelper.setSymbologyByLevel(body);

            FrameList.Add3DElement(body);
            FrameList.AsTFFrame.SetName(CELL_NAME);
        }
示例#2
0
        public void Initialize()
        {
            if (IsInitialized_)
            {
                return;
            }

            BCOM.Level level = ElementHelper.GetOrCreateLevel(LevelName);

            FrameList = new TFCOM.TFFrameListClass();

            IEnumerable <BCOM.Element> bodyElements = GetBodyElements();

            foreach (BCOM.Element element in bodyElements)
            {
                element.Level = level;
                ElementHelper.setSymbologyByLevel(element);
                FrameList.Add3DElement(element);
            }

            FrameList.SetName(CellName);

            IsInitialized_ = true;
        }
示例#3
0
        public static TFCOM.TFFrameListClass createFrameList(
            IPenetrTask task, PenetrInfo penInfo, BCOM.Level level)
        {
            task.scanInfo();

            var taskUOR = new UOR(task.ModelRef);

            double pipeInsideDiam  = penInfo.pipeDiameterInside / taskUOR.activeSubPerMaster;
            double pipeOutsideDiam = penInfo.pipeDiameterOutside / taskUOR.activeSubPerMaster;

            double flangeInsideDiam  = penInfo.flangeDiameterInside / taskUOR.activeSubPerMaster;
            double flangeOutsideDiam = penInfo.flangeDiameterOutside / taskUOR.activeSubPerMaster;
            double flangeThick       = penInfo.flangeThick / taskUOR.activeSubPerMaster;

            double length = task.LengthCm * 10 / taskUOR.activeSubPerMaster;

            var solids = App.SmartSolid;

            /*
             *  ! длина трубы меньше размера проходки на толщину фланца
             *  ! ЕСЛИ ФЛАНЕЦ ЕСТЬ
             */

            double delta = task.FlangesCount == 0 ? 0 :
                           task.FlangesCount * flangeThick / 2;

            BCOM.SmartSolidElement cylindrInside =
                solids.CreateCylinder(null, pipeInsideDiam / 2, length - delta);

            BCOM.SmartSolidElement cylindrOutside =
                solids.CreateCylinder(null, pipeOutsideDiam / 2, length - delta);

            var cylindr = solids.SolidSubtract(cylindrOutside, cylindrInside);

            var elements = new Dictionary <BCOM.Element, double>();

            {
                double shift = task.FlangesCount == 1 ? delta : 0;
                shift *= task.IsSingleFlangeFirst ? 1 : -1;
                elements.Add(cylindr, (length + shift) / 2);
            }

            // Фланцы:
            for (int i = 0; i < task.FlangesCount; ++i)
            {
                BCOM.SmartSolidElement flangeCylindr = solids.SolidSubtract(
                    solids.CreateCylinder(null, flangeOutsideDiam / 2, flangeThick),
                    solids.CreateCylinder(null, pipeOutsideDiam / 2, flangeThick));

                double shift = 0;

                if (task.FlangesCount == 1)
                {
                    bool isNearest = App.Vector3dEqualTolerance(task.SingleFlangeSide,
                                                                App.Vector3dFromXYZ(0, 0, -1), 0.1); // 0.001

                    // 0.5 - для видимости фланцев на грани стены/плиты
                    shift = isNearest ?
                            0.0 + flangeThick / 2 - task.FlangeWallOffset:
                            length - flangeThick / 2 + task.FlangeWallOffset;
                }
                else
                {
                    shift = i == 0 ? 0.0 : length;
                    // для самих фланцев:

                    shift += Math.Pow(-1, i) * (flangeThick / 2 - task.FlangeWallOffset); //0.02);
                }
                elements.Add(flangeCylindr, shift);
            }

            BCOM.Transform3d taskTran = App.Transform3dFromMatrix3d(task.Rotation);

            var angles = task.CorrectiveAngles;

            TFCOM.TFFrameListClass frameList = new TFCOM.TFFrameListClass();

            foreach (var pair in elements)
            {
                BCOM.Element elem  = pair.Key;
                double       shift = pair.Value;

                elem.Color = 0; // TODO
                BCOM.Point3d offset = App.Point3dAddScaled(
                    App.Point3dZero(), App.Point3dFromXYZ(0, 0, 1), shift);
                elem.Move(offset);

                elem.Rotate(App.Point3dZero(), angles.X, angles.Y, angles.Z);

                elem.Transform(taskTran);
                elem.Move(task.Location);

                elem.Level = level;
                ElementHelper.setSymbologyByLevel(elem);

                frameList.AsTFFrame.Add3DElement(elem);
            }

            frameList.AsTFFrame.SetName(PenConfigVariables.CellName.Value); // ранее было 'EmbeddedPart'
            return(frameList);
        }