예제 #1
0
        private void dlg_OpenLandXMLFile(object sender, CancelEventArgs e)
        {
            var dlg = sender as OpenFileDialog;

            if (dlg != null)
            {
                string fullPath = dlg.FileName;
                _filePath = fullPath.Substring(0, fullPath.LastIndexOf('\\'));

                FileInfo file = new FileInfo(dlg.FileName);

                if (!file.Exists) // file does not exist; do nothing
                {
                    return;
                }

                try
                {
                    Loader load = new Loader();
                    _data = load.Load(file.FullName);
                }
                catch (Exception exception)
                {
                    Console.WriteLine($"{file}-{exception.InnerException.Message}");
                }
            }
        }
예제 #2
0
        public Corridor(LandXML data)
        {
            aligment = data.Alignments.Alignment[0];

            double X = 0;
            double Y = 0;

            double sta = 20;

            XYCoordInStation(sta, ref X, ref Y);
        }
예제 #3
0
        public static LandXML Deserialize(string path)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlSerializer serializer = new XmlSerializer(typeof(LandXML));
            StreamReader  reader     = new StreamReader(path);
            LandXML       Schema     = (LandXML)serializer.Deserialize(reader);

            reader.Close();
            return(Schema);
        }
예제 #4
0
        private static List <RevitPlacmenElement> ExtractPointPlacment(LandXML Landx)
        {
            List <RevitPlacmenElement> RevitPlacementPoints = new List <RevitPlacmenElement>();

            foreach (Alignments Alignments in Landx.Items.OfType <Alignments>())
            {
                foreach (var Alignment in Alignments.Alignment)
                {
                    //stationing
                    List <double> Stations = CreateStationing(ObjectPlacement.TransForm.DistanceBetweenStations, Alignment);
                    List <LandXmlStationingObject> LandXmlAlignmentObjects = ExtractStationingObjects(Alignment, Stations);


                    LandxmlHeighElements = ExtractHeightElemenets(Alignment);
                    //Placment
                    ExtractPlacementPoints(Alignment, RevitPlacementPoints, Stations, LandXmlAlignmentObjects);
                }
            }

            return(RevitPlacementPoints);
        }
예제 #5
0
        private void RunProgram(List <TextObjects> TextObjectFromLandXml, List <XYZ> HeighPoints, string LandXmlPath)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(LandXmlPath);
            LandXML Landx = Deserialize(LandXmlPath);

            foreach (Alignments Alignments in Landx.Items.OfType <Alignments>())
            {
                foreach (var Alignment in Alignments.Alignment)
                {
                    var StationStart = Alignment.staStart;

                    var StationText = StationStart;

                    foreach (CoordGeom CoordGeom in Alignment.Items.OfType <CoordGeom>())
                    {
                        foreach (object LineItem in CoordGeom.Items)
                        {
                            if (LineItem is Line)
                            {
                                StationStart = ExtractLandXmlLine(TextObjectFromLandXml, StationStart, (LineItem as Line));
                            }
                            if (LineItem is Curve)
                            {
                                StationStart = ExtractLandXmlCurve(TextObjectFromLandXml, StationStart, LineItem as Curve);
                            }
                        }
                    }

                    ExtractHeightsFromLandXml(Alignment, HeighPoints);

                    ExtractHeightsFromProfile(TextObjectFromLandXml, HeighPoints);
                }
            }
        }
예제 #6
0
        internal static List <RevitPlacmenElement> ParseLandXml(string LandXmlPath)
        {
            LandXML Landx = Deserialize(LandXmlPath);

            return(ExtractPointPlacment(Landx));
        }