コード例 #1
0
        private void MapAndLoad(FileHandle fileHandle, bool readOnly)
        {
            using (Section section = new Section(
                fileHandle,
                false,
                readOnly ? MemoryProtection.ExecuteRead : MemoryProtection.ExecuteReadWrite
                ))
            {
                _size = (int)fileHandle.FileSize;
                _view = section.MapView(_size);

                this.Load(_view);
            }
        }
コード例 #2
0
ファイル: MappedImage.cs プロジェクト: andyvand/ProcessHacker
        private void MapAndLoad(FileHandle fileHandle, bool readOnly)
        {
            using (Section section = new Section(
                fileHandle,
                false,
                readOnly ? MemoryProtection.ExecuteRead : MemoryProtection.ExecuteReadWrite
                ))
            {
                _size = (int)fileHandle.GetSize();
                _view = section.MapView(_size);
                _memory = _view;

                byte* start = (byte*)_memory;

                if (start[0] != 'M' || start[1] != 'Z')
                    throw new Exception("The file is not a valid executable image.");

                _ntHeaders = this.GetNtHeaders();
                _sections = (ImageSectionHeader*)((byte*)&_ntHeaders->OptionalHeader + _ntHeaders->FileHeader.SizeOfOptionalHeader);
                _magic = _ntHeaders->OptionalHeader.Magic;

                if (_magic != Win32.Pe32Magic && _magic != Win32.Pe32PlusMagic)
                    throw new Exception("The file is not a PE32 or PE32+ image.");
            }
        }
コード例 #3
0
 public void ByName_NullArgs()
 {
     Assert.Throws(typeof(ArgumentNullException), () => SectionView.ByBoundingBox(null));
 }
