コード例 #1
0
        public static Parcel ByNumber(Autodesk.AutoCAD.DynamoNodes.Document document, Site siteObject, int parcelNumber)
        {
            Autodesk.Civil.DatabaseServices.Parcel retParcel = null;
            //get the current document and database
            AcadApp.Document doc = document.AcDocument;
            Database         db  = doc.Database;

            Autodesk.Civil.DatabaseServices.Site site = (Autodesk.Civil.DatabaseServices.Site)siteObject._curCivilObject;
            Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection parcelIds = site.GetParcelIds();
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                foreach (Autodesk.AutoCAD.DatabaseServices.ObjectId objectId in parcelIds)
                {
                    retParcel = (Autodesk.Civil.DatabaseServices.Parcel)trans.GetObject(objectId, OpenMode.ForRead);
                    if (retParcel.Number != parcelNumber)
                    {
                        retParcel = null;
                    }
                    else
                    {
                        return(new Parcel(retParcel, true));
                    }
                }
            }
            return(null);
        }
コード例 #2
0
        /// <summary>
        /// Create AutoCAD's object-point by Dynamo's point and option include Z-cordinate. Return an object id of item.
        /// </summary>
        /// <param name="doc_dyn"></param>
        /// <param name="Point_position"></param>
        /// <param name="IncludeZ"></param>
        /// <returns></returns>
        public static ObjectId CreateAcadPoint(Autodesk.AutoCAD.DynamoNodes.Document doc_dyn, DynGeom.Point Point_position, bool IncludeZ = true)
        {
            //Document doc = Application.DocumentManager.MdiActiveDocument;
            Document doc      = doc_dyn.AcDocument;
            Database db       = doc.Database;
            ObjectId point_id = ObjectId.Null;

            using (DocumentLock acDocLock = doc.LockDocument())
            {
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    BlockTable acBlkTbl;
                    acBlkTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                    BlockTableRecord acBlkTblRec;
                    acBlkTblRec = tr.GetObject(acBlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

                    double coord_z = Point_position.Z; if (!IncludeZ)
                    {
                        coord_z = 0d;
                    }
                    DBPoint acPoint = new DBPoint(new Point3d(Point_position.X, Point_position.Y, coord_z));
                    acBlkTblRec.AppendEntity(acPoint);
                    tr.AddNewlyCreatedDBObject(acPoint, true);
                    point_id = acPoint.ObjectId;


                    tr.Commit();
                }
            }
            return(point_id);
        }
コード例 #3
0
        public static List <HorizontalGeometryPointLabel> GetProfileLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <HorizontalGeometryPointLabel> retLabels = new List <HorizontalGeometryPointLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.ProfileLabelStyles.HorizontalGeometryPointLabelStyles))
            {
                HorizontalGeometryPointLabel labelObject = new HorizontalGeometryPointLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #4
0
        public static List <QTOMaterialTable> GetQTOMaterialTables(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <QTOMaterialTable> retList = new List <QTOMaterialTable>();

            foreach (DBObject dbOb in GetStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.QuantityTakeoffMaterialTableStyles))
            {
                QTOMaterialTable style = new QTOMaterialTable(dbOb, false);
                retList.Add(style);
            }
            return(retList);
        }
コード例 #5
0
        public static List <ViewFrameLabel> GetViewFrameLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <ViewFrameLabel> retLabels = new List <ViewFrameLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.ViewFrameLabelStyles.LabelStyles))
            {
                ViewFrameLabel labelObject = new ViewFrameLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #6
0
        public static List <PVStationElevationLabel> GetProfileViewElevationLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <PVStationElevationLabel> retLabels = new List <PVStationElevationLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.ProfileViewLabelStyles.StationElevationLabelStyles))
            {
                PVStationElevationLabel labelObject = new PVStationElevationLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #7
0
        public static List <SurveyFigureLineLabel> GetSurveyFigureLineLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <SurveyFigureLineLabel> retLabels = new List <SurveyFigureLineLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.GetSurveyLabelStyles().LineLabelStyles))
            {
                SurveyFigureLineLabel labelObject = new SurveyFigureLineLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #8
0
        public static List <SectionGradeBreakLabel> GetSectionGradeBreakLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <SectionGradeBreakLabel> retLabels = new List <SectionGradeBreakLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.SectionLabelStyles.GradeBreakLabelStyles))
            {
                SectionGradeBreakLabel labelObject = new SectionGradeBreakLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #9
0
        public static List <ParcelAreaTable> GetParcelAreaTables(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <ParcelAreaTable> retList = new List <ParcelAreaTable>();

            foreach (DBObject dbOb in GetStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.ParcelAreaTableStyles))
            {
                ParcelAreaTable style = new ParcelAreaTable(dbOb, false);
                retList.Add(style);
            }
            return(retList);
        }
