Ejemplo n.º 1
0
        // featurelines
        public Featureline FeatureLineToSpeckle(CivilDB.FeatureLine featureline)
        {
            var _featureline = new Featureline();

            _featureline.baseCurve      = CurveToSpeckle(featureline.BaseCurve, ModelUnits);
            _featureline.name           = (featureline.DisplayName != null) ? featureline.DisplayName : "";
            _featureline["description"] = (featureline.Description != null) ? featureline.Description : "";
            _featureline.units          = ModelUnits;

            List <Point> piPoints        = new List <Point>();
            List <Point> elevationPoints = new List <Point>();

            foreach (Autodesk.AutoCAD.Geometry.Point3d point in featureline.GetPoints(Autodesk.Civil.FeatureLinePointType.PIPoint))
            {
                piPoints.Add(PointToSpeckle(point));
            }
            foreach (Autodesk.AutoCAD.Geometry.Point3d point in featureline.GetPoints(Autodesk.Civil.FeatureLinePointType.ElevationPoint))
            {
                elevationPoints.Add(PointToSpeckle(point));
            }
            if (piPoints.Count > 0)
            {
                _featureline[@"piPoints"] = piPoints;
            }
            if (elevationPoints.Count > 0)
            {
                _featureline[@"elevationPoints"] = elevationPoints;
            }

            try { _featureline["site"] = featureline.SiteId; } catch { }

            return(_featureline);
        }
        // featurelines
        public Polycurve FeatureLineToSpeckle(CivilDB.FeatureLine featureLine)
        {
            var polycurve = new Polycurve()
            {
                closed = featureLine.Closed
            };

            // extract segment curves
            var segments = new List <ICurve>();
            var exploded = new DBObjectCollection();

            featureLine.Explode(exploded);
            for (int i = 0; i < exploded.Count; i++)
            {
                segments.Add((ICurve)ConvertToSpeckle(exploded[i]));
            }
            polycurve.segments = segments;

            // TODO: additional params to attach
            try{
                var points    = featureLine.GetPoints(Autodesk.Civil.FeatureLinePointType.AllPoints);
                var grade     = new Interval(featureLine.MinGrade, featureLine.MaxGrade);
                var elevation = new Interval(featureLine.MinElevation, featureLine.MaxElevation);
                var name      = featureLine.DisplayName;
            }
            catch {}

            return(polycurve);
        }
Ejemplo n.º 3
0
        public void AddCivil2016Breakline(ObjectId SurfaceId, ObjectId polyId, ObjectId siteId, string name)
        {
            using (Transaction tr = CivilApplicationManager.StartTransaction())
            {
                ObjectId featureId            = ObjectId.Null;
                C3DLandDb.FeatureLine feature = null;

                //ObjectId featureId = C3DLandDb.FeatureLine.Create(GetFeatureLineName(), polyId, GetSiteId(ObjectId.Null));
                var checkPoly = polyId.GetObject(OpenMode.ForRead, false, true) as Polyline;

                if (checkPoly != null)
                {
                    featureId = C3DLandDb.FeatureLine.Create(GetFeatureLineName(), polyId, siteId);
                }

                feature = (C3DLandDb.FeatureLine)featureId.GetObject(OpenMode.ForRead);
                feature.AssignElevationsFromSurface(SurfaceId, true);
                var p3Dcollection = feature.GetPoints(FeatureLinePointType.AllPoints);

                //Polyline3d poly = new Polyline3d(Poly3dType.SimplePoly, p3Dcollection, true);
                //tr.AddNewlyCreatedDBObject(poly,true);

                C3DLandDb.TinSurface surface = SurfaceId.GetObject(OpenMode.ForWrite) as C3DLandDb.TinSurface;

                //ObjectIdCollection entities = new ObjectIdCollection();
                //entities.Add(poly.ObjectId);
                surface.BreaklinesDefinition.AddStandardBreaklines(p3Dcollection, 1.0, 2.0, 1.0, 0.0);
                tr.Commit();
            }
        }