public Wall DeteleAllGrids(Document doc, Wall curtainWall)
        {
            CurtainGrid grid = curtainWall.CurtainGrid;

            ICollection <ElementId> horizGrids = grid.GetUGridLineIds();
            ICollection <ElementId> vertGrids  = grid.GetVGridLineIds();

            foreach (ElementId eIdH in horizGrids)
            {
                Debug("Horiz Grid ID " + eIdH);
                CurtainGridLine cglH             = (CurtainGridLine)doc.GetElement(eIdH);
                Parameter       typeAssociationH = cglH.GetParameters("Type Association").FirstOrDefault();
                Debug($"Horiz Type Association {typeAssociationH?.AsValueString()}");
                Debug("Horiz Lock " + cglH.Lock);

                if (typeAssociationH?.AsInteger() == 1)
                {
                    typeAssociationH.Set(0);
                    Debug("Horiz Type Association Reset " + (typeAssociationH?.AsValueString() ?? "null"));
                    Debug("Horiz Type Association Element Id " + typeAssociationH.AsElementId());
                }

                if (cglH.Lock)
                {
                    cglH.Lock = false;
                    Debug("Horiz Lock Reset " + cglH.Lock);
                }

                doc.Delete(eIdH);
            }

            //deletes all vert grids
            foreach (ElementId eIdV in vertGrids)
            {
                Debug("Vert Grid ID " + eIdV);
                CurtainGridLine cglV             = (CurtainGridLine)doc.GetElement(eIdV);
                Parameter       typeAssociationV = cglV.GetParameters("Type Association").FirstOrDefault();
                Debug("Vert Type Association " + (typeAssociationV?.AsValueString() ?? "null"));
                Debug("Vert Lock " + cglV.Lock);

                if (typeAssociationV?.AsInteger() == 1)
                {
                    typeAssociationV.Set(0);
                    Debug("Vert Type Association Reset " + (typeAssociationV?.AsValueString() ?? "null"));
                    Debug("Vert Type Association Element Id " + typeAssociationV.AsElementId());
                }

                if (cglV.Lock)
                {
                    cglV.Lock = false;
                    Debug("Vert Lock Reset " + cglV.Lock);
                }

                doc.Delete(eIdV);
            }

            return(curtainWall);
        }
Exemple #2
0
 /// <summary>
 /// get the grid line to be removed
 /// </summary>
 /// <returns>
 /// if the line obtained, return true; otherwise false
 /// </returns>
 public bool GetLineToBeMoved()
 {
     if (-1 != m_drawing.SelectedUIndex)
     {
         m_lineToBeMoved = m_uGridLines[m_drawing.SelectedUIndex];
         return(true);
     }
     else if (-1 != m_drawing.SelectedVIndex)
     {
         m_lineToBeMoved = m_vGridLines[m_drawing.SelectedVIndex];
         return(true);
     }
     else
     {
         m_lineToBeMoved = null;
         return(false);
     }
 }
        public void RandDeteleVertGrids(Document doc, Wall curtainWall, int probabilityVert, double vertCounterMax)
        {
            CurtainGrid             grid      = curtainWall.CurtainGrid;
            ICollection <ElementId> vertGrids = grid.GetVGridLineIds();
            List <int> removalCounters        = null;

            foreach (ElementId eIdV in vertGrids)
            {
                CurtainGridLine cglV = (CurtainGridLine)doc.GetElement(eIdV);
                Debug("CW Grid ID" + cglV.Id);
                List <Curve> curvesV = cglV.AllSegmentCurves.Cast <Curve>().ToList();

                if (removalCounters == null)
                {
                    removalCounters = curvesV.Select(g => 0).ToList();
                }

                for (int i = 0; i < curvesV.Count; i++)
                {
                    Curve cV         = curvesV[i];
                    int   randNumber = rand.Next(0, 99);

                    if (randNumber < probabilityVert && removalCounters[i] < vertCounterMax)
                    {
                        Debug("removal counters value" + removalCounters[i]);
                        cglV.RemoveSegment(cV);
                        removalCounters[i]++;
                        Debug("Deleted Vert Seg " + i);
                        Debug("Vert randNumber " + randNumber);
                        Debug("curve list length" + curvesV.Count);
                    }

                    else
                    {
                        removalCounters[i] = 0;
                        Debug("Did not delete Vert Seg " + i);
                        Debug("Vert randNumber " + randNumber);
                    }
                }
                Debug("CW Grid ID after" + cglV.Id);
            }
        }
