Exemple #1
0
        /// <summary>
        ///   Builds a dimension on an edge of type Line
        /// </summary>
        public static AISInteractiveObject BuildLineDimension(NodeBuilder lineTwoPoints, gpPnt textLocation,
                                                              DsgPrsArrowSide arrowType, bool isOffset, gpPnt offset)
        {
            var point1 = lineTwoPoints[0].RefTransformedPoint3D;
            var point2 = lineTwoPoints[1].RefTransformedPoint3D;

            var length = point1.GpPnt.Distance(point2.GpPnt);

            Console.WriteLine(lineTwoPoints.ShapeName);

            var mkPlane = new GCMakePlane(point1.GpPnt, point2.GpPnt, textLocation);
            var plane   = mkPlane.Value;

            return(length < 1e-12
                       ? null
                       : GeomUtils.BuildLengthDimension(point1.GpPnt, point2.GpPnt, plane, textLocation,
                                                        arrowType, ArrowSize, 0.2, isOffset, offset));
        }
Exemple #2
0
        /// <summary>
        ///   Builds a dimension between a start and end point.
        /// </summary>
        private static AISInteractiveObject CreateDimension(gpPnt startPoint, gpPnt endPoint,
                                                            gpPnt textLocation, DsgPrsArrowSide arrowSide,
                                                            double arrowSize)
        {
            var mkPlane = new GCMakePlane(startPoint, endPoint, textLocation);
            var plane   = new GeomPlane(new gpPln());

            try
            {
                plane = mkPlane.Value;
            }
            catch (Exception)
            {
                //return null;
            }

            var length = startPoint.Distance(endPoint);

            return(length < 1e-12
                       ? null
                       : GeomUtils.BuildLengthDimension(startPoint, endPoint, plane, textLocation, arrowSide, arrowSize,
                                                        0.2, false, null));
        }
Exemple #3
0
        /// <summary>
        ///   Builds a dimension on an edge of type Line
        /// </summary>
        private static AISInteractiveObject BuildLineDimension(TopoDSEdge edge, gpPnt textLocation,
                                                               GeomPlane dimensionPlane, DsgPrsArrowSide arrowType, bool isOffset, gpPnt offset)
        {
            var curve = new BRepAdaptorCurve(edge);

            if (curve.GetType != GeomAbsCurveType.GeomAbs_Line)
            {
                return(null);
            }

            // For a line use a length dimension
            var line = curve.Line;

            if (line.Distance(textLocation) < Precision.Confusion)
            {
                textLocation.X = (textLocation.X + 0.01);
            }
            var firstPoint = curve.Value(curve.FirstParameter);
            var lastPoint  = curve.Value(curve.LastParameter);
            var plane      = dimensionPlane;

            if (plane == null)
            {
                var mkPlane = new GCMakePlane(firstPoint, lastPoint, textLocation);
                plane = mkPlane.Value;
            }
            var length = firstPoint.Distance(lastPoint);

            return(length < 1e-12
                       ? null
                       : GeomUtils.BuildLengthDimension(firstPoint, lastPoint, plane, textLocation,
                                                        arrowType, ArrowSize, 0.2, isOffset, offset));
        }
Exemple #4
0
        /// <summary>
        ///   Detects the referenced shape type and generates an appropiate
        ///   dimension for it
        /// </summary>
        public static AISInteractiveObject CreateDependency(TopoDSShape referenceShape, gpPnt textLocation, DsgPrsArrowSide arrowType, bool isOffset = false, gpPnt offset = null)
        {
            if (referenceShape == null || referenceShape.ShapeType != TopAbsShapeEnum.TopAbs_EDGE)
            {
                return(null);
            }

            var curve = new BRepAdaptorCurve(TopoDS.Edge(referenceShape));

            if (curve.GetType == GeomAbsCurveType.GeomAbs_Circle)
            {
                return(BuildCircleDimension(referenceShape, textLocation));
            }
            return(curve.GetType == GeomAbsCurveType.GeomAbs_Line
                       ? BuildLineDimension(TopoDS.Edge(referenceShape), textLocation, null, arrowType, isOffset, offset)
                       : null);
        }
 public AISDiameterDimension(TopoDSShape aShape, double aVal, TCollectionExtendedString aText, gpPnt aPosition, DsgPrsArrowSide aSymbolPrs, bool aDiamSymbol, double anArrowSize)
     :
     base(AIS_DiameterDimension_Ctor54910EE4(aShape.Instance, aVal, aText.Instance, aPosition.Instance, (int)aSymbolPrs, aDiamSymbol, anArrowSize))
 {
 }
 public AISLengthDimension(TopoDSShape aFShape, TopoDSShape aSShape, GeomPlane aPlane, double aVal, TCollectionExtendedString aText, gpPnt aPosition, DsgPrsArrowSide aSymbolPrs, AISTypeOfDist aTypeDist, double anArrowSize)
     :
     base(AIS_LengthDimension_CtorEA089509(aFShape.Instance, aSShape.Instance, aPlane.Instance, aVal, aText.Instance, aPosition.Instance, (int)aSymbolPrs, (int)aTypeDist, anArrowSize))
 {
 }
 public AISLengthDimension(TopoDSFace aFirstFace, TopoDSFace aSecondFace, double aVal, TCollectionExtendedString aText, gpPnt aPosition, DsgPrsArrowSide aSymbolPrs, double anArrowSize)
     :
     base(AIS_LengthDimension_Ctor5485084F(aFirstFace.Instance, aSecondFace.Instance, aVal, aText.Instance, aPosition.Instance, (int)aSymbolPrs, anArrowSize))
 {
 }