Ejemplo n.º 1
0
        /// <summary>
        /// This node will select grids along a model curve element ordered based on the start of the model curve.
        /// This works in the active view. So whatever plan representation your grids have, that is what is used.
        /// </summary>
        /// <param name="modelCurve">Revit model curve to select grids along.</param>
        /// <returns name="orderedGrids">The intersecting grids ordered from beginning to end of the line.</returns>
        public static List <global::Revit.Elements.Grid> IntersectingGridsByModelCurve(global::Revit.Elements.ModelCurve modelCurve)
        {
            ModelCurve mCurve = modelCurve.InternalElement as ModelCurve;

            Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument;

            List <global::Revit.Elements.Grid> intersectingGrids = new List <global::Revit.Elements.Grid>();

            IList <Autodesk.Revit.DB.Element> grids = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Grids).WhereElementIsNotElementType().ToElements();

            foreach (var grid in grids)
            {
                Grid  g  = grid as Grid;
                Curve c  = g.GetCurvesInView(DatumExtentType.ViewSpecific, doc.ActiveView).First();
                Curve c2 = mCurve.GeometryCurve;

                Point pt1 = Point.ByCoordinates(0, 0, c.GetEndPoint(0).Z);
                Point pt2 = Point.ByCoordinates(0, 0, c2.GetEndPoint(0).Z);
                XYZ   vec = Vector.ByTwoPoints(pt2, pt1).ToRevitType();

                var transformed = c2.CreateTransformed(Transform.CreateTranslation(vec));

                SetComparisonResult test = c.Intersect(transformed);

                if (test == SetComparisonResult.Overlap ||
                    test == SetComparisonResult.Subset ||
                    test == SetComparisonResult.Superset ||
                    test == SetComparisonResult.Equal)
                {
                    intersectingGrids.Add(g.ToDSType(true) as global::Revit.Elements.Grid);
                }
            }

            return(intersectingGrids.OrderBy(g => g.Curve.DistanceTo(modelCurve.Curve.StartPoint)).ToList());
        }