Exemple #4
0
        /// <summary>
        /// get all the V grid lines' data of the curtain grid
        /// </summary>
        private void GetVLines()
        {
            m_vGridLines.Clear();
            Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

            act.Start();
            //ElementSet vLines = m_activeGrid.VGridLines;
            ICollection <ElementId> vLines = m_activeGrid.GetVGridLineIds();

            act.Commit();
            if (0 == vLines.Count)
            {
                return;
            }

            foreach (ElementId e in vLines)
            {
                CurtainGridLine line = m_activeDocument.GetElement(e) as CurtainGridLine;

                m_vGridLines.Add(line);
            }
        }
        public void RandDeteleHorizGrids(Document doc, Wall curtainWall, int porbabilityHoriz, double horizCounterMax)
        {
            CurtainGrid             grid       = curtainWall.CurtainGrid;
            ICollection <ElementId> horizGrids = grid.GetUGridLineIds();
            List <int> removalCounters         = null;

            foreach (ElementId eIdH in horizGrids)
            {
                CurtainGridLine cglH = (CurtainGridLine)doc.GetElement(eIdH);
                Debug("CW Grid ID" + cglH.Id);
                List <Curve> curvesH = cglH.AllSegmentCurves.Cast <Curve>().ToList();

                if (removalCounters == null)
                {
                    removalCounters = curvesH.Select(g => 0).ToList();
                }

                for (int i = 0; i < curvesH.Count; i++)
                {
                    Curve cH         = curvesH[i];
                    int   randNumber = rand.Next(0, 99);

                    if (randNumber < porbabilityHoriz && removalCounters[i] < horizCounterMax)
                    {
                        cglH.RemoveSegment(cH);
                        removalCounters[i]++;
                        Debug("Deleted Horiz Seg " + i);
                        Debug("Horiz randNumber " + randNumber);
                    }
                    else
                    {
                        removalCounters[i] = 0;
                        Debug("Did not delete Horiz Seg " + i);
                        Debug("Horiz randNumber " + randNumber);
                    }
                }
                Debug("CW Grid ID after" + cglH.Id);
            }
        }
Exemple #6
0
        /// <summary>
        /// toggle the selected grid line's Lock status:  if it's locked, unlock it, vice versa
        /// </summary>
        public void LockOrUnlockSelectedGridLine()
        {
            CurtainGridLine line   = null;
            GridLine2D      line2D = new GridLine2D();

            // get the selected grid line
            if (-1 != m_drawing.SelectedUIndex)
            {
                line   = m_uGridLines[m_drawing.SelectedUIndex];
                line2D = m_drawing.UGridLines2D[m_drawing.SelectedUIndex];
            }
            else if (-1 != m_drawing.SelectedVIndex)
            {
                line   = m_vGridLines[m_drawing.SelectedVIndex];
                line2D = m_drawing.VGridLines2D[m_drawing.SelectedVIndex];
            }
            else
            {
                return;
            }

            // lock/unlock the grid line
            if (null != line)
            {
                Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
                act.Start();
                line.Lock = !line.Lock;
                act.Commit();
            }

            // update the mapped line2D's data
            line2D.Locked = line.Lock;

            // clear the intermediate variables and instances
            m_drawing.DrawObject.Clear();
        }