コード例 #4
0
        cmdSections(ObjectId idAlign, double dblOffR, double dblOffL)
        {
            ObjectId idSectionStyleEXIST   = default(ObjectId);
            ObjectId idSectionStyleEXIST90 = default(ObjectId);
            ObjectId idSectionStyleCPNT    = default(ObjectId);
            ObjectId idSectionStyleSG      = default(ObjectId);
            ObjectId idSectionStyleOX      = default(ObjectId);
            ObjectId idSectionStyleOXg     = default(ObjectId);
            ObjectId idSectionStyleBOT     = default(ObjectId);
            ObjectId idSectionStyleMID     = default(ObjectId);

            ObjectIdCollection idsSurface = new ObjectIdCollection();

            bool     exists         = false;
            ObjectId idSurfaceEXIST = Surf.getSurface("EXIST", out exists);

            if (!exists)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Surface EXIST is missing - exiting!");
                return;
            }
            else
            {
                idsSurface.Add(idSurfaceEXIST);
                idSectionStyleEXIST = Sect_Style.getSectionStyleId("EXIST");
            }

            ObjectId idSurfaceEXIST90 = Surf.getSurface("EXIST90", out exists);

            if (!exists)
            {
                //  MsgBox "Surface EXIST is missing - exiting!"
                //  Exit Sub
            }
            else
            {
                idsSurface.Add(idSurfaceEXIST90);
                idSectionStyleEXIST90 = Sect_Style.getSectionStyleId("EXIST90");
            }

            ObjectId idSurfaceCPNT = Surf.getSurface("CPNT-ON", out exists);

            if (!exists)
            {
                //  MsgBox "Surface CPNT-ON is missing - exiting!"
                //  Exit Sub
            }
            else
            {
                idsSurface.Add(idSurfaceCPNT);
                idSectionStyleCPNT = Sect_Style.getSectionStyleId("CPNT");
            }

            ObjectId idSurfaceSG = Surf.getSurface("SG", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceSG);
                idSectionStyleSG = Sect_Style.getSectionStyleId("SG");
            }

            ObjectId idSurfaceOX = Surf.getSurface("OX", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceOX);
                idSectionStyleOX = Sect_Style.getSectionStyleId("OX");
            }

            ObjectId idSurfaceOXg = Surf.getSurface("OXg", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceOXg);
                idSectionStyleOXg = Sect_Style.getSectionStyleId("OXg");
            }

            ObjectId idSurfaceBOT = Surf.getSurface("BOT", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceBOT);
                idSectionStyleBOT = Sect_Style.getSectionStyleId("BOT");
            }

            if (idSectionStyleBOT == ObjectId.Null)
            {
                EW_Utility1.copyEWstyles();
            }

            ObjectId idSurfaceMID = Surf.getSurface("MIDGRADE", out exists);

            if (!exists)
            {
            }
            else
            {
                idsSurface.Add(idSurfaceMID);
                idSectionStyleMID = Sect_Style.getSectionStyleId("EXIST90");
            }

            idAlign.removeSampleLineGroups();
            ObjectId idSLG = idAlign.addSampleLineGroupAndSampleLines("EW");

            idSLG.removeSampledSurfaces();

            idSLG.addSurfaceToSample(idsSurface);

            idAlign.addSections(idSLG, dblOffL, dblOffR);

            ObjectId idGroupPlotStyle             = ObjectId.Null;
            GroupPlotStyleCollection grpPltStyles = BaseObjs._civDoc.Styles.GroupPlotStyles;

            if (!grpPltStyles.Contains("EW"))
            {
                EW_Utility1.copyEWstyles();
                idGroupPlotStyle = BaseObjs._civDoc.Styles.GroupPlotStyles["EW"];
            }

            SampleLineStyleCollection sampleLineStyles = BaseObjs._civDoc.Styles.SampleLineStyles;
            ObjectId idSampleLineStyle = sampleLineStyles["Standard"];

            SectionLabelSetStyleCollection sectionLabelSetStyles = BaseObjs._civDoc.Styles.LabelSetStyles.SectionLabelSetStyles;

            double dblWidth  = 0;
            double dblHeight = 0;

            Autodesk.AutoCAD.DatabaseServices.Table objTable = default(Autodesk.AutoCAD.DatabaseServices.Table);

            SelectionSet objSSet = default(SelectionSet);

            objSSet  = EW_Utility1.buildSSetTable();
            objTable = (Autodesk.AutoCAD.DatabaseServices.Table)objSSet.GetObjectIds()[0].getEnt();

            Point3d varPntIns = objTable.Position;

            dblWidth  = objTable.Width;
            dblHeight = objTable.Height;

            Point3d dblPntBase = new Point3d(varPntIns.X + dblWidth + 600, varPntIns.Y - dblHeight, 0);

            SectionViewStyle objSectionViewStyle = Sect_Style.getSectionViewStyle("EW");

            if (objSectionViewStyle == null)
            {
                EW_Utility1.copyEWstyles();
                objSectionViewStyle = objSectionViewStyle = Sect_Style.getSectionViewStyle("EW");
            }

            SectionViewBandSetStyle objSectionViewBandSetStyle = Sect_Style.getSectionViewBandSetStyle("Standard");

            double dblOffX = 0;
            double dblOffY = 0;

            bool boolFirstPass = false;

            boolFirstPass = true;

            dblOffX = 0;
            dblOffY = 0;

            Point3d dblPntIns = Pub.pnt3dO;

            int j = 0;
            ObjectIdCollection idsSampleLine = idSLG.getSampleLineIDs();

            using (var tr = BaseObjs.startTransactionDb()) {
                for (int i = 0; i < idsSampleLine.Count; i += 5)
                {
                    SampleLine sl = (SampleLine)tr.GetObject(idsSampleLine[i], OpenMode.ForRead);

                    dblPntIns = new Point3d(dblPntBase.X + i / 5 * dblOffX, dblPntBase.Y, 0);
                    int k = -1;

                    while (j < idsSampleLine.Count)
                    {
                        k = k + 1;

                        ObjectId    idSectionView  = SectionView.Create(string.Format("SV-{0}", j), sl.ObjectId, dblPntIns);
                        SectionView objSectionView = (SectionView)tr.GetObject(idSectionView, OpenMode.ForWrite);
                        if (boolFirstPass)
                        {
                            dblOffX       = System.Math.Abs(objSectionView.OffsetLeft) + objSectionView.OffsetRight + 30;
                            boolFirstPass = false;
                        }

                        Extents3d ext3d = (Extents3d)objSectionView.Bounds;

                        dblOffY = ext3d.MaxPoint.Y - ext3d.MinPoint.Y + 30;

                        dblPntIns      = new Point3d(dblPntIns.X, dblPntIns.Y + dblOffY, 0);//increment Y after placing first section in column
                        objSectionView = null;

                        j = j + 1;

                        if (k == 4)
                        {
                            break;
                        }
                    }
                }

                tr.Commit();
            }

            BaseObjs.acadActivate();

            return;
        }
