コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="referencePlane"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, ReferencePlane referencePlane)
        {
            ReferencePlane referencePlaneClone = app.ActiveUIDocument.Document.Create.NewReferencePlane(referencePlane.BubbleEnd, referencePlane.FreeEnd, referencePlane.Normal, app.ActiveUIDocument.Document.ActiveView); // TBD: ReferencePlane.View dissappeared (jma - 12/05/06)

            Utils.ParamUtil.SetParameters(referencePlaneClone.Parameters, referencePlane.Parameters);
            return(referencePlaneClone);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Level level)
        {
            Level levelClone = Level.Create(app.ActiveUIDocument.Document, level.Elevation);

            Utils.ParamUtil.SetParameters(levelClone.Parameters, level.Parameters);
            return(levelClone);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="modelCurve"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, ModelCurve modelCurve)
        {
            ModelCurve modelCurveClone = app.ActiveUIDocument.Document.Create.NewModelCurve(modelCurve.GeometryCurve, modelCurve.SketchPlane);

            Utils.ParamUtil.SetParameters(modelCurveClone.Parameters, modelCurve.Parameters);
            return(modelCurveClone);
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="viewDrafting"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, ViewDrafting viewDrafting)
        {
            ViewDrafting viewDraftingClone = app.ActiveUIDocument.Document.Create.NewViewDrafting();

            Utils.ParamUtil.SetParameters(viewDraftingClone.Parameters, viewDrafting.Parameters);
            return(viewDraftingClone);
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="floor"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Floor floor)
        {
            //get geometry to figure out location of floor
            Options options = app.Application.Create.NewGeometryOptions();

            options.DetailLevel = ViewDetailLevel.Coarse;
            GeometryElement geomElem = floor.get_Geometry(options);
            Solid           solid    = null;

            foreach (GeometryObject geoObject in geomElem)
            {
                if (geoObject is Solid)
                {
                    solid = geoObject as Solid;
                    break;
                }
            }
            Level      level        = floor.Document.GetElement(floor.LevelId) as Level;
            double     absoluteElev = level.Elevation + floor.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM).AsDouble();
            CurveArray curveArray   = Utils.Geometry.GetProfile(solid, absoluteElev, app.Application);

            Floor floorClone = app.ActiveUIDocument.Document.Create.NewFloor(curveArray, floor.FloorType, level, false);

            Utils.ParamUtil.SetParameters(floorClone.Parameters, floor.Parameters);
            return(floorClone);
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="opening"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Opening opening)
        {
            Opening openingClone = app.ActiveUIDocument.Document.Create.NewOpening(opening.Host, opening.BoundaryCurves, true);

            Utils.ParamUtil.SetParameters(openingClone.Parameters, opening.Parameters);
            return(openingClone);
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="sketchPlane"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, SketchPlane sketchPlane)
        {
            SketchPlane sketchPlaneClone = SketchPlane.Create(app.ActiveUIDocument.Document, sketchPlane.GetPlane());

            Utils.ParamUtil.SetParameters(sketchPlaneClone.Parameters, sketchPlane.Parameters);
            return(sketchPlaneClone);
        }
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Group group)
        {
            IList <ElementId> elemList   = group.GetMemberIds();
            Group             groupClone = app.ActiveUIDocument.Document.Create.NewGroup(elemList);

            Utils.ParamUtil.SetParameters(groupClone.Parameters, group.Parameters);
            return(groupClone);
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="view3D"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, View3D view3D)
        {
            XYZ    viewDir     = view3D.ViewDirection;
            View3D view3DClone = View3D.CreateIsometric(app.ActiveUIDocument.Document, view3D.GetTypeId());

            Utils.ParamUtil.SetParameters(view3DClone.Parameters, view3D.Parameters);
            return(view3DClone);
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="viewDrafting"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, ViewDrafting viewDrafting)
        {
            //ViewDrafting viewDraftingClone = app.ActiveUIDocument.Document.Create.NewViewDrafting(); // 2015, jeremy: 'Autodesk.Revit.Creation.Document.NewViewDrafting()' is obsolete: 'This method is obsolete in Revit 2015.  Use ViewDrafting.Create() instead.'
            ViewDrafting viewDraftingClone = ViewDrafting.Create(app.ActiveUIDocument.Document, viewDrafting.GetTypeId()); // 2016, jeremy

            Utils.ParamUtil.SetParameters(viewDraftingClone.Parameters, viewDrafting.Parameters);
            return(viewDraftingClone);
        }