Exemple #7
0
        /// <summary>
        /// get all of the 4 vertexes of the curtain grid
        /// </summary>
        /// <returns></returns>
        private bool GetCurtainGridVertexes()
        {
            // even in "ReloadGeometryData()" method, no need to reload the boundary information
            // (as the boundary of the curtain grid won't be changed in the sample)
            // just need to load it after the curtain wall been created
            if (null != m_GridVertexesXYZ && 0 < m_GridVertexesXYZ.Count)
            {
                return(true);
            }

            // the curtain grid is from "Curtain Wall: Curtain Wall 1" (by default, the "Curtain Wall 1" has no U/V grid lines)
            if (m_uGridLines.Count <= 0 || m_vGridLines.Count <= 0)
            {
                // special handling for "Curtain Wall: Curtain Wall 1"
                // as the "Curtain Wall: Curtain Wall 1" has no U/V grid lines, so we can't compute the boundary from the grid lines
                // as that kind of curtain wall contains only one curtain cell
                // so we compute the boundary from the data of the curtain cell
                // Obtain the geometry information of the curtain wall
                // also works with some curtain grids with only U grid lines or only V grid lines
                Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
                act.Start();
                ICollection <CurtainCell> cells = m_activeGrid.GetCurtainCells();
                act.Commit();
                Autodesk.Revit.DB.XYZ minXYZ = new Autodesk.Revit.DB.XYZ(Double.MaxValue, Double.MaxValue, Double.MaxValue);
                Autodesk.Revit.DB.XYZ maxXYZ = new Autodesk.Revit.DB.XYZ(Double.MinValue, Double.MinValue, Double.MinValue);
                GetVertexesByCells(cells, ref minXYZ, ref maxXYZ);

                // move the U & V lines to the boundary of the curtain grid, and get their end points as the vertexes of the curtain grid
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(minXYZ.X, minXYZ.Y, minXYZ.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(maxXYZ.X, maxXYZ.Y, minXYZ.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(maxXYZ.X, maxXYZ.Y, maxXYZ.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(minXYZ.X, minXYZ.Y, maxXYZ.Z));
                return(true);
            }
            else
            {
                // handling for the other kinds of curtain walls (contains U&V grid lines by default)
                CurtainGridLine uLine = m_uGridLines[0];
                CurtainGridLine vLine = m_vGridLines[0];

                List <Autodesk.Revit.DB.XYZ> points = new List <Autodesk.Revit.DB.XYZ>();

                Autodesk.Revit.DB.XYZ uStartPoint = uLine.FullCurve.GetEndPoint(0);
                Autodesk.Revit.DB.XYZ uEndPoint   = uLine.FullCurve.GetEndPoint(1);

                Autodesk.Revit.DB.XYZ vStartPoint = vLine.FullCurve.GetEndPoint(0);
                Autodesk.Revit.DB.XYZ vEndPoint   = vLine.FullCurve.GetEndPoint(1);

                points.Add(uStartPoint);
                points.Add(uEndPoint);
                points.Add(vStartPoint);
                points.Add(vEndPoint);

                //move the U & V lines to the boundary of the curtain grid, and get their end points as the vertexes of the curtain grid
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(uStartPoint.X, uStartPoint.Y, vStartPoint.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(uEndPoint.X, uEndPoint.Y, vStartPoint.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(uEndPoint.X, uEndPoint.Y, vEndPoint.Z));
                m_GridVertexesXYZ.Add(new Autodesk.Revit.DB.XYZ(uStartPoint.X, uStartPoint.Y, vEndPoint.Z));

                return(true);
            }
        }
Exemple #8
0
        /// <summary>
        /// add all the deleted segments back for a grid line
        /// </summary>
        public void AddAllSegments()
        {
            // verify that the mouse is inside the curtain grid area
            List <KeyValuePair <Line2D, Pen> > lines2D = m_drawing.DrawObject.Lines2D;

            if (lines2D.Count < 1)
            {
                return;
            }

            if (-1 != m_drawing.SelectedUIndex)
            {
                CurtainGridLine line = m_uGridLines[m_drawing.SelectedUIndex];
                if (null != line)
                {
                    try
                    {
                        Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
                        act.Start();
                        line.AddAllSegments();
                        act.Commit();
                    }
                    catch (System.Exception e)
                    {
                        TaskDialog.Show("Exception", e.Message);
                        return;
                    }
                }

                GridLine2D gridLine2D = m_drawing.UGridLines2D[m_drawing.SelectedUIndex];
                gridLine2D.RemovedNumber = 0;
                foreach (SegmentLine2D segLine2D in gridLine2D.Segments)
                {
                    segLine2D.Removed = false;
                }
            }
            else if (-1 != m_drawing.SelectedVIndex)
            {
                CurtainGridLine line = m_vGridLines[m_drawing.SelectedVIndex];
                if (null != line)
                {
                    try
                    {
                        Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
                        act.Start();
                        line.AddAllSegments();
                        act.Commit();
                    }
                    catch (System.Exception e)
                    {
                        TaskDialog.Show("Exception", e.Message);
                        return;
                    }
                }

                GridLine2D gridLine2D = m_drawing.VGridLines2D[m_drawing.SelectedVIndex];
                gridLine2D.RemovedNumber = 0;
                foreach (SegmentLine2D segLine2D in gridLine2D.Segments)
                {
                    segLine2D.Removed = false;
                }
            }

            this.ReloadGeometryData();
            m_drawing.DrawObject.Clear();
        }
Exemple #9
0
        /// <summary>
        /// add a new segment to the specified location
        /// </summary>
        public void AddSegment()
        {
            // verify that the mouse is inside the curtain grid area
            List <KeyValuePair <Line2D, Pen> > lines2D = m_drawing.DrawObject.Lines2D;

            if (lines2D.Count < 1)
            {
                return;
            }

            // the selected segment location is on a U grid line
            if (-1 != m_drawing.SelectedUIndex)
            {
                CurtainGridLine line  = m_uGridLines[m_drawing.SelectedUIndex];
                Curve           curve = line.AllSegmentCurves.get_Item(m_drawing.SelectedUSegmentIndex);
                if (null != line && null != curve)
                {
                    try
                    {
                        Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

                        act.Start();
                        line.AddSegment(curve);
                        act.Commit();
                    }
                    catch (System.Exception e)
                    {
                        TaskDialog.Show("Exception", e.Message);
                        return;
                    }
                }

                GridLine2D gridLine2D = m_drawing.UGridLines2D[m_drawing.SelectedUIndex];
                gridLine2D.RemovedNumber--;
                SegmentLine2D segLine2D = gridLine2D.Segments[m_drawing.SelectedUSegmentIndex];
                segLine2D.Removed = false;
                gridLine2D.Segments[m_drawing.SelectedUSegmentIndex] = segLine2D;
            }
            // the selected segment location is on a V grid line
            else if (-1 != m_drawing.SelectedVIndex)
            {
                CurtainGridLine line  = m_vGridLines[m_drawing.SelectedVIndex];
                Curve           curve = line.AllSegmentCurves.get_Item(m_drawing.SelectedVSegmentIndex);
                if (null != line && null != curve)
                {
                    try
                    {
                        Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
                        act.Start();
                        line.AddSegment(curve);
                        act.Commit();
                    }
                    catch (System.Exception e)
                    {
                        TaskDialog.Show("Exception", e.Message);
                        return;
                    }
                }

                GridLine2D gridLine2D = m_drawing.VGridLines2D[m_drawing.SelectedVIndex];
                gridLine2D.RemovedNumber--;
                SegmentLine2D segLine2D = gridLine2D.Segments[m_drawing.SelectedVSegmentIndex];
                segLine2D.Removed = false;
                gridLine2D.Segments[m_drawing.SelectedVSegmentIndex] = segLine2D;
            }

            this.ReloadGeometryData();
            m_drawing.DrawObject.Clear();
        }
        private void Stream( ArrayList data, CurtainGridLine gridLine )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( CurtainGridLine ) ) );

              data.Add( new Snoop.Data.Enumerable( "All segment curves", gridLine.AllSegmentCurves ) );
              data.Add( new Snoop.Data.Enumerable( "Existing segment curves", gridLine.ExistingSegmentCurves ) );
              data.Add( new Snoop.Data.Enumerable( "Skipped segment curves", gridLine.SkippedSegmentCurves ) );
              data.Add( new Snoop.Data.Object( "Full curve", gridLine.FullCurve ) );
              data.Add( new Snoop.Data.Bool( "Is U grid line", gridLine.IsUGridLine ) );
              data.Add( new Snoop.Data.Bool( "Lock", gridLine.Lock ) );
        }