コード例 #10
0
        internal static Autodesk.AutoCAD.DatabaseServices.DBObject DBObjectByName(Autodesk.AutoCAD.DynamoNodes.Document document, StyleCollectionBase stylesCollection, string styleName)
        {
            Autodesk.AutoCAD.DatabaseServices.DBObject retStyle;
            Database db = document.AcDocument.Database;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retStyle = trans.GetObject(stylesCollection[styleName], OpenMode.ForRead);
                trans.Commit();
            }
            return(retStyle);
        }
コード例 #11
0
        internal static Autodesk.AutoCAD.DatabaseServices.DBObject DBObjectByName(Autodesk.AutoCAD.DynamoNodes.Document document, LabelStyleCollection labelStyleRoot, string labelStyleName)
        {
            Autodesk.AutoCAD.DatabaseServices.DBObject retLabels;
            Database db = document.AcDocument.Database;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabels = trans.GetObject(labelStyleRoot[labelStyleName], OpenMode.ForRead);
                trans.Commit();
            }
            return(retLabels);
        }
コード例 #12
0
        public static ProfileViewBandSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            ProfileViewBandSet retLabel;
            Database           db = document.AcDocument.Database;
            ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new ProfileViewBandSet(trans.GetObject(bandRoot[labelStyleName], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
コード例 #13
0
        public static CivilStyle ByCivilObject(Autodesk.AutoCAD.DynamoNodes.Document document, CivilObject civilObject)
        {
            Autodesk.AutoCAD.DatabaseServices.DBObject style = null;
            Database db = document.AcDocument.Database;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                Autodesk.Civil.DatabaseServices.Entity civilEntity = (Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(civilObject.InternalDBObject.ObjectId, OpenMode.ForRead);
                style = trans.GetObject(civilEntity.StyleId, OpenMode.ForRead);
                trans.Commit();
            }
            return(new CivilStyle(style, false));
        }
コード例 #14
0
        public static AlignmentLabelSet ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            AlignmentLabelSet  retLabel;
            Database           db   = document.AcDocument.Database;
            LabelSetStylesRoot root = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles;
            AlignmentLabelSetStyleCollection alignRoot = root.AlignmentLabelSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new AlignmentLabelSet(trans.GetObject(alignRoot[index], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
コード例 #15
0
        public static SectionLabelSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            SectionLabelSet                retLabel;
            Database                       db        = document.AcDocument.Database;
            LabelSetStylesRoot             root      = CivilDocument.GetCivilDocument(db).Styles.LabelSetStyles;
            SectionLabelSetStyleCollection alignRoot = root.SectionLabelSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new SectionLabelSet(trans.GetObject(alignRoot[labelStyleName], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
コード例 #16
0
        public static Parcel ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, Site siteObject, int index)
        {
            Parcel retParcel = null;

            //get the current document and database
            AcadApp.Document doc = document.AcDocument;
            Database         db  = doc.Database;

            Autodesk.Civil.DatabaseServices.Site site = (Autodesk.Civil.DatabaseServices.Site)siteObject._curCivilObject;
            Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection parcelIds = site.GetParcelIds();
            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retParcel = new Parcel((Autodesk.Civil.DatabaseServices.Entity)trans.GetObject(parcelIds[index], OpenMode.ForRead), true);
            }
            return(retParcel);
        }
コード例 #17
0
        public static IList <Alignment> GetAlignments(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            CivilDocument      civilDocument = Autodesk.Civil.ApplicationServices.CivilDocument.GetCivilDocument(document.AcDocument.Database);
            ObjectIdCollection alignmentIds  = civilDocument.GetAlignmentIds();

            //get the current document and database
            AcadApp.Document doc        = AcadApp.Application.DocumentManager.MdiActiveDocument;
            Database         db         = doc.Database;
            List <Alignment> alignments = new List <Alignment>();

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                foreach (ObjectId objectId in alignmentIds)
                {
                    alignments.Add(new Alignment((Autodesk.Civil.DatabaseServices.Alignment)trans.GetObject(objectId, OpenMode.ForRead), false));
                }
            }
            return(alignments);
        }
コード例 #18
0
        public static SurfaceWatershedLabel ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            SurfaceWatershedLabel retLabel = new SurfaceWatershedLabel(DBObjectByIndex(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.SurfaceLabelStyles.WatershedLabelStyles, index), false);

            return(retLabel);
        }
コード例 #19
0
        public static SectionViewTotalVolumeTable ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string styleName)
        {
            SectionViewTotalVolumeTable retStyle = new SectionViewTotalVolumeTable(CivilStyle.DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.SectionViewTotalVolumeTableStyles, styleName), false);

            return(retStyle);
        }
