private bool CheckAndApplyPointMiddleOfLine(PointHinterShape pointShape, LineHinterShape line,
                                                    Point3D sourcePoint)
        {
            var linePoint1 = line.Point1;
            var linePoint2 = line.Point2;
            var builder    = new NodeBuilder(line.Builder.Node);
            var midPoint   = DimensionUtils.ComputeMiddlePoint(linePoint1, linePoint2);

            if (midPoint.Distance(sourcePoint) >= Options.PointRange)
            {
                var edges = GeomUtils.ExtractEdges(line.Builder.Shape);
                if (edges.Count != 1)
                {
                    return(false);
                }
                if (GeomUtils.PointIsOnEdge(edges[0], sourcePoint))
                {
                    AddConstraint(line.Builder.Node, pointShape.Builder.Node, Constraint2DNames.PointOnLineFunction);
                    builder.Color = Color.Tomato;
                    builder.ExecuteFunction();
                    return(true);
                }
                return(false);
            }
            AddConstraint(line.Builder.Node, pointShape.Builder.Node, Constraint2DNames.PointOnLineMidpointFunction);
            builder.Color = Color.Violet;
            builder.ExecuteFunction();
            return(true);
        }
Exemplo n.º 2
0
        private AISInteractiveObject UpdateInteractive(Point3D sourcePoint)
        {
            var builder          = Builder;
            var destinationPoint = NodeUtils.GetReferencePoint(builder, 1);
            var midPoint         = DimensionUtils.ComputeMiddlePoint(sourcePoint, destinationPoint);
            var textPoint        = midPoint;

            midPoint.X += 1;
            midPoint.Y += 2;
            midPoint.Z += 3;
            var mkPlane = new GCMakePlane(sourcePoint.GpPnt, destinationPoint.GpPnt, midPoint.GpPnt);
            var plane   = mkPlane.Value;
            var ocaisLengthDimension = GeomUtils.BuildLengthDimension(sourcePoint.GpPnt,
                                                                      destinationPoint.GpPnt,
                                                                      plane,
                                                                      textPoint.GpPnt,
                                                                      DsgPrsArrowSide.DsgPrs_AS_BOTHAR, 2, 0.2, false, null);

            return(ocaisLengthDimension);
        }