Exemple #11
0
 /// <summary>
 /// get the grid line to be removed
 /// </summary>
 /// <returns>
 /// if the line obtained, return true; otherwise false
 /// </returns>
 public bool GetLineToBeMoved()
 {
     if (-1 != m_drawing.SelectedUIndex)
      {
     m_lineToBeMoved = m_uGridLines[m_drawing.SelectedUIndex];
     return true;
      }
      else if (-1 != m_drawing.SelectedVIndex)
      {
     m_lineToBeMoved = m_vGridLines[m_drawing.SelectedVIndex];
     return true;
      }
      else
      {
     m_lineToBeMoved = null;
     return false;
      }
 }
Exemple #12
0
        private static List <Face3D> Profiles_CurtainSystem(this CurtainSystem curtainSystem)
        {
            Document document = curtainSystem?.Document;

            if (document == null)
            {
                return(null);
            }

            CurtainGridSet curtainGridSet = curtainSystem?.CurtainGrids;

            if (curtainGridSet == null)
            {
                return(null);
            }

            List <Face3D> result = new List <Face3D>();

            foreach (CurtainGrid curtainGrid in curtainGridSet)
            {
                IEnumerable <CurtainCell> curtainCells = curtainGrid.GetCurtainCells();
                if (curtainCells == null || curtainCells.Count() == 0)
                {
                    continue;
                }

                List <CurveArrArray> curveArrArrays = new List <CurveArrArray>();
                foreach (CurtainCell curtainCell in curtainCells)
                {
                    CurveArrArray curveArrArray = curtainCell?.PlanarizedCurveLoops;
                    if (curveArrArray == null || curveArrArray.Size == 0)
                    {
                        continue;
                    }

                    curveArrArrays.Add(curveArrArray);
                }

                List <Segment3D>      segment3Ds       = new List <Segment3D>();
                List <ISegmentable3D> segmentable3Ds_U = new List <ISegmentable3D>();
                List <ISegmentable3D> segmentable3Ds_V = new List <ISegmentable3D>();

                ICollection <ElementId> elementIds = null;

                elementIds = curtainGrid.GetUGridLineIds();
                if (elementIds != null)
                {
                    foreach (ElementId elementId in elementIds)
                    {
                        CurtainGridLine curtainGridLine = document.GetElement(elementId) as CurtainGridLine;
                        if (curtainGridLine == null)
                        {
                            continue;
                        }

                        ISegmentable3D segmentable3D = curtainGridLine.FullCurve.ToSAM() as ISegmentable3D;
                        if (segmentable3D == null)
                        {
                            continue;
                        }

                        segmentable3Ds_U.Add(segmentable3D);
                        segment3Ds.AddRange(segmentable3D.GetSegments());
                    }
                }

                elementIds = curtainGrid.GetVGridLineIds();
                if (elementIds != null)
                {
                    foreach (ElementId elementId in elementIds)
                    {
                        CurtainGridLine curtainGridLine = document.GetElement(elementId) as CurtainGridLine;
                        if (curtainGridLine == null)
                        {
                            continue;
                        }

                        ISegmentable3D segmentable3D = curtainGridLine.FullCurve.ToSAM() as ISegmentable3D;
                        if (segmentable3D == null)
                        {
                            continue;
                        }

                        segmentable3Ds_V.Add(segmentable3D);
                        segment3Ds.AddRange(segmentable3D.GetSegments());
                    }
                }

                List <ISegmentable3D> segmentable3Ds = null;

                segmentable3Ds = ExtremeSegmentable3Ds(segmentable3Ds_U, segmentable3Ds_V);
                if (segmentable3Ds != null && segmentable3Ds.Count > 0)
                {
                    foreach (ISegmentable3D segmentable3D in segmentable3Ds)
                    {
                        List <Segment3D> segment3Ds_Temp = segmentable3D?.GetSegments();
                        if (segment3Ds_Temp != null && segment3Ds_Temp.Count != 0)
                        {
                            segment3Ds.AddRange(segment3Ds_Temp);
                        }
                    }
                }

                segmentable3Ds = ExtremeSegmentable3Ds(segmentable3Ds_V, segmentable3Ds_U);
                if (segmentable3Ds != null && segmentable3Ds.Count > 0)
                {
                    foreach (ISegmentable3D segmentable3D in segmentable3Ds)
                    {
                        List <Segment3D> segment3Ds_Temp = segmentable3D?.GetSegments();
                        if (segment3Ds_Temp != null && segment3Ds_Temp.Count != 0)
                        {
                            segment3Ds.AddRange(segment3Ds_Temp);
                        }
                    }
                }


                List <List <Face3D> > face3Ds = Enumerable.Repeat <List <Face3D> >(null, curveArrArrays.Count).ToList();
                Parallel.For(0, curveArrArrays.Count, (int i) =>
                {
                    CurveArrArray curveArrArray = curveArrArrays[i];
                    if (curveArrArray == null || curveArrArray.Size == 0)
                    {
                        return;
                    }

                    face3Ds[i] = new List <Face3D>();
                    foreach (CurveArray curveArray in curveArrArray)
                    {
                        Polygon3D polygon3D = curveArray?.ToSAM_Polygon3D();
                        if (polygon3D == null && !polygon3D.IsValid())
                        {
                            continue;
                        }

                        Spatial.Plane plane = polygon3D.GetPlane();
                        if (plane == null)
                        {
                            continue;
                        }

                        Polygon2D polygon2D = plane.Convert(polygon3D);
                        if (polygon2D != null)
                        {
                            List <Segment2D> segment2Ds = segment3Ds.ConvertAll(x => plane.Convert(plane.Project(x)));
                            segment2Ds.RemoveAll(x => x == null || x.GetLength() < Core.Tolerance.MacroDistance);
                            segment2Ds = segment2Ds.Split();

                            List <Polygon2D> polygon2Ds = Planar.Create.Polygon2Ds(segment2Ds);
                            if (polygon2Ds != null)
                            {
                                polygon2Ds = polygon2Ds.FindAll(x => x.Inside(polygon2D));
                                if (polygon2Ds != null && polygon2Ds.Count > 0)
                                {
                                    polygon2Ds.Sort((x, y) => y.GetArea().CompareTo(x.GetArea()));
                                    polygon3D = plane.Convert(polygon2Ds[0]);
                                }
                            }
                        }

                        face3Ds[i].Add(new Face3D(polygon3D));
                    }
                });

                foreach (List <Face3D> face3Ds_Temp in face3Ds)
                {
                    if (face3Ds_Temp != null && face3Ds_Temp.Count > 0)
                    {
                        result.AddRange(face3Ds_Temp);
                    }
                }
            }

            return(result);
        }
