示例#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);
        }
示例#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);
        }