Esempio n. 1
0
        public ObjectId findSurface(string surfaceName)
        {
            CivilDocument doc = CivilApplicationManager.ActiveCivilDocument;

            using (Transaction tr = CivilApplicationManager.StartTransaction())
            {
                foreach (ObjectId surfaceId in doc.GetSurfaceIds())
                {
                    C3DLandDb.Surface surface = surfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.Surface;
                    if (surface.Name == surfaceName)
                    {
                        return(surfaceId);
                    }
                }
            }

            return(ObjectId.Null);
        }
Esempio n. 2
0
        /// <summary>
        /// Recurses the elev from surface.
        /// </summary>
        public void RecurseElevFromSurface()
        {
            try
            {
                HideAmbientSettingsShowEvntVwer();

                var surfaceId = breaklines.FindCivilTinSurface("All");
                var siteId    = breaklines.GetSiteId(surfaceId);

                _siteId      = siteId;
                _surObjectId = surfaceId;

                var exfeaturelines = GetSurfaceEntityIDs(CivilApplicationManager.WorkingDatabase);

                var poly3DCollection = new List <Polyline3d>();

                using (Application.DocumentManager.MdiActiveDocument.LockDocument())
                {
                    foreach (var featurelineId in exfeaturelines)
                    {
                        using (var tr = CivilApplicationManager.StartTransaction())

                        {
                            //var poly3d = breaklines.AddCivil2016ElevationsToFeature
                            //    (surfaceId, featurelineId, siteId, null);

                            //if (Math.Abs(poly3d.StartPoint.Z) < 0.01)
                            //{
                            //    MessengerManager.MessengerManager.AddLog("Z-Value not Extracted! " + featurelineId);
                            //}
                            tr.Commit();
                        }
                    }
                    // break;
                }
                SetAmbientSettingsShowEvntVwer();
            }
            catch (Exception ex)
            {
                MessengerManager.MessengerManager.LogException(ex);
            }
        }
Esempio n. 3
0
        public object OpenFeatureLineForSave(ObjectId featureId)
        {
            Debug.WriteLine("Starting OpenFeatureLineForSave");

            using (Transaction tr = CivilApplicationManager.StartTransaction())
            {
                var feature       = (C3DLandDb.FeatureLine)featureId.GetObject(OpenMode.ForWrite, false, true);
                var p3Dcollection = feature.GetPoints(FeatureLinePointType.AllPoints);

                var poly3d = new Polyline3d(Poly3dType.SimplePoly, p3Dcollection, true);
                poly3d.Layer = feature.Layer;
                poly3d.Color = feature.Color;
                _polylines.Add(poly3d);

                //C3DLandDb.TinSurface surface = surfaceId.GetObject(OpenMode.ForWrite) as C3DLandDb.TinSurface;
                //surface.BreaklinesDefinition.AddStandardBreaklines(p3Dcollection, 1.0, 2.0, 5.0, 0.0);

                tr.Commit();
                Debug.WriteLine("Ending OpenFeatureLineForSave");
                return(poly3d);
            }
        }
Esempio n. 4
0
        public void AddCivil2016ElevationsToFeature(ObjectId surfaceId, ObjectId featureId, ObjectId siteId,
                                                    object o)
        {
            try
            {
                PGA.MessengerManager.MessengerManager.AddLog("Starting AddCivil2016ElevationsToFeature");
                using (Application.DocumentManager.MdiActiveDocument.LockDocument())
                {
                    using (Transaction tr = CivilApplicationManager.StartTransaction())
                    {
                        var feature = (C3DLandDb.FeatureLine)featureId.GetObject(OpenMode.ForRead);

                        if (feature == null)
                        {
                            return;
                        }

                        feature.UpgradeOpen();
                        feature.AssignElevationsFromSurface(surfaceId, false);
                        feature.DowngradeOpen();

                        //Check and Refine Zeros from Breakline
                        FeatureLineManager.SendMessage(feature);
                        FeatureLineManager.CheckElevFromFeatureLine(feature.ObjectId);

                        var p3Dcollection = feature.GetPoints(FeatureLinePointType.AllPoints);

                        C3DLandDb.TinSurface surface = surfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface;

                        if (surface == null)
                        {
                            return;
                        }

                        surface.UpgradeOpen();
                        ///Todo:Handle Breaklines for Water and Bulkhead
                        ///
                        surface.BuildOptions.NeedConvertBreaklines             = true;
                        surface.BuildOptions.ExecludeMinimumElevation          = true;
                        surface.BuildOptions.MinimumElevation                  = 0.1;
                        surface.BuildOptions.CrossingBreaklinesElevationOption =
                            CrossingBreaklinesElevationType.UseLast; ///Todo: Changed 2/19/17 from None.
                        surface.BreaklinesDefinition.AddStandardBreaklines(p3Dcollection, 1.0, 2.0, 2.0, 0.0);
                        surface.DowngradeOpen();

                        tr.Commit();
                        PGA.MessengerManager.MessengerManager.AddLog("Ending AddCivil2016ElevationsToFeature");
                    }
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                PGA.MessengerManager.MessengerManager.LogException(ex);
            }
            catch (System.AccessViolationException ex)
            {
                PGA.MessengerManager.MessengerManager.LogException(ex);
            }
            catch (System.Exception ex)
            {
                PGA.MessengerManager.MessengerManager.LogException(ex);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Adds the breaklines by command line.
        /// </summary>
        public void AddBreaklinesByCommandLine()
        {
            try
            {
                PGA.MessengerManager.MessengerManager.AddLog("Starting AddBreaklinesByCommandLine!");
                using (Application.DocumentManager.MdiActiveDocument.LockDocument())
                {
                    HideAmbientSettingsShowEvntVwer();
                    var surfaceId        = breaklines.FindCivilTinSurface("All");
                    var poly3dCollection = new List <Polyline3d>();

                    _surObjectId = surfaceId;

                    foreach (ObjectId poly in _polyCollection)
                    {
                        try
                        {
                            if (used3dCollection.Contains(poly))
                            {
                                continue;
                            }

                            used3dCollection.Add(poly);

                            PGA.MessengerManager.MessengerManager.
                            AddLog("Looping AddBreaklinesByCommandLine! " + _polyCollection.IndexOf(poly));

                            if (_polyCollection.IndexOf(poly) == 60)
                            {
                                PGA.MessengerManager.MessengerManager.AddLog("Hit 60");
                            }


                            _siteId = breaklines.GetNewSiteId();

                            if (_siteId == ObjectId.Null)
                            {
                                continue;
                            }

                            using (Transaction tr = CivilApplicationManager.StartTransaction())
                            {
                                var featurelineId = breaklines.AddCivil2016BreaklineByTrans
                                                        (surfaceId, poly, _siteId, null);

                                PGA.MessengerManager.MessengerManager.
                                AddLog("Added a Breakline!");

                                if (featurelineId == ObjectId.Null)
                                {
                                    continue;
                                }

                                breaklines.AddCivil2016ElevationsToFeature
                                    (_surObjectId, featurelineId, _siteId, null);
                                PGA.MessengerManager.MessengerManager.
                                AddLog("Assigned Elevations!");
                                tr.Commit();
                            }
                        }
                        catch (System.Exception ex)
                        {
                            PGA.MessengerManager.MessengerManager.LogException(ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessengerManager.MessengerManager.LogException(ex);
            }
        }