示例#1
0
        public static void ScanBSplineSurface()
        {
            BCOM.Application         app = Program.COM_App;
            BCOM.ElementScanCriteria sc  = new BCOM.ElementScanCriteriaClass();
            sc.ExcludeAllTypes();
            sc.IncludeType(BCOM.MsdElementType.BsplineSurface);

            var ee = app.ActiveModelReference.Scan(sc);
            //var firstcurrent = ee.Current;
            var bsplinesurface = new List <BCOM.BsplineSurface>();

            while (ee.MoveNext())
            {
                bsplinesurface.Add(ee.Current.AsBsplineSurfaceElement().ExtractBsplineSurface());
            }
            //foreach (var surface in bsplinesurface)
            //{
            //    //var surfacehandler = app.CreatePropertyHandler(surface);
            //    //string s= surfacehandler.GetDisplayString();
            //}
            BCOM.Point3d p1   = app.Point3dFromXYZ(200, 110, 100);
            BCOM.Ray3d   ray1 = new Bentley.Interop.MicroStationDGN.Ray3d()
            {
                Origin    = app.Point3dFromXYZ(200, 110, 100),
                Direction = app.Point3dFromXYZ(0, 0, -200)
            };
            BCOM.Point3d insertpoint = app.Point3dZero();
            BCOM.Point2d uv          = app.Point2dZero();
            foreach (var bsp in bsplinesurface)
            {
                if (bsp.IntersectRay3d(ref insertpoint, ref uv, ref ray1))
                {
                    string s  = insertpoint.ToString();
                    string s2 = uv.ToString();
                }
            }
        }