示例#1
0
        public override List <SolverPreviewObject> InterestingShapeAroundPoint(gpPln planeOfTheView, Point3D point)
        {
            var normalOnViewPlane = planeOfTheView.Position.Direction;
            var normalLine        = new gpLin(point.GpPnt, normalOnViewPlane);

            var qosLock = QosFactory.Instance.Get(QosNames.PointMatchLock);
            var zoom    = CoreGlobalPreferencesSingleton.Instance.ZoomLevel * _precision;

            qosLock.Begin();
            var solutions = new SortedDictionary <double, SolverPointResult>();

            foreach (var geometricObject in LastGeometry)
            {
                // Test if the object contains any magic point
                foreach (var pnt in geometricObject.Points)
                {
                    var distance = normalLine.Distance(pnt.Point.GpPnt);
                    if (distance >= zoom)
                    {
                        continue;
                    }
                    solutions[distance] = new SolverPointResult(pnt.Point, pnt.GeometryType)
                    {
                        Text = "Point match"
                    };
                }
            }
            qosLock.End();
            if (solutions.Count == 0)
            {
                return(new List <SolverPreviewObject>());
            }
            var SolverPreviewObjects = new List <SolverPreviewObject>();

            foreach (var s in solutions)
            {
                SolverPreviewObjects.Add(s.Value);
            }
            return(SolverPreviewObjects);
        }
        /// <summary>
        ///   Calculates the computer radiuses knowing the center position and two points located on the two axis
        /// </summary>
        public static bool ComputeEllipseRadiuses(Point3D center, Point3D secondPoint, Point3D thirdPoint,
                                                  out double minorRadius, out double majorRadius,
                                                  out bool reversed, ref gpDir dirX, ref gpDir dirY)
        {
            // Calculate the major radius
            majorRadius = center.GpPnt.Distance(secondPoint.GpPnt);
            // Calculate also the axis/direction of the major radus
            var vecX = new gpVec(center.GpPnt, secondPoint.GpPnt);

            dirX = new gpDir(vecX);
            var line = new gpLin(center.GpPnt, dirX);

            // Calculate the minor radius
            minorRadius = line.Distance(thirdPoint.GpPnt);
            reversed    = false;
            if (minorRadius < Precision.Confusion || majorRadius < Precision.Confusion)
            {
                return(false);
            }
            // Calculate also the axis/direction of the major radus
            var vecY = new gpVec(center.GpPnt, thirdPoint.GpPnt);
            // We want the direction to be perpendicular on the direction of the major radius
            var vecZ = vecX.Crossed(vecY);

            vecY = vecX.Crossed(vecZ);
            dirY = new gpDir(vecY);

            // Major radius must be bigger than minor radius

            if (minorRadius > majorRadius)
            {
                var aux = majorRadius;
                majorRadius = minorRadius;
                minorRadius = aux;
                reversed    = true;
            }
            return(true);
        }
        public static TopoDSShape CreateArcShape(Point3D point1, Point3D point2, Point3D point3)
        {
            if (point1.IsEqual(point2) || point1.IsEqual(point3) || point2.IsEqual(point3))
            {
                return(null);
            }

            var line = new gpLin(point1.GpPnt, new gpDir(new gpVec(point1.GpPnt, point2.GpPnt)));

            if (line.Distance(point3.GpPnt) < Precision.Confusion)
            {
                return(null);
            }

            var gceCirc    = new gceMakeCirc(point1.GpPnt, point2.GpPnt, point3.GpPnt);
            var circle     = gceCirc.Value;
            var arc        = new GCMakeArcOfCircle(circle, point2.GpPnt, point1.GpPnt, true);
            var curve      = arc.Value;
            var edge       = new BRepBuilderAPIMakeEdge(curve).Edge;
            var circleWire = new BRepBuilderAPIMakeWire(edge).Wire;

            return(circleWire);
        }
 public BRepBuilderAPIMakeEdge(gpLin L, TopoDSVertex V1, TopoDSVertex V2)
     :
     base(BRepBuilderAPI_MakeEdge_Ctor1D47CBD(L.Instance, V1.Instance, V2.Instance))
 {
 }
 public BRepBuilderAPIMakeEdge(gpLin L, gpPnt P1, gpPnt P2)
     :
     base(BRepBuilderAPI_MakeEdge_Ctor89D07A8C(L.Instance, P1.Instance, P2.Instance))
 {
 }
 public BRepBuilderAPIMakeEdge(gpLin L, double p1, double p2)
     :
     base(BRepBuilderAPI_MakeEdge_Ctor13A123E9(L.Instance, p1, p2))
 {
 }
 public BRepBuilderAPIMakeEdge(gpLin L)
     :
     base(BRepBuilderAPI_MakeEdge_Ctor9917D291(L.Instance))
 {
 }
 public GeomLine(gpLin L)
     :
     base(Geom_Line_Ctor9917D291(L.Instance))
 {
 }
示例#9
0
 public gceMakeLin(gpLin Lin, gpPnt Point)
     :
     base(gce_MakeLin_Ctor1CB0FB3C(Lin.Instance, Point.Instance))
 {
 }
示例#10
0
 public void Perform(gpLin L, double PInf, double PSup)
 {
     IntCurvesFace_Intersector_Perform13A123E9(Instance, L.Instance, PInf, PSup);
 }
示例#11
0
 public void Perform(gpLin L, gpPln P, double Tolang)
 {
     IntAna_IntConicQuad_Perform89334BAA(Instance, L.Instance, P.Instance, Tolang);
 }
示例#12
0
 public IntAnaIntConicQuad(gpLin L, gpPln P, double Tolang)
     :
     base(IntAna_IntConicQuad_Ctor89334BAA(L.Instance, P.Instance, Tolang))
 {
 }
示例#13
0
 public static gpLin2d Project(gpCone Co, gpLin L)
 {
     return(new gpLin2d(ProjLib_Project80DF43EE(Co.Instance, L.Instance)));
 }
示例#14
0
 public static gpLin2d Project(gpCylinder Cy, gpLin L)
 {
     return(new gpLin2d(ProjLib_ProjectDE57BDFB(Cy.Instance, L.Instance)));
 }
示例#15
0
 public static gpLin2d Project(gpPln Pl, gpLin L)
 {
     return(new gpLin2d(ProjLib_Project1626C982(Pl.Instance, L.Instance)));
 }
示例#16
0
 public bool IsOut(gpLin L)
 {
     return(Bnd_Box_IsOut9917D291(Instance, L.Instance));
 }