コード例 #20
0
        public static List <SectionViewTotalVolumeTable> GetSectionViewTotalVolumeTables(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <SectionViewTotalVolumeTable> retList = new List <SectionViewTotalVolumeTable>();

            foreach (DBObject dbOb in GetStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.SectionViewTotalVolumeTableStyles))
            {
                SectionViewTotalVolumeTable style = new SectionViewTotalVolumeTable(dbOb, false);
                retList.Add(style);
            }
            return(retList);
        }
コード例 #21
0
        public static SurveyFigureLineLabel ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            SurveyFigureLineLabel retLabel = new SurveyFigureLineLabel(DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.GetSurveyLabelStyles().LineLabelStyles, labelStyleName), false);

            return(retLabel);
        }
コード例 #22
0
        public static SurveyFigureLineLabel ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            SurveyFigureLineLabel retLabel = new SurveyFigureLineLabel(DBObjectByIndex(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.GetSurveyLabelStyles().LineLabelStyles, index), false);

            return(retLabel);
        }
コード例 #23
0
        public static TangentIntersectionLabel ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            TangentIntersectionLabel retLabel = new TangentIntersectionLabel(DBObjectByIndex(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.AlignmentLabelStyles.TangentIntersectionLabelStyles, index), false);

            return(retLabel);
        }
コード例 #24
0
        public static TangentIntersectionLabel ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            TangentIntersectionLabel retLabel = new TangentIntersectionLabel(DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.AlignmentLabelStyles.TangentIntersectionLabelStyles, labelStyleName), false);

            return(retLabel);
        }
コード例 #25
0
        public static List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> GetProfileViewBandSets(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> alignmentLabels = new List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet>();
            Database db = document.AcDocument.Database;
            ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles;

            foreach (ObjectId setStyle in bandRoot)
            {
                using (Transaction trans = db.TransactionManager.StartTransaction())
                {
                    ProfileViewBandSet labelSet = new ProfileViewBandSet(trans.GetObject(setStyle, OpenMode.ForRead), false);
                    alignmentLabels.Add(labelSet);
                    trans.Commit();
                }
            }
            return(alignmentLabels);
        }
コード例 #26
0
        public static SurfaceWatershedLabel ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            SurfaceWatershedLabel retLabel = new SurfaceWatershedLabel(DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.SurfaceLabelStyles.WatershedLabelStyles, labelStyleName), false);

            return(retLabel);
        }
コード例 #27
0
        public static List <CivilDynamoTools.LabelStyles.Alignments.TangentIntersectionLabel> GetTangentIntersectionLabels(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <CivilDynamoTools.LabelStyles.Alignments.TangentIntersectionLabel> retLabels = new List <CivilDynamoTools.LabelStyles.Alignments.TangentIntersectionLabel>();

            foreach (DBObject dbObj in GetLabelStylesAsDBObjects(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.LabelStyles.AlignmentLabelStyles.TangentIntersectionLabelStyles))
            {
                TangentIntersectionLabel labelObject = new TangentIntersectionLabel(dbObj, false);
                retLabels.Add(labelObject);
            }
            return(retLabels);
        }
コード例 #28
0
        public static ParcelAreaTable ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string styleName)
        {
            ParcelAreaTable retStyle = new ParcelAreaTable(CivilStyle.DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.ParcelAreaTableStyles, styleName), false);

            return(retStyle);
        }
コード例 #29
0
        public static ParcelAreaTable ByIndex(Autodesk.AutoCAD.DynamoNodes.Document document, int index)
        {
            ParcelAreaTable retStyle = new ParcelAreaTable(CivilStyle.DBObjectByIndex(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.ParcelAreaTableStyles, index), false);

            return(retStyle);
        }
コード例 #30
0
        public static QTOMaterialTable ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string styleName)
        {
            QTOMaterialTable retStyle = new QTOMaterialTable(CivilStyle.DBObjectByName(document, CivilDocument.GetCivilDocument(document.AcDocument.Database).Styles.TableStyles.QuantityTakeoffMaterialTableStyles, styleName), false);

            return(retStyle);
        }