Ejemplo n.º 2
0
        public GridLine GridLineToSpeckle(DB.Grid revitGridLine)
        {
            var speckleGridline = new GridLine();

            speckleGridline.baseLine = CurveToSpeckle(revitGridLine.Curve);
            speckleGridline.label    = revitGridLine.Name;

            //speckleGridline.elementId = revitCurve.Id.ToString(); this would need a RevitGridLine element
            speckleGridline.applicationId = revitGridLine.UniqueId;
            speckleGridline.units         = ModelUnits;
            return(speckleGridline);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Private constructor that creates a new Element every time
        /// </summary>
        /// <param name="arc"></param>
        private Grid(Autodesk.Revit.DB.Arc arc)
        {
            // Changing the underlying curve requires destroying the Grid
            TransactionManager.Instance.EnsureInTransaction(Document);

            Autodesk.Revit.DB.Grid g = Document.Create.NewGrid(arc);
            InternalSetGrid(g);

            TransactionManager.Instance.TransactionTaskDone();

            ElementBinder.CleanupAndSetElementForTrace(Document, this.InternalElement);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Wrap an existing Element in the associated DS type
        /// </summary>
        /// <param name="grid"></param>
        /// <param name="isRevitOwned"></param>
        /// <returns></returns>
        internal static Grid FromExisting(Autodesk.Revit.DB.Grid grid, bool isRevitOwned)
        {
            if (grid == null)
            {
                throw new ArgumentNullException("grid");
            }

            return(new Grid(grid)
            {
                IsRevitOwned = isRevitOwned
            });
        }
Ejemplo n.º 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Hide();
            //List<Reference> rfs= Singleton.Instance.RevitData.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element, new GridSelectionFilter())
            //    as List<Reference>;
            //List<Autodesk.Revit.DB.Grid> grids = rfs.Select(x => Singleton.Instance.RevitData.Document.GetElement(x) as Autodesk.Revit.DB.Grid).ToList();
            Reference gridref = Singleton.Instance.RevitData.Selection.PickObject(ObjectType.Element, new GridSelectionFilter());

            grid = Singleton.Instance.RevitData.Document.GetElement(gridref) as Autodesk.Revit.DB.Grid;
            //grids.ForEach(x => Singleton.Instance.WPFData.Grids.Add(x));
            Singleton.Instance.WPFData.Grids.Add(grid);

            Reference gridref1 = Singleton.Instance.RevitData.Selection.PickObject(ObjectType.Element, new GridSelectionFilter());

            grid1 = Singleton.Instance.RevitData.Document.GetElement(gridref1) as Autodesk.Revit.DB.Grid;
            Singleton.Instance.WPFData.Grids.Add(grid1);
            ShowDialog();
        }
Ejemplo n.º 6
0
 public bool CanConvertToSpeckle(object @object)
 {
     return(@object
            switch
     {
         DB.DetailCurve _ => true,
         DB.DirectShape _ => true,
         DB.FamilyInstance _ => true,
         DB.Floor _ => true,
         DB.Level _ => true,
         DB.View _ => true,
         DB.ModelCurve _ => true,
         DB.Opening _ => true,
         DB.RoofBase _ => true,
         DB.Area _ => true,
         DB.Architecture.Room _ => true,
         DB.Architecture.TopographySurface _ => true,
         DB.Wall _ => true,
         DB.Mechanical.Duct _ => true,
         DB.Mechanical.Space _ => true,
         DB.Plumbing.Pipe _ => true,
         DB.Electrical.Wire _ => true,
         DB.CurtainGridLine _ => true, //these should be handled by curtain walls
         DB.Architecture.BuildingPad _ => true,
         DB.Architecture.Stairs _ => true,
         DB.Architecture.StairsRun _ => true,
         DB.Architecture.StairsLanding _ => true,
         DB.Architecture.Railing _ => true,
         DB.Architecture.TopRail _ => true,
         DB.Ceiling _ => true,
         DB.PointCloudInstance _ => true,
         DB.Group _ => true,
         DB.ProjectInfo _ => true,
         DB.ElementType _ => true,
         DB.Grid _ => true,
         DB.ReferencePoint _ => true,
         DB.Structure.AnalyticalModelStick _ => true,
         DB.Structure.AnalyticalModelSurface _ => true,
         DB.Structure.BoundaryConditions _ => true,
         _ => (@object as Element).IsElementSupported()
     });
Ejemplo n.º 7
0
        /// <summary>
        /// Create parallel grids (horizontal or vertical)
        /// </summary>
        /// <param name="basePoint">Top left base point</param>
        /// <param name="spaces">space distances between grids</param>
        /// <param name="startName">Name of the first grid</param>
        /// <param name="isHorizontal">whether this is horizontal or not</param>
        private void createGrids(XYZ basePoint, List <double> spaces, string startName, bool isHorizontal)
        {
            Document doc = _revitApp.ActiveUIDocument.Document;
            double   gridLength = 30, extLength = 3; // Unit: feet

            using (Transaction t = new Transaction(doc, "Create Grids"))
            {
                t.Start();
                XYZ offsetDir  = isHorizontal ? XYZ.BasisY.Multiply(-1) : XYZ.BasisX;
                XYZ startPoint = isHorizontal ? basePoint.Add(XYZ.BasisX.Multiply(-extLength)) : basePoint.Add(XYZ.BasisY.Multiply(extLength));
                XYZ endPoint   = isHorizontal ? startPoint.Add(XYZ.BasisX.Multiply(gridLength)) : startPoint.Add(XYZ.BasisY.Multiply(-gridLength));
                Autodesk.Revit.DB.Line geoLine = Autodesk.Revit.DB.Line.CreateBound(startPoint, endPoint);
                Autodesk.Revit.DB.Grid grid    = Autodesk.Revit.DB.Grid.Create(doc, geoLine);
                grid.Name = startName;
                foreach (double space in spaces)
                {
                    startPoint = startPoint.Add(offsetDir.Multiply(space));
                    endPoint   = endPoint.Add(offsetDir.Multiply(space));
                    geoLine    = Autodesk.Revit.DB.Line.CreateBound(startPoint, endPoint);
                    Autodesk.Revit.DB.Grid.Create(doc, geoLine);
                }
                t.Commit();
            }
        }
Ejemplo n.º 8
0
 public static Grid Wrap(Autodesk.Revit.DB.Grid ele, bool isRevitOwned)
 {
     return(Grid.FromExisting(ele, isRevitOwned));
 }
Ejemplo n.º 9
0
        private void OK(object sender, RoutedEventArgs e)
        {
            if (txtround.Text == "")
            {
                TaskDialog.Show("ERROR", " Please Enter The Round Value");
                return;
            }
            if (Frame.IsChecked == false && Walls.IsChecked == false && Column.IsChecked == false)
            {
                TaskDialog.Show("ERROR", " Please Select Element Types");
                return;
            }

            Hide();
            Document doc = Singleton.Instance.RevitData.Document;

            Reference gridrefX = Singleton.Instance.RevitData.Selection.PickObject(ObjectType.Element, new GridSelectionFilter(), "Select The First Grid");

            Autodesk.Revit.DB.Grid gridX = doc.GetElement(gridrefX) as Autodesk.Revit.DB.Grid;
            Reference gridrefY           = Singleton.Instance.RevitData.Selection.PickObject(ObjectType.Element, new GridSelectionFilter(), "Select The Second Grid");

            Autodesk.Revit.DB.Grid gridY = doc.GetElement(gridrefY) as Autodesk.Revit.DB.Grid;

            switch (th)
            {
            case th1:
            {
                List <Reference> elemreflist = Singleton.Instance.RevitData.Selection.PickObjects(ObjectType.Element, new BeamSelectionFilter(), "Select Beams") as List <Reference>;
                List <Element>   elemlist    = elemreflist.Select(x => Singleton.Instance.RevitData.Document.GetElement(x) as Autodesk.Revit.DB.Element).ToList();
                elemlist.ForEach(x => Singleton.Instance.WPFData.Elements.Add(x));
                using (Transaction transactionbeam = new Transaction(doc))
                {
                    transactionbeam.Start("Beam Moving");
                    foreach (Element elem in elemlist)
                    {
                        LocationCurve          elemcurve = elem.Location as LocationCurve;
                        Autodesk.Revit.DB.Line elemline  = elemcurve.Curve as Autodesk.Revit.DB.Line;
                        Autodesk.Revit.DB.Line gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                        Autodesk.Revit.DB.Line gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;

                        //Kiểm tra và đặt tên Grid, GridX song song với Location.Curve - Line, Grid Y vuông góc,...

                        if (Geometry.GeomUtil.IsSameOrOppositeDirection(elemline.Direction, gridlineY.Direction))
                        {
                            gridX     = doc.GetElement(gridrefY) as Autodesk.Revit.DB.Grid;
                            gridY     = doc.GetElement(gridrefX) as Autodesk.Revit.DB.Grid;
                            gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                            gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;
                        }
                        double movedis = Command.GetMoveDistance(elemline, gridX, roundto);
                        // Move dầm phương song song
                        if (movedis > precision)
                        {
                            XYZ movevector1 = new XYZ(-elemline.Direction.Y, elemline.Direction.X, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);
                            elem.Location.Move(movevector1);
                            if (Math.Abs(Command.GetMoveDistance(elemline, gridX, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemline, gridX, roundto) % roundto) < roundto - precision)
                            {
                                elem.Location.Move(-2 * movevector1);
                            }
                        }
                        movedis = Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto);
                        if (movedis >= precision)
                        {
                            XYZ movevector2 = new XYZ(elemline.Direction.X, elemline.Direction.Y, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);
                            elem.Location.Move(movevector2);
                            if (Math.Abs(Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) < (roundto - precision))
                            {
                                elem.Location.Move(-2 * movevector2);
                            }
                        }
                    }
                    transactionbeam.Commit();
                }

                break;
            }

            case th2:
            {
                List <Reference> elemreflist = Singleton.Instance.RevitData.Selection.PickObjects(ObjectType.Element, new StructuralColumnFilter(), "Select Columns") as List <Reference>;
                List <Element>   elemlist    = elemreflist.Select(x => Singleton.Instance.RevitData.Document.GetElement(x) as Autodesk.Revit.DB.Element).ToList();
                elemlist.ForEach(x => Singleton.Instance.WPFData.Elements.Add(x));
                using (Transaction transactioncolumn = new Transaction(doc))
                {
                    transactioncolumn.Start("Column Moving ");
                    foreach (Element elem in elemlist)
                    {
                        LocationPoint elemcurve = elem.Location as LocationPoint;

                        Autodesk.Revit.DB.Line gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                        Autodesk.Revit.DB.Line gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;


                        double movedis = Command.GetMoveDistance(elemcurve.Point, gridX, roundto);
                        if (movedis > precision)
                        {
                            XYZ movevector1 = new XYZ(-gridlineX.Direction.Y, gridlineX.Direction.X, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);

                            elem.Location.Move(movevector1);

                            if (Math.Abs(Command.GetMoveDistance(elemcurve.Point, gridX, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemcurve.Point, gridX, roundto) % roundto) < roundto - precision)
                            {
                                elem.Location.Move(-2 * movevector1);
                            }
                        }
                        movedis = Command.GetMoveDistance(elemcurve.Point, gridY, roundto);
                        if (movedis >= precision)
                        {
                            XYZ movevector2 = new XYZ(-gridlineY.Direction.Y, gridlineY.Direction.X, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);

                            //TaskDialog.Show("asas", Command.GetMoveDistance(elemcurve.Point, gridY, roundto).ToString());
                            elem.Location.Move(movevector2);
                            //TaskDialog.Show("asas", Command.GetMoveDistance(elemcurve.Point, gridY, roundto).ToString());
                            if (Math.Abs(Command.GetMoveDistance(elemcurve.Point, gridY, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemcurve.Point, gridY, roundto) % roundto) < (roundto - precision))
                            {
                                elem.Location.Move(-2 * movevector2);
                            }
                        }
                    }
                    transactioncolumn.Commit();
                }

                break;
            }

            case th3:

            {
                List <Reference> elemreflist = Singleton.Instance.RevitData.Selection.PickObjects(ObjectType.Element, new StructuralWallFilter(), "Select Walls") as List <Reference>;
                List <Element>   elemlist    = elemreflist.Select(x => Singleton.Instance.RevitData.Document.GetElement(x) as Autodesk.Revit.DB.Element).ToList();
                elemlist.ForEach(x => Singleton.Instance.WPFData.Elements.Add(x));
                using (Transaction transactionwall = new Transaction(doc))
                {
                    transactionwall.Start("Walls Moving");
                    foreach (Element elem in elemlist)
                    {
                        LocationCurve          elemcurve = elem.Location as LocationCurve;
                        Autodesk.Revit.DB.Line elemline  = elemcurve.Curve as Autodesk.Revit.DB.Line;
                        Autodesk.Revit.DB.Line gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                        Autodesk.Revit.DB.Line gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;
                        if (Geometry.GeomUtil.IsSameOrOppositeDirection(elemline.Direction, gridlineY.Direction))
                        {
                            gridX     = doc.GetElement(gridrefY) as Autodesk.Revit.DB.Grid;
                            gridY     = doc.GetElement(gridrefX) as Autodesk.Revit.DB.Grid;
                            gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                            gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;
                        }
                        double movedis = Command.GetMoveDistance(elemline, gridX, roundto);
                        if (movedis > precision)
                        {
                            XYZ movevector1 = new XYZ(-elemline.Direction.Y, elemline.Direction.X, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);
                            elem.Location.Move(movevector1);
                            if (Math.Abs(Command.GetMoveDistance(elemline, gridX, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemline, gridX, roundto) % roundto) < roundto - precision)
                            {
                                elem.Location.Move(-2 * movevector1);
                            }
                        }
                        movedis = Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto);

                        if (movedis >= precision)
                        {
                            XYZ movevector2 = new XYZ(elemline.Direction.X, elemline.Direction.Y, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);

                            elem.Location.Move(movevector2);
                            if (Math.Abs(Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) > precision && Math.Abs(Command.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) < (roundto - precision))
                            {
                                elem.Location.Move(-2 * movevector2);
                            }
                        }
                    }
                    transactionwall.Commit();
                }

                break;
            }
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Set the internal Element, ElementId, and UniqueId
 /// </summary>
 /// <param name="grid"></param>
 private void InternalSetGrid(Autodesk.Revit.DB.Grid grid)
 {
     this.InternalGrid      = grid;
     this.InternalElementId = grid.Id;
     this.InternalUniqueId  = grid.UniqueId;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Private constructor for wrapping an existing Element
 /// </summary>
 /// <param name="grid"></param>
 private Grid(Autodesk.Revit.DB.Grid grid)
 {
     InternalSetGrid(grid);
 }
Ejemplo n.º 12
0
 public Grid(DB.Grid grid) : base(grid)
 {
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Set the internal Element, ElementId, and UniqueId
 /// </summary>
 /// <param name="grid"></param>
 private void InternalSetGrid(Autodesk.Revit.DB.Grid grid)
 {
     this.InternalGrid = grid;
     this.InternalElementId = grid.Id;
     this.InternalUniqueId = grid.UniqueId;
 }
Ejemplo n.º 14
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            Hide();
            Document doc = Singleton.Instance.RevitData.Document;

            Autodesk.Revit.DB.Line gridline = grid.Curve as Autodesk.Revit.DB.Line;

            Autodesk.Revit.DB.Line gridline1 = grid1.Curve as Autodesk.Revit.DB.Line;

            Autodesk.Revit.DB.Grid gridX     = grid;
            Autodesk.Revit.DB.Grid gridY     = grid1;
            Autodesk.Revit.DB.Line gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
            Autodesk.Revit.DB.Line gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;

            float        roundto   = float.Parse(txtroundto.Text);
            const double precision = 0.00001;

            foreach (Element emt in elems)
            {
                if (emt is FamilyInstance && emt.Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralColumns)
                {
                    FamilyInstance column          = emt as FamilyInstance;
                    LocationPoint  locationPoint   = column.Location as LocationPoint;
                    XYZ            currentLocation = locationPoint.Point;

                    double distance = GetDistance.Distance(column, grid);
                    double movedis  = (distance - Lamtron.Round(distance, roundto)) / 12 / 25.4;

                    XYZ newLocation = new XYZ(-gridline.Direction.Y * movedis, gridline.Direction.X * movedis, 0);

                    using (Transaction t = new Transaction(doc, "move"))
                    {
                        t.Start("move");
                        ElementTransformUtils.MoveElement(doc, column.Id, newLocation);
                        if (Math.Abs(GetDistance.Distance(column, grid) % roundto) > precision && Math.Abs(GetDistance.Distance(column, grid) % roundto) < (roundto - precision))
                        {
                            XYZ newLocationrepair = new XYZ(2 * gridline.Direction.Y * movedis, -2 * gridline.Direction.X * movedis, 0);
                            ElementTransformUtils.MoveElement(doc, column.Id, newLocationrepair);
                        }
                        t.Commit();
                    }
                    double distance1 = GetDistance.Distance(column, grid1);
                    double movedis1  = (distance1 - Lamtron.Round(distance1, roundto)) / 12 / 25.4;

                    XYZ newLocation1 = new XYZ(-gridline1.Direction.Y * movedis1, gridline1.Direction.X * movedis1, 0);

                    using (Transaction t = new Transaction(doc, "move"))
                    {
                        t.Start("move");
                        ElementTransformUtils.MoveElement(doc, column.Id, newLocation1);
                        if (Math.Abs(GetDistance.Distance(column, grid1) % roundto) > 0.01 && Math.Abs(GetDistance.Distance(column, grid1) % roundto) < 4.99)
                        {
                            XYZ newLocationrepair1 = new XYZ(2 * gridline1.Direction.Y * movedis1, -2 * gridline1.Direction.X * movedis1, 0);
                            ElementTransformUtils.MoveElement(doc, column.Id, newLocationrepair1);
                        }
                        t.Commit();
                    }
                }
                if (emt is FamilyInstance && emt.Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFraming)
                {
                    FamilyInstance         elem      = emt as FamilyInstance;
                    LocationCurve          elemcurve = elem.Location as LocationCurve;
                    Autodesk.Revit.DB.Line elemline  = elemcurve.Curve as Autodesk.Revit.DB.Line;


                    //Kiểm tra và đặt tên Grid, GridX song song với Location.Curve - Line, Grid Y vuông góc,...

                    if (Geometry.GeomUtil.IsSameOrOppositeDirection(elemline.Direction, gridlineY.Direction))
                    {
                        gridX     = grid1;
                        gridY     = grid;
                        gridlineX = gridX.Curve as Autodesk.Revit.DB.Line;
                        gridlineY = gridY.Curve as Autodesk.Revit.DB.Line;
                    }
                    double distance = GetDistance.GetMoveDistance(elemline, gridX, roundto);
                    double movedis  = Math.Abs(distance - Lamtron.Round(distance, roundto));
                    // Move dầm phương song song
                    if (movedis > precision)
                    {
                        XYZ movevector1 = new XYZ(-elemline.Direction.Y, elemline.Direction.X, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);

                        using (Transaction transactionX = new Transaction(Singleton.Instance.RevitData.Document))
                        {
                            transactionX.Start("Beam Moving X");
                            elem.Location.Move(movevector1);
                            if (Math.Abs(GetDistance.GetMoveDistance(elemline, gridX, roundto) % roundto) > precision && Math.Abs(GetDistance.GetMoveDistance(elemline, gridX, roundto) % roundto) < roundto - precision)
                            {
                                elem.Location.Move(-2 * movevector1);
                            }
                            transactionX.Commit();
                        }
                    }
                    distance = GetDistance.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto);
                    movedis  = Math.Abs(distance - Lamtron.Round(distance, roundto));
                    // Move dầm phương vuông góc
                    if (movedis >= precision)
                    {
                        XYZ movevector2 = new XYZ(elemline.Direction.X, elemline.Direction.Y, 0).Normalize() * Geometry.GeomUtil.milimeter2Feet(movedis);
                        using (Transaction transactionY = new Transaction(Singleton.Instance.RevitData.Document))
                        {
                            transactionY.Start("Beam moving Y");
                            elem.Location.Move(movevector2);
                            if (Math.Abs(GetDistance.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) > precision && Math.Abs(GetDistance.GetMoveDistance(elemline.GetEndPoint(0), gridY, roundto) % roundto) < (roundto - precision))
                            {
                                elem.Location.Move(-2 * movevector2);
                            }
                            transactionY.Commit();
                        }
                    }
                }
            }
        }