Exemple #13
0
        /// <summary>
        /// convert the grid line in CurtainGridLine format to GridLine2D format
        /// in the Canvas area, the "System.Drawing.Point" instances are directly used, it's hard
        /// for us to use CurtainGridLine and Autodesk.Revit.DB.XYZ directly, so convert them to 2D data first
        /// </summary>
        /// <param name="line">
        /// the grid line in CurtainGridLine format 
        /// </param>
        /// <param name="segPaths">
        /// the grid line in GraphicsPath format (the GraphicsPath contains the grid line in GridLine2D format)
        /// </param>
        /// <param name="gridLineIndex">
        /// the index of the grid line
        /// </param>
        /// <returns>
        /// the converted grid line in GridLine2D format
        /// </returns>
        private GridLine2D ConvertToLine2D(CurtainGridLine line, List<GraphicsPath> segPaths, int gridLineIndex)
        {
            Curve curve = line.FullCurve;
             Autodesk.Revit.DB.XYZ point1 = curve.get_EndPoint(0);
             Autodesk.Revit.DB.XYZ point2 = curve.get_EndPoint(1);

             Vector4 v1 = new Vector4(point1);
             Vector4 v2 = new Vector4(point2);

             // transform from 3D point to 2D point
             v1 = m_coordinates.TransformMatrix.Transform(v1);
             v2 = m_coordinates.TransformMatrix.Transform(v2);

             // create a new line in GridLine2D format
             GridLine2D line2D = new GridLine2D();
             line2D.StartPoint = new System.Drawing.Point((int)v1.X, (int)v1.Y);
             line2D.EndPoint = new System.Drawing.Point((int)v2.X, (int)v2.Y);
             line2D.Locked = line.Lock;
             line2D.IsUGridLine = line.IsUGridLine;
             // get which segments are skipped
             List<SegmentLine2D> skippedSegments = ConvertCurveToSegment(line.SkippedSegmentCurves);
             // get all the segments for the curtain grid (and tag the skipped ones out)
             GetSegments(line2D, line.AllSegmentCurves, skippedSegments, segPaths, gridLineIndex);
             return line2D;
        }