Beispiel #1
0
        checkPntGroup(string pntDesc)
        {
            ObjectId   idPntGrp      = ObjectId.Null;
            ObjectId   idPntLblStyle = Pnt_Style.getPntLabelStyle(pntDesc);
            ObjectId   idPntStyle    = Pnt_Style.getPntStyle(pntDesc);
            PointGroup pntGrp        = null;

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                try
                {
                    if (_pointGroups.Contains(pntDesc))
                    {
                        idPntGrp = _pointGroups[pntDesc];
                        pntGrp   = (PointGroup)tr.GetObject(idPntGrp, OpenMode.ForWrite);
                    }
                    else
                    {
                        idPntGrp = _pointGroups.Add(pntDesc);
                        pntGrp   = (PointGroup)tr.GetObject(idPntGrp, OpenMode.ForWrite);
                    }

                    if (pntGrp != null)
                    {
                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = string.Format("{0}", pntDesc);
                        pntGrp.SetQuery(query);
                        pntGrp.PointLabelStyleId = idPntLblStyle;
                        pntGrp.PointStyleId      = idPntStyle;
                        pntGrp.Update();
                    }
                    else
                    {
                        return(ObjectId.Null);
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 289", ex.Message));
                }
                tr.Commit();
            }
            return(idPntGrp);
        }
Beispiel #2
0
        setPoint(this Point3d pnt3d, out uint pntNum, string pntDesc = "CPNT-ON")
        {
            ObjectId idPnt = ObjectId.Null;

            pntNum = 0;
            CivilDocument civDoc = CivilApplication.ActiveDocument;

            idPnt = civDoc.CogoPoints.Add(pnt3d, false);

            Layer.manageLayers(pntDesc);
            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    CogoPoint pnt = (CogoPoint)tr.GetObject(idPnt, OpenMode.ForWrite);
                    pnt.PointName    = pnt.PointNumber.ToString();
                    pnt.LabelStyleId = Pnt_Style.getPntLabelStyle(pntDesc);
                    pnt.StyleId      = Pnt_Style.getPntStyle(pntDesc);
                    try
                    {
                        pnt.Layer = pntDesc;
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(string.Format("{0} Pnt.cs: line: 237", ex.Message));
                    }
                    pnt.RawDescription = pntDesc;
                    pntNum             = pnt.PointNumber;
                    CgPnt_Group.updatePntGroup(pntDesc);
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt.cs: line: 246", ex.Message));
            }
            return(idPnt);
        }
Beispiel #3
0
        setPoint(this Point3d pnt3d, string nameLayer = "CPNT-ON")
        {
            ObjectId id = ObjectId.Null;

            Layer.manageLayers(nameLayer);
            CivilDocument civDOC = CivilApplication.ActiveDocument;

            id = civDOC.CogoPoints.Add(pnt3d, true);
            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    CogoPoint cogoPnt = (CogoPoint)id.GetObject(OpenMode.ForWrite);
                    cogoPnt.PointName = cogoPnt.PointNumber.ToString();
                    if (nameLayer != null)
                    {
                        try
                        {
                            cogoPnt.Layer = nameLayer;
                        }
                        catch (System.Exception ex)
                        {
                            BaseObjs.writeDebug(string.Format("{0} Pnt.cs: line: 203", ex.Message));
                        }
                        cogoPnt.RawDescription = nameLayer;
                        cogoPnt.LabelStyleId   = Pnt_Style.getPntLabelStyle(nameLayer);
                        cogoPnt.PointName      = nameLayer + cogoPnt.PointNumber;
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt.cs: line: 214", ex.Message));
            }
            return(id);
        }