Exemplo n.º 1
0
        public override TFPerforatorList GetPerfoList()
        {
            double pipeOutsideDiam = PenInfo.pipeDiameterOutside / taskUOR.activeSubPerMaster;
            double length          = Task.LengthCm * 10 / taskUOR.activeSubPerMaster;

            var angles = Task.CorrectiveAngles;

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

            // ПЕРФОРАТОР
            BCOM.EllipseElement perfoEl =
                App.CreateEllipseElement2(null, App.Point3dZero(),
                                          pipeOutsideDiam / 2, pipeOutsideDiam / 2,
                                          App.Matrix3dIdentity(), BCOM.MsdFillMode.Filled);
            {
                BCOM.Point3d offset = App.Point3dAddScaled(
                    App.Point3dZero(),
                    App.Point3dFromXYZ(0, 0, 1), length / 2);
                perfoEl.Move(offset);
                perfoEl.Rotate(App.Point3dZero(), angles.X, angles.Y, angles.Z);
            }
            perfoEl.Level = ElementHelper.GetOrCreateLevel(PenConfigVariables.PerfoLevel);
            ElementHelper.setSymbologyByLevel(perfoEl);
            perfoEl.Transform(taskTran);
            perfoEl.Move(Task.Location);

            BCOM.Point3d perfoVec = perfoEl.Normal;

            TFCOM.TFPerforatorList perfoList = AppTF.CreateTFPerforator();
            var tranIdentity = App.Transform3dIdentity();

            perfoList.InitFromElement(perfoEl, perfoVec, length / 2 * 1.01, tranIdentity);
            return(perfoList);
        }
Exemplo n.º 2
0
        private void transformToBase(BCOM.Element element, BCOM.Point3d origin)
        {
            // инвертируем трансформацию:
            if (App.Matrix3dHasInverse(Rotation))
            {
                BCOM.Transform3d tran = App.Transform3dFromMatrix3d(Rotation);
                element.Transform(App.Transform3dInverse(tran));
            }
            var angles = CorrectiveAngles;

            element.Rotate(App.Point3dZero(), -angles.X, -angles.Y, -angles.Z);
        }
Exemplo n.º 3
0
        public static T transformByTask <T>(this T element, IPenetrTask task,
                                            double shiftX = 0.0, double shiftY = 0.0, double shiftZ = 0.0)
            where T : BCOM.Element
        {
            BCOM.Point3d shiftPoint = App.Point3dFromXYZ(shiftX, shiftY, shiftZ);
            element.Move(ref shiftPoint);

            BCOM.Point3d zero   = App.Point3dZero();
            var          angles = task.CorrectiveAngles;

            element.Rotate(ref zero, angles.X, angles.Y, angles.Z);

            BCOM.Matrix3d    rotation    = task.Rotation;
            BCOM.Transform3d transform3d = App.Transform3dFromMatrix3d(ref rotation);
            element.Transform(ref transform3d);

            BCOM.Point3d location = task.Location;
            element.Move(ref location);
            return(element);
        }
Exemplo n.º 4
0
        public override IEnumerable <BCOM.Element> GetBodyElements()
        {
            var elements = new List <BCOM.Element>();

            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 = Length;

            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 elementsShift = new Dictionary <BCOM.Element, double>();

            {
                double shift = Task.FlangesCount == 1 ? delta : 0;
                shift *= Task.IsSingleFlangeFirst ? 1 : -1;
                elementsShift.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);
                }
                elementsShift.Add(flangeCylindr, shift);
            }

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

            var angles = Task.CorrectiveAngles;

            foreach (var pair in elementsShift)
            {
                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);

                elements.Add(elem);
            }

            return(elements);
        }
Exemplo n.º 5
0
        public static void addPerforator(TFCOM.TFFrameList frameList,
                                         IPenetrTask task, PenetrInfo penInfo, BCOM.Level levelSymb, bool isVisible)
        {
            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 angles = task.CorrectiveAngles;

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

            // ПЕРФОРАТОР
            BCOM.EllipseElement perfoEl =
                App.CreateEllipseElement2(null, App.Point3dZero(),
                                          pipeInsideDiam / 2, pipeInsideDiam / 2,
                                          App.Matrix3dIdentity(), BCOM.MsdFillMode.Filled);
            {
                BCOM.Point3d offset = App.Point3dAddScaled(
                    App.Point3dZero(),
                    App.Point3dFromXYZ(0, 0, 1), length / 2);
                perfoEl.Move(offset);
                perfoEl.Rotate(App.Point3dZero(), angles.X, angles.Y, angles.Z);
            }
            perfoEl.Level = levelSymb;
            ElementHelper.setSymbologyByLevel(perfoEl);
            perfoEl.Transform(taskTran);
            perfoEl.Move(task.Location);

            BCOM.Point3d perfoVec = perfoEl.Normal;

            TFCOM.TFPerforatorList perfoList = AppTF.CreateTFPerforator();
            var tranIdentity = App.Transform3dIdentity();

            perfoList.InitFromElement(perfoEl, perfoVec, length / 2 * 1.01, tranIdentity);
            perfoList.SetSweepMode(
                TFCOM.TFdPerforatorSweepMode.tfdPerforatorSweepModeBi);
            //perfoList.SetSenseDist(1.01 * length / 2);
            perfoList.SetPolicy(
                TFCOM.TFdPerforatorPolicy.tfdPerforatorPolicyThroughHoleWithinSenseDist);
            perfoList.SetIsVisible(isVisible);

            frameList.AsTFFrame.SetPerforatorList(perfoList);
            frameList.AsTFFrame.SetSenseDistance2(length / 2);
            frameList.AsTFFrame.SetPerforatorsAreActive(true);
            frameList.Synchronize();

            {
                // ! без этого кода не срабатывает перфорация в стенке/плите
                // судя по всему инициализирует обновление объектов, с которыми
                // взаимодействует frame

                AppTF.ModelReferenceUpdateAutoOpeningsByFrame(
                    App.ActiveModelReference, frameList.AsTFFrame, true, false,
                    TFCOM.TFdFramePerforationPolicy.tfdFramePerforationPolicyNone);
            }
        }
Exemplo n.º 6
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);
        }