Esempio n. 1
0
        private bool DrawConstraint(Node circleNode, NodeBuilder circleBuilder)
        {
            var       textLocation = circleBuilder[0].Axis3D.GpAxis.Location.Transformed(circleBuilder.Transformation);
            const int translate    = 10;

            textLocation.X = (textLocation.X + circleBuilder[1].Real + translate);
            textLocation.Y = (textLocation.Y + circleBuilder[1].Real + translate);
            var shape       = ShapeUtils.ExtractSubShape(circleNode, 1, TopAbsShapeEnum.TopAbs_EDGE);
            var interactive = DimensionUtils.CreateDependency(shape, textLocation, DsgPrsArrowSide.DsgPrs_AS_BOTHAR);

            if (interactive == null)
            {
                return(false);
            }

            Parent.Set <TreeViewVisibilityInterpreter>();
            Interactive = interactive;
            return(true);
        }
        private bool BuildDimensionInteractive(Node rectangleNode)
        {
            var       textLocation = DimensionUtils.ComputeMiddlePointPosition(rectangleNode, 2).GpPnt;
            const int translate    = 10;

            textLocation.X = (textLocation.X + translate);
            textLocation.Y = (textLocation.Y + translate);
            textLocation.Z = (textLocation.Z + translate);
            var shape       = ShapeUtils.ExtractSubShape(rectangleNode, 2, TopAbsShapeEnum.TopAbs_EDGE);
            var interactive = DimensionUtils.CreateDependency(shape, textLocation, DsgPrsArrowSide.DsgPrs_AS_BOTHAR);

            if (interactive == null)
            {
                return(false);
            }
            Parent.Set <TreeViewVisibilityInterpreter>();
            Interactive = interactive;
            return(true);
        }
Esempio n. 3
0
        public override bool Execute()
        {
            var referenceShape = ShapeUtils.ExtractSubShape(Dependency[0].ReferenceData);
            var refBuilder     = new NodeBuilder(Dependency[0].Reference);
            var builder        = Builder;

            builder.Visibility = refBuilder.Visibility;
            var     textLocation = Dependency[1].TransformedPoint3D.GpPnt;
            var     arrowType    = Dependency[2].Integer == 1 ? DsgPrsArrowSide.DsgPrs_AS_NONE : DsgPrsArrowSide.DsgPrs_AS_BOTHAR;
            Point3D offset       = new Point3D(textLocation);
            bool    isOffset     = false;

            if (Dependency[3].Integer == 1)
            {
                isOffset = true;
                Dependency[3].Integer = 0;
                var edge = TopoDS.Edge(referenceShape);
                var calculatedMidpoint = GeomUtils.CalculateEdgeMidPoint(edge);
                if (calculatedMidpoint != null)
                {
                    offset = new Point3D(textLocation.X - calculatedMidpoint.Value.X,
                                         textLocation.Y - calculatedMidpoint.Value.Y,
                                         textLocation.Z - calculatedMidpoint.Value.Z);
                    Dependency[4].Node.Set <Point3DInterpreter>().Value = offset;
                }
            }
            var interactive = DimensionUtils.CreateDependency(referenceShape, offset.GpPnt, arrowType, isOffset, Dependency[4].TransformedPoint3D.GpPnt);

            if (interactive == null)
            {
                return(false);
            }
            Interactive = interactive;

            return(true);
        }