コード例 #5
0
ファイル: Wall_Sections.cs プロジェクト: 15831944/EM
        drawSections()
        {
            Alignment objAlign = default(Alignment);

            try {
                objAlign = fWall1.ACTIVEALIGN;

                if ((objAlign == null))
                {
                    MessageBox.Show("Select Alignment");
                    return;
                }
            }
            catch (System.Exception) {
                MessageBox.Show("Select Alignment");
                return;
            }
            bool exists = false;

            TinSurface objSurfaceEXIST = Surf.getTinSurface("EXIST", out exists);
            TinSurface objSurfaceCPNT  = Surf.getTinSurface("CPNT-ON", out exists);

            //ObjectId objSectionStyleEXISTId = Sect.getSectionStyleId("EXIST");
            //ObjectId objSectionStyleCPNTId = Sect.getSectionStyleId("CPNT");
            //GroupPlotStyle objGroupPlotStyle = Sect.getGroupPlotStyle("WALL");
            //SampleLineStyle objSampleLineStyle = Sect.getSampleLineStyle("Standard");
            //SectionLabelSetStyle objSampleLabelSetStyle = Sect.getSampleLineLabelStyle("Standard");

            double dblLen = objAlign.Length;

            Sect.removeSampleLineGroups(objAlign.ObjectId);

            string strLayer = string.Format("{0}-SEC", objAlign.Name);

            Layer.manageLayers(strLayer);

            ObjectId idSLG = Sect.addSampleLineGroupAndSampleLines(objAlign.ObjectId, "SLG-1");

            idSLG.removeSampledSurfaces();

            ObjectIdCollection idSurfaces = new ObjectIdCollection();

            idSurfaces.Add(objSurfaceCPNT.ObjectId);
            idSurfaces.Add(objSurfaceEXIST.ObjectId);

            idSLG.addSurfaceToSample(idSurfaces);

            Sect.addSections(objAlign.ObjectId, idSLG, 20.0, 20.0);

            SampleLine objSampleLine = default(SampleLine);

            Autodesk.Civil.DatabaseServices.Section objSection = default(Autodesk.Civil.DatabaseServices.Section);

            ObjectIdCollection idsSampleLine = idSLG.getSampleLineIDs();

            using (var tr = BaseObjs.startTransactionDb()) {
                foreach (ObjectId idSampleLine in idsSampleLine)
                {
                    objSampleLine = (SampleLine)tr.GetObject(idSampleLine, OpenMode.ForRead);
                    foreach (ObjectId idSection in objSampleLine.GetSectionIds())
                    {
                        objSection       = (Section)tr.GetObject(idSection, OpenMode.ForWrite);
                        objSection.Layer = strLayer;
                    }
                }
                tr.Commit();
            }

            Autodesk.Civil.DatabaseServices.Styles.SectionViewStyle objSectionViewStyle = default(Autodesk.Civil.DatabaseServices.Styles.SectionViewStyle);

            try {
                objSectionViewStyle = Sect_Style.getSectionViewStyle("WALL");
            }
            catch (System.Exception) {
                objSectionViewStyle = Sect_Style.getSectionViewStyle("Standard");
            }

            SectionViewBandSetStyle objSectionViewBandStyleSet = Sect_Style.getSectionViewBandSetStyle("Standard");

            double dblOffX = 0;
            double dblOffY = 0;

            bool boolFirstPass = true;

            //Dim objStationRange As New StationRange
            //With objStationRange
            //    .UseSampleIncrements = True
            //    .SampleAtHighLowPoints = False
            //    .SampleAtHorizontalGeometryPoints = False
            //    .SampleAtSuperelevationCriticalStations = False
            //    .SampleAtRangeEnd = True
            //    .SampleAtRangeStart = True
            //    .StartRangeAtAlignmentStart = True
            //    .EndRangeAtAlignmentEnd = True
            //    .StartRange = 0.0
            //    .EndRange = dblLen - 1
            //    .IncrementTangent = 50.0
            //    .SwathWidthLeft = 20.0
            //    .SwathWidthRight = 20.0
            //    .SampleLineDefaultDirection = DirectionFromType.DirectionFromBaseAlignment
            //End With

            //objStationRange.SampleLineStyle = objSampleLineStyle

            //objSLG.SampleLines.AddByStationRange("SL-1", SampleLineDuplicateActionType.SampleLineDuplicateActionOverwrite, objStationRange)

            PromptStatus ps        = default(PromptStatus);
            Point3d      pnt3dBase = default(Point3d);

            try {
                BaseObjs.acadActivate();
                pnt3dBase = UserInput.getPoint("Select Insertion Point for Sections", out ps, osMode: 0);
            }
            catch (System.Exception) {
                return;
            }

            SectionView objSectionView = null;
            Point3d     pnt3dIns       = default(Point3d);

            using (var tr1 = BaseObjs.startTransactionDb()) {
                int j = 0;
                for (int i = 0; i < idsSampleLine.Count; i += 5)
                {
                    objSampleLine = (SampleLine)tr1.GetObject(idsSampleLine[i], OpenMode.ForRead);

                    //dblPntIns(0) = pnt3dBase.X + i / 5 * dblOffX

                    int k = -1;

                    while (j < idsSampleLine.Count)
                    {
                        k++;

                        pnt3dIns = new Point3d(pnt3dBase.X + i / 5 * dblOffX, pnt3dBase.Y + k * dblOffY, 0.0);

                        try {
                            ObjectId idSectionView = SectionView.Create("SV" + Convert.ToString(j), idsSampleLine[i], pnt3dIns);
                            objSectionView             = (SectionView)tr1.GetObject(idSectionView, OpenMode.ForWrite);
                            objSectionView.OffsetLeft  = 20.0;
                            objSectionView.OffsetRight = 20.0;
                            objSectionView.StyleId     = objSectionViewStyle.ObjectId;
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception) {
                        }

                        if (boolFirstPass)
                        {
                            dblOffX       = System.Math.Abs(objSectionView.OffsetLeft) + objSectionView.OffsetRight + 30;
                            dblOffY       = (objSectionView.ElevationMax - objSectionView.ElevationMin) + 20;
                            boolFirstPass = false;
                        }

                        j++;

                        if (k == 4)
                        {
                            break;
                        }
                    }
                }

                tr1.Commit();
            }
        }