コード例 #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="roomTag"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Autodesk.Revit.DB.Architecture.RoomTag roomTag)
        {
            Revit.LocationPoint locationPoint = roomTag.Location as Revit.LocationPoint;
            UV      point        = new UV(locationPoint.Point.X, locationPoint.Point.Y);
            RoomTag roomTagClone = null;//app.ActiveUIDocument.Document.Create.NewRoomTag(roomTag.Room, ref point, );

            Utils.ParamUtil.SetParameters(roomTagClone.Parameters, roomTag.Parameters);
            return(roomTagClone);
        }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="wall"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Wall wall)
        {
            Revit.LocationCurve locCurve = wall.Location as Revit.LocationCurve;
            bool isStructural            = (wall.StructuralUsage == StructuralWallUsage.NonBearing) ? false : true;
            Wall wallClone = Wall.Create(app.ActiveUIDocument.Document, locCurve.Curve, wall.LevelId, isStructural);

            Utils.ParamUtil.SetParameters(wallClone.Parameters, wall.Parameters);
            return(wallClone);
        }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="room"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Autodesk.Revit.DB.Architecture.Room room)
        {
            Revit.LocationPoint locationPoint = room.Location as Revit.LocationPoint;
            UV point = new UV(locationPoint.Point.X, locationPoint.Point.Y);

            Room roomClone = app.ActiveUIDocument.Document.Create.NewRoom((Level)room.Document.GetElement(room.LevelId), point);

            Utils.ParamUtil.SetParameters(roomClone.Parameters, room.Parameters);
            return(roomClone);
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="dimension"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Dimension dimension)
        {
            XYZ       startPt        = dimension.Curve.GetEndPoint(0);
            XYZ       endPt          = dimension.Curve.GetEndPoint(1);
            Line      line           = Line.CreateBound(startPt, endPt);
            Dimension dimensionClone = app.ActiveUIDocument.Document.Create.NewDimension(dimension.View, line, dimension.References);

            Utils.ParamUtil.SetParameters(dimensionClone.Parameters, dimension.Parameters);
            return(dimensionClone);
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="beamSystem"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, BeamSystem beamSystem)
        {
            List <Curve> profile = new List <Curve>();

            foreach (Curve curve in beamSystem.Profile)
            {
                profile.Add(curve);
            }
            BeamSystem beamSystemClone = BeamSystem.Create(app.ActiveUIDocument.Document, profile, beamSystem.Level, 0, false);

            Utils.ParamUtil.SetParameters(beamSystemClone.Parameters, beamSystem.Parameters);
            return(beamSystemClone);
        }
コード例 #16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="app"></param>
 public Tower(Autodesk.Revit.UI.UIApplication app)
 {
     m_app    = app;
     m_origin = XYZ.Zero;
     m_baseSquareHalfLength = 40.0;
     m_topCircleRadius      = 25.0;
     m_buildingHeight       = 500.0;
     m_buildingType         = BuildingType.SharpCorner;
     m_unfoldOriginPoint    = new XYZ(6.0 * m_baseSquareHalfLength, 0, 0);
     m_verticalDivisionList = new List <double>(new double[] { 50.0, 47.5, 45.0, 42.5, 40.0, 37.5, 35.0, 32.5, 30.0, 27.5, 25.0, 22.5, 20.0, 17.5, 15.0, 12.5 });
     m_verticalDivisions    = 12;
     m_structuralDivisions  = 9;
 }
コード例 #17
0
ファイル: Tower.cs プロジェクト: 15921050052/RevitLookup
 /// <summary>
 /// 
 /// </summary>
 /// <param name="app"></param>
 public Tower(Autodesk.Revit.UI.UIApplication app)
 {
     m_app = app;
     m_origin = XYZ.Zero;
     m_baseSquareHalfLength = 40.0;
     m_topCircleRadius = 25.0;
     m_buildingHeight = 500.0;
     m_buildingType = BuildingType.SharpCorner;
     m_unfoldOriginPoint = new XYZ(6.0 * m_baseSquareHalfLength, 0, 0);
     m_verticalDivisionList = new List<double>(new double[] { 50.0, 47.5, 45.0, 42.5, 40.0, 37.5, 35.0, 32.5, 30.0, 27.5, 25.0, 22.5, 20.0, 17.5, 15.0, 12.5 });
     m_verticalDivisions = 12;
     m_structuralDivisions = 9;
 }
コード例 #18
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="grid"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, Grid grid)
        {
            Grid  gridClone = null;
            Curve curve     = grid.Curve;

            Line line = grid.Curve as Line;

            if (line != null)
            {
                gridClone = Grid.Create(app.ActiveUIDocument.Document, line);
            }

            Arc arc = grid.Curve as Arc;

            if (arc != null)
            {
                gridClone = Grid.Create(app.ActiveUIDocument.Document, arc);
            }
            //Utils.ParamUtil.SetParameters(gridClone.Parameters, grid.Parameters);
            return(gridClone);
        }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="app"></param>
        /// <param name="familyInstance"></param>
        /// <returns></returns>
        private static Revit.Element CloneElement(Autodesk.Revit.UI.UIApplication app, FamilyInstance familyInstance)
        {
            XYZ location = new XYZ();

            // special case for something like a beam system which has a curve
            Revit.LocationCurve locationCurve = familyInstance.Location as Revit.LocationCurve;
            if (locationCurve != null)
            {
                location = locationCurve.Curve.GetEndPoint(0);
            }
            Revit.LocationPoint locationPoint = familyInstance.Location as Revit.LocationPoint;
            if (locationPoint != null)
            {
                location = locationPoint.Point;
            }

            FamilyInstance familyInstanceClone = app.ActiveUIDocument.Document.Create.NewFamilyInstance(location, familyInstance.Symbol, familyInstance.StructuralType);

            Utils.ParamUtil.SetParameters(familyInstanceClone.Parameters, familyInstance.Parameters);
            return(familyInstanceClone);
        }