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


C# Room.GetBoundarySegments方法代码示例

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


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

示例1: GetRoomLoops

    /// <summary>
    /// Retrieve the room plan view boundary 
    /// polygon loops and convert to 2D integer-based.
    /// For optimisation and consistency reasons, 
    /// convert all coordinates to integer values in
    /// millimetres. Revit precision is limited to 
    /// 1/16 of an inch, which is abaut 1.2 mm, anyway.
    /// </summary>
    static JtLoops GetRoomLoops( Room room )
    {
      SpatialElementBoundaryOptions opt 
        = new SpatialElementBoundaryOptions();

      opt.SpatialElementBoundaryLocation =
        SpatialElementBoundaryLocation.Center; // loops closed
        //SpatialElementBoundaryLocation.Finish; // loops not closed

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

      int nLoops = loops.Count;

      JtLoops jtloops = new JtLoops( nLoops );

      foreach( IList<BoundarySegment> loop in loops )
      {
        int nSegments = loop.Count;

        JtLoop jtloop = new JtLoop( nSegments );

        XYZ p0 = null; // loop start point
        XYZ p; // segment start point
        XYZ q = null; // segment end point

        foreach( BoundarySegment seg in loop )
        {
          // Todo: handle non-linear curve.
          // Especially: if two long lines have a 
          // short arc in between them, skip the arc
          // and extend both lines.

          p = seg.GetCurve().GetEndPoint( 0 );

          jtloop.Add( new Point2dInt( p ) );

          Debug.Assert( null == q || q.IsAlmostEqualTo( p ),
            "expected last endpoint to equal current start point" );

          q = seg.GetCurve().GetEndPoint( 1 );

          if( _debug_output )
          {
            Debug.Print( "{0} --> {1}",
              Util.PointString( p ),
              Util.PointString( q ) );
          }
          if( null == p0 )
          {
            p0 = p; // save loop start point
          }
        }
        Debug.Assert( q.IsAlmostEqualTo( p0 ),
          "expected last endpoint to equal loop start point" );

        jtloops.Add( jtloop );
      }
      return jtloops;
    }
开发者ID:mtumminello,项目名称:RoomEditorApp,代码行数:68,代码来源:CmdUploadRooms.cs

示例2: Stream

        //TFEND
        private void Stream( ArrayList data, Room room )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( Room ) ) );

              data.Add( new Snoop.Data.String( "Number", room.Number ) );
              data.Add( new Snoop.Data.Double( "Perimeter", room.Perimeter ) );
              data.Add( new Snoop.Data.Double( "Area", room.Area ) );
              data.Add( new Snoop.Data.Double( "Volume", room.Volume ) );
              data.Add( new Snoop.Data.Double( "Base offset", room.BaseOffset ) );
              data.Add( new Snoop.Data.Double( "Limit offset", room.LimitOffset ) );
              data.Add( new Snoop.Data.Enumerable( "Boundary", room.GetBoundarySegments( new SpatialElementBoundaryOptions() ) ) );
              data.Add( new Snoop.Data.Object( "Location", room.Location ) );
              data.Add( new Snoop.Data.Object( "Closed shell", room.ClosedShell ) );
              data.Add( new Snoop.Data.Double( "Unbounded height", room.UnboundedHeight ) );
              data.Add( new Snoop.Data.Object( "Upper limit", room.UpperLimit ) );
        }
开发者ID:huni35,项目名称:RevitLookup,代码行数:17,代码来源:CollectorExtElement.cs

示例3: DetermineAdjacentElementLengthsAndWallAreas

        void DetermineAdjacentElementLengthsAndWallAreas(
            Room room)
        {
            Document doc = room.Document;

              // 'Autodesk.Revit.DB.Architecture.Room.Boundary' is obsolete:
              // use GetBoundarySegments(SpatialElementBoundaryOptions) instead.

              //BoundarySegmentArrayArray boundaries = room.Boundary; // 2011

              IList<IList<BoundarySegment>> boundaries
            = room.GetBoundarySegments(
              new SpatialElementBoundaryOptions() ); // 2012

              // a room may have a null boundary property:

              int n = 0;

              if( null != boundaries )
              {
            //n = boundaries.Size; // 2011
            n = boundaries.Count; // 2012
              }

              Debug.Print(
            "{0} has {1} boundar{2}{3}",
            Util.ElementDescription( room ),
            n, Util.PluralSuffixY( n ),
            Util.DotOrColon( n ) );

              if( 0 < n )
              {
            int iBoundary = 0, iSegment;

            //foreach( BoundarySegmentArray b in boundaries ) // 2011
            foreach( IList<BoundarySegment> b in boundaries ) // 2012
              {
              ++iBoundary;
              iSegment = 0;
              foreach( BoundarySegment s in b )
              {
            ++iSegment;
            Element neighbour = s.Element;
            Curve curve = s.Curve;
            double length = curve.Length;

            Debug.Print(
              "  Neighbour {0}:{1} {2} has {3}"
              + " feet adjacent to room.",
              iBoundary, iSegment,
              Util.ElementDescription( neighbour ),
              Util.RealString( length ) );

            if( neighbour is Wall )
            {
              Wall wall = neighbour as Wall;

              Parameter p = wall.get_Parameter(
                BuiltInParameter.HOST_AREA_COMPUTED );

              double area = p.AsDouble();

              LocationCurve lc
                = wall.Location as LocationCurve;

              double wallLength = lc.Curve.Length;

              //Level bottomLevel = wall.Level; // 2013
              Level bottomLevel =  doc.GetElement( wall.LevelId ) as Level; // 2014
              double bottomElevation = bottomLevel.Elevation;
              double topElevation = bottomElevation;

              p = wall.get_Parameter(
                BuiltInParameter.WALL_HEIGHT_TYPE );

              if( null != p )
              {
                ElementId id = p.AsElementId();
                Level topLevel = doc.GetElement( id ) as Level;
                topElevation = topLevel.Elevation;
              }

              double height = topElevation - bottomElevation;

              Debug.Print(
                "    This wall has a total length,"
                + " height and area of {0} feet,"
                + " {1} feet and {2} square feet.",
                Util.RealString( wallLength ),
                Util.RealString( height ),
                Util.RealString( area ) );
            }
              }
            }
              }
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:96,代码来源:CmdRoomWallAdjacency.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;

              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

示例5: DistinguishRoom

        /// <summary>
        /// Distinguish 'Not Placed',  'Redundant' 
        /// and 'Not Enclosed' rooms.
        /// </summary>
        RoomState DistinguishRoom( Room room )
        {
            RoomState res = RoomState.Unknown;

              if( room.Area > 0 )
              {
            // Placed if having Area

            res = RoomState.Placed;
              }
              else if( null == room.Location )
              {
            // No Area and No Location => Unplaced

            res = RoomState.NotPlaced;
              }
              else
              {
            // must be Redundant or NotEnclosed

            SpatialElementBoundaryOptions opt
              = new SpatialElementBoundaryOptions();

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

            res = ( null == segs || segs.Count == 0 )
              ? RoomState.NotEnclosed
              : RoomState.Redundant;
              }
              return res;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:36,代码来源:CmdListAllRooms.cs

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