コード例 #6
0
 public static SectionView Wrap(Autodesk.Revit.DB.ViewSection view, bool isRevitOwned)
 {
     return(SectionView.FromExisting(view, isRevitOwned));
 }
コード例 #7
0
        public static void MillingDepthToProfileView()
        {
            CivilDocument civilDoc = CivilApplication.ActiveDocument;
            Editor        ed       = Application.DocumentManager.MdiActiveDocument.Editor;

            List <string> resultForFile = new List <string>();

            using (Transaction ts = Application.DocumentManager.MdiActiveDocument.
                                    Database.TransactionManager.StartTransaction())
            {
                // dterminate location of section view profiles
                // ask user to select Alignment
                PromptEntityOptions opt = new PromptEntityOptions("\nSelect an Alignment");
                opt.SetRejectMessage("\nObject must be an alignment.\n");
                opt.AddAllowedClass(typeof(Alignment), false);
                ObjectId alignID = ed.GetEntity(opt).ObjectId;

                try
                {
                    Alignment          myAlignment            = ts.GetObject(alignID, OpenMode.ForRead) as Alignment;
                    ObjectIdCollection sampleLineIdCollection = myAlignment.GetSampleLineGroupIds();
                    SampleLineGroup    sampleLineGroup        = sampleLineIdCollection[0].GetObject(OpenMode.ForRead) as SampleLineGroup; //if you have problem chech here

                    foreach (ObjectId sampleLineId in sampleLineGroup.GetSampleLineIds())
                    {
                        SampleLine sampleLine = ts.GetObject(sampleLineId, OpenMode.ForRead) as SampleLine;

                        foreach (ObjectId sectionId in sampleLine.GetSectionIds())
                        {
                            Section section = ts.GetObject(sectionId, OpenMode.ForWrite) as Section;
                            ed.WriteMessage("Section {0} elevation max: {1} min: {2}\n", section.Name, section.MaximumElevation, section.MinmumElevation);
                            // set the section update mode:
                            //section.UpdateMode = SectionUpdateType.Dynamic;
                        }
                    }

                    SectionViewGroupCollection sectionViewGrouopColection = sampleLineGroup.SectionViewGroups;

                    int sectionViewNumber = 0;
                    try
                    {
                        string askString = String.Format("\nEnter number of ACTIVE SectionViewGroup (1-{0}): ", sectionViewGrouopColection.Count);
                        sectionViewNumber = Convert.ToInt32(GetStringFromUser(ed, askString));
                        if (sectionViewNumber < 1 || sectionViewNumber > sectionViewGrouopColection.Count)
                        {
                            throw new ArgumentOutOfRangeException("Value is out of range!");
                        }
                    }
                    catch (System.Exception)
                    {
                        ed.WriteMessage("Please enter valid value!");
                        return;
                    }
                    SectionViewGroup   theSectionViewGroup    = sectionViewGrouopColection[sectionViewNumber - 1];
                    ObjectIdCollection sectionViewIdColection = theSectionViewGroup.GetSectionViewIds();

                    // create milling Elements
                    MillingDataEngine.DataStruct.RoadSection theRoadSection = MillingDataEngine.Func.ExcelDataRead.RoadSectionElementsBuilder(MillingDataEngine.Func.ExcelDataRead.ReadData());

                    foreach (ObjectId sectionViewId in sectionViewIdColection)
                    {
                        SectionView theSectionView = ts.GetObject(sectionViewId, OpenMode.ForWrite) as SectionView;

                        theSectionView.IsElevationRangeAutomatic = false;
                        string minRangeElevation = theSectionView.ElevationMin.ToString();
                        theSectionView.IsElevationRangeAutomatic = true;

                        MillingDataEngine.DataStruct.ThreeDPoint theLocation = new MillingDataEngine.DataStruct.ThreeDPoint(theSectionView.Location.X, theSectionView.Location.Y, Convert.ToInt32(theSectionView.Location.Z));
                        double baseElevation = Convert.ToDouble(minRangeElevation);

                        double station = MillingDataEngine.Func.SectionViews.ConvertNameToStationLocation(theSectionView.Name);

                        double range = 0.5; //+- range of stations

                        // search maching of cross section in drowing ana xls tanble
                        MillingDataEngine.DataStruct.Cross_section tempCross = theRoadSection.CrossSections.Find((x) => ((x.Station >= station - range && x.Station <= station) ||
                                                                                                                         (x.Station <= station + range && x.Station >= station)));
                        if (tempCross != null && tempCross.MillingElements.Count > 0) //if there is milling elements go next
                        {
                            MillingDataEngine.DataStruct.Cross_section_for_sectionView tempCrossForCV = new MillingDataEngine.DataStruct.Cross_section_for_sectionView(tempCross, theLocation, baseElevation);
                            theRoadSection.AddCrossSectionview(tempCrossForCV);
                        }
                    }

                    DrowToSectionViews(theRoadSection);
                }
                catch (System.Exception e)
                {
                    //throw new System.Exception(e.Message);
                    ed.WriteMessage(e.Message);
                    //return;
                }

                // Save the changes and dispose of the transaction
                ts.Commit();
            }
            ed.WriteMessage("\nOK!");
        }
