当前位置: 首页>>代码示例>>C#>>正文


C# Room.get_BoundingBox方法代码示例

本文整理汇总了C#中Room.get_BoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C# Room.get_BoundingBox方法的具体用法?C# Room.get_BoundingBox怎么用?C# Room.get_BoundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room.get_BoundingBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ListRoomData

        /// <summary>
        /// List some properties of a given room to the
        /// Visual Studio debug output window.
        /// </summary>
        void ListRoomData( Room room )
        {
            SpatialElementBoundaryOptions opt
            = new SpatialElementBoundaryOptions();

              string nr = room.Number;
              string name = room.Name;
              double area = room.Area;

              Location loc = room.Location;
              LocationPoint lp = loc as LocationPoint;
              XYZ p = ( null == lp ) ? XYZ.Zero : lp.Point;

              BoundingBoxXYZ bb = room.get_BoundingBox( null );

              IList<IList<BoundarySegment>> boundary
            = room.GetBoundarySegments( opt );

              int nLoops = boundary.Count;

              int nFirstLoopSegments = 0 < nLoops
            ? boundary[0].Count
            : 0;

              BoundingBoxXYZ boundary_bounding_box
            = GetBoundingBox( boundary );

              List<XYZ> convex_hull
            = GetConvexHullOfRoomBoundary( boundary );

              Debug.Print( string.Format(
            "Room nr. '{0}' named '{1}' at {2} with "
            + "lower left corner {3}, convex hull {4}, "
            + "bounding box {5} and area {6} sqf has "
            + "{7} loop{8} and {9} segment{10} in first "
            + "loop.",
            nr, name, Util.PointString( p ),
            Util.PointString( boundary_bounding_box.Min ),
            Util.PointArrayString( convex_hull ),
            BoundingBoxString2( bb ), area, nLoops,
            Util.PluralSuffix( nLoops ), nFirstLoopSegments,
            Util.PluralSuffix( nFirstLoopSegments ) ) );
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:47,代码来源:CmdListAllRooms.cs

示例2: GetFurniture

        /// <summary>
        /// Return the element ids of all furniture and 
        /// equipment family instances contained in the 
        /// given room.
        /// </summary>
        static List<Element> GetFurniture( Room room )
        {
            BoundingBoxXYZ bb = room.get_BoundingBox( null );

              Outline outline = new Outline( bb.Min, bb.Max );

              BoundingBoxIntersectsFilter filter
            = new BoundingBoxIntersectsFilter( outline );

              Document doc = room.Document;

              // Todo: add category filters and other
              // properties to narrow down the results

              // what categories of family instances
              // are we interested in?

              BuiltInCategory[] bics = new BuiltInCategory[] {
            BuiltInCategory.OST_Furniture,
            BuiltInCategory.OST_PlumbingFixtures,
            BuiltInCategory.OST_SpecialityEquipment
              };

              LogicalOrFilter categoryFilter
            = new LogicalOrFilter( bics
              .Select<BuiltInCategory,ElementFilter>(
            bic => new ElementCategoryFilter( bic ) )
              .ToList<ElementFilter>() );

              FilteredElementCollector familyInstances
            = new FilteredElementCollector( doc )
              .WhereElementIsNotElementType()
              .WhereElementIsViewIndependent()
              .OfClass( typeof( FamilyInstance ) )
              .WherePasses( categoryFilter )
              .WherePasses( filter );

              int roomid = room.Id.IntegerValue;

              List<Element> a = new List<Element>();

              foreach( FamilyInstance fi in familyInstances )
              {
            if( null != fi.Room
              && fi.Room.Id.IntegerValue.Equals( roomid ) )
            {
              Debug.Assert( fi.Location is LocationPoint,
            "expected all furniture to have a location point" );

              a.Add( fi );
            }
              }
              return a;
        }
开发者ID:jeremytammik,项目名称:RoomEditorApp,代码行数:59,代码来源:CmdUploadRooms.cs

示例3: UploadRoom

        /// <summary>
        /// Upload the selected rooms and the furniture 
        /// they contain to the cloud database.
        /// </summary>
        public static void UploadRoom(
            Document doc,
            Room room)
        {
            BoundingBoxXYZ bb = room.get_BoundingBox( null );

              if( null == bb )
              {
            Util.ErrorMsg( string.Format( "Skipping room {0} "
              + "because it has no bounding box.",
              Util.ElementDescription( room ) ) );

            return;
              }

              JtLoops roomLoops = GetRoomLoops( room );

              ListLoops( room, roomLoops );

              List<Element> furniture
            = GetFurniture( room );

              // Map symbol UniqueId to symbol loop

              Dictionary<string, JtLoop> furnitureLoops
            = new Dictionary<string, JtLoop>();

              // List of instances referring to symbols

              List<JtPlacement2dInt> furnitureInstances
            = new List<JtPlacement2dInt>(
              furniture.Count );

              int nFailures;

              foreach( FamilyInstance f in furniture )
              {
            FamilySymbol s = f.Symbol;

            string uid = s.UniqueId;

            if( !furnitureLoops.ContainsKey( uid ) )
            {
              nFailures = 0;

              JtLoops loops = GetPlanViewBoundaryLoops(
            f, ref nFailures );

              if( 0 < nFailures )
              {
            Debug.Print( "{0}: {1}",
              Util.ElementDescription( f ),
              Util.PluralString( nFailures,
                "extrusion analyser failure" ) );
              }
              ListLoops( f, loops );

              if( 0 < loops.Count )
              {
            // Assume first loop is outer one

            furnitureLoops.Add( uid, loops[0] );
              }
            }
            furnitureInstances.Add(
              new JtPlacement2dInt( f ) );
              }
              IWin32Window revit_window
            = new JtWindowHandle(
              ComponentManager.ApplicationWindow );

              string caption = doc.Title
            + " : " + doc.GetElement( room.LevelId ).Name
            + " : " + room.Name;

              Bitmap bmp = GeoSnoop.DisplayRoom( roomLoops,
            furnitureLoops, furnitureInstances );

              GeoSnoop.DisplayImageInForm( revit_window,
            caption, false, bmp );

              DbUpload.DbUploadRoom( room, furniture,
            roomLoops, furnitureLoops );
        }
开发者ID:jeremytammik,项目名称:RoomEditorApp,代码行数:88,代码来源:CmdUploadRooms.cs

示例4: ListRoomData

        /// <summary>
        /// List some properties of a given room to the
        /// Visual Studio debug output window.
        /// </summary>
        void ListRoomData( Room room )
        {
            SpatialElementBoundaryOptions opt
            = new SpatialElementBoundaryOptions();

              string nr = room.Number;
              string name = room.Name;
              double area = room.Area;

              Location loc = room.Location;
              LocationPoint lp = loc as LocationPoint;
              XYZ p = ( null == lp ) ? XYZ.Zero : lp.Point;

              BoundingBoxXYZ bb = room.get_BoundingBox( null );

              IList<IList<BoundarySegment>> boundary
            = room.GetBoundarySegments( opt );

              int nLoops = boundary.Count;

              int nFirstLoopSegments = 0 < nLoops
            ? boundary[0].Count
            : 0;

              Debug.Print( string.Format(
            "Room nr. '{0}' named '{1}' at {2} with "
            + "bounding box {3} and area {4} sqf has "
            + "{5} loop{6} and {7} segment{8} in first "
            + "loop.",
            nr, name, Util.PointString( p ),
            BoundingBoxString2( bb ), area, nLoops,
            Util.PluralSuffix( nLoops ), nFirstLoopSegments,
            Util.PluralSuffix( nFirstLoopSegments ) ) );
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:38,代码来源:CmdListAllRooms.cs


注:本文中的Room.get_BoundingBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。