コード例 #8
0
ファイル: MainWindow.cs プロジェクト: wumn290/processhacker-3
        public MainWindow()
        {
            InitializeComponent();

            Win32.LoadLibrary("C:\\Program Files\\Debugging Tools for Windows (x86)\\dbghelp.dll");

            SymbolProvider symbols = new SymbolProvider(ProcessHandle.Current);

            SymbolProvider.Options |= SymbolOptions.PublicsOnly;

            IntPtr     ntdllBase       = Loader.GetDllHandle("ntdll.dll");
            FileHandle ntdllFileHandle = null;
            Section    section         = null;

            ProcessHandle.Current.EnumModules((module) =>
            {
                if (module.BaseName.Equals("ntdll.dll", StringComparison.InvariantCultureIgnoreCase))
                {
                    section             = new Section(
                        ntdllFileHandle = new FileHandle(@"\??\" + module.FileName,
                                                         FileShareMode.ReadWrite,
                                                         FileAccess.GenericExecute | FileAccess.GenericRead
                                                         ),
                        true,
                        MemoryProtection.ExecuteRead
                        );

                    symbols.LoadModule(module.FileName, module.BaseAddress, module.Size);
                    return(false);
                }

                return(true);
            });

            SectionView view = section.MapView((int)ntdllFileHandle.GetSize());

            ntdllFileHandle.Dispose();

            symbols.EnumSymbols("ntdll!Zw*", (symbol) =>
            {
                int number = Marshal.ReadInt32(
                    (symbol.Address.ToIntPtr().Decrement(ntdllBase)).Increment(view.Memory).Increment(1));

                _sysCallNames.Add(
                    number,
                    "Nt" + symbol.Name.Substring(2)
                    );

                return(true);
            });

            view.Dispose();
            section.Dispose();

            symbols.Dispose();

            KProcessHacker.Instance = new KProcessHacker();

            _logger = new SsLogger(4096, false);
            _logger.EventBlockReceived    += new EventBlockReceivedDelegate(logger_EventBlockReceived);
            _logger.ArgumentBlockReceived += new ArgumentBlockReceivedDelegate(logger_ArgumentBlockReceived);
            _logger.AddPreviousModeRule(FilterType.Include, KProcessorMode.UserMode);
            _logger.AddProcessIdRule(FilterType.Exclude, ProcessHandle.GetCurrentId());
            //_logger.Start();

            listEvents.SetDoubleBuffered(true);
        }
コード例 #9
0
        public void genscs()
        {
            //Definitii generale
            Document      acadDoc  = Application.DocumentManager.MdiActiveDocument;
            CivilDocument civilDoc = CivilApplication.ActiveDocument;
            Database      db       = HostApplicationServices.WorkingDatabase;
            Editor        ed       = acadDoc.Editor;

            //Verificarea existentei macar a unui singur grup de sectiuni transversale
            //SectionViewGroupCollection SVGColl = civilDoc.get
            //SelectionSet SS =

            //Gasirea caii documentului curent
            string caleDocAcad = acadDoc.Database.Filename;

            //Daca fisierul este unul nou, ne salvat inca, calea apartine sablonului folosit pentru acesta.
            //Se verifica daca fisierul este unul sablon, se atentioneaza utilizatorul si se paraseste programul.
            if (caleDocAcad.EndsWith(".dwt") == true)
            {
                ed.WriteMessage("\nThe current drawing is a template file (*.dwt). Exiting program! ");
                return;
            }
            caleDocAcad = HostApplicationServices.Current.FindFile(acadDoc.Name, acadDoc.Database, FindFileHint.Default);


            //Selectarea grupului de sectiuni transversale
            ed.WriteMessage("\nCommand for generating section coordinate systems file (*.SCS) from section view groups");
            PromptEntityOptions PEO = new PromptEntityOptions("\nSelect a section view belonging to the desired section view group: ");

            PEO.SetRejectMessage("\nThe selected object is not a section view! Select object: ");
            PEO.AddAllowedClass(typeof(SectionView), true);

            PromptEntityResult PER = ed.GetEntity(PEO);

            if (PER.Status != PromptStatus.OK)
            {
                ed.WriteMessage("\nInvalid selection! Aborting.");
                return;
            }

            //Inceperea tranzactiei pentru interogarea sectiunilor transversale
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                SectionView SV = PER.ObjectId.GetObject(OpenMode.ForRead) as SectionView;     //Sectiunea selectata
                SampleLine  SL = SV.ParentEntityId.GetObject(OpenMode.ForRead) as SampleLine; //Pichetul de care apartine sectiunea

                //Gasirea grupului de sectiuni din care face parte sectiunea, folosindu-ne de numarul acesteia
                int nrSect                = int.Parse(SV.Name.Substring(SV.Name.IndexOf('(') + 1).Replace(")", ""));
                ObjectIdCollection ids    = SL.GetSectionViewIds();
                List <int>         seturi = new List <int>();
                foreach (ObjectId id in ids)
                {
                    string SVname = ((SectionView)id.GetObject(OpenMode.ForRead)).Name;
                    seturi.Add(int.Parse(SVname.Substring(SVname.IndexOf('(') + 1).Replace(")", "")));
                }
                int set = seturi.IndexOf(nrSect);


                SampleLineGroup    SLG  = SL.GroupId.GetObject(OpenMode.ForRead) as SampleLineGroup;
                ObjectIdCollection OIDS = SLG.GetSampleLineIds();

                //Obtinerea sistemelor de coordonate si scrierea lor in fisierul SCS
                string       caleSCS  = caleDocAcad.Remove(caleDocAcad.LastIndexOf('.')) + ".SCS";
                StreamWriter scriitor = new StreamWriter(caleSCS, false);
                foreach (ObjectId OID in OIDS)
                {
                    SampleLine  SLcurr = OID.GetObject(OpenMode.ForRead) as SampleLine;
                    SectionView SVcurr = SLcurr.GetSectionViewIds()[set].GetObject(OpenMode.ForRead) as SectionView;
                    double      x = -999; double y = -999;
                    SVcurr.FindXYAtOffsetAndElevation(0, 0, ref x, ref y);
                    string km = SVcurr.Name.Remove(SVcurr.Name.IndexOf('(') - 1).Replace("+", "");
                    scriitor.WriteLine(string.Format("{0},{1},{2}", km, x, y));
                }
                scriitor.Dispose();
                ed.WriteMessage("\nCoordinate System File written succesfully.");
            }
        }