Exemple #1
0
        /// <summary>
        /// 复制符号数据
        /// </summary>
        /// <param name="g3eObject"> </param>
        /// <param name="objectId"> </param>
        /// <returns></returns>
        private static CopySymbolObject GetBrotherDBEntity(G3EObject g3eObject, ObjectId objectId)
        {
            var cso          = new CopySymbolObject();
            var copyDBEntity = new HashSet <DBEntityObject>();

            try
            {
                var entry = SimpleDBSymbolsConfig.Instance.DBSymbol.SingleOrDefault(o => o.G3E_FNO == g3eObject.G3E_FNO);
                if (entry != null)
                {
                    if (!string.IsNullOrEmpty(entry.SymbolPtTable))
                    {
                        //坐标表数据
                        var ptSymbolValue = PublicMethod.Instance.GetDBSymbolFinder(objectId) as ElectronSymbol;
                        if (ptSymbolValue != null)
                        {
                            cso.pointDBEntity = ptSymbolValue;
                        }
                        //属性
                        copyDBEntity   = GetDBEntityObjects(g3eObject, entry, copyDBEntity);
                        cso.g3eObject  = g3eObject;
                        cso.objectID   = objectId;
                        cso.hsDBEntity = copyDBEntity;
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(ex);
            }
            return(cso);
        }
Exemple #2
0
        /// <summary>
        /// 属性复制
        /// </summary>
        /// <param name="objectId">实体对象Id</param>
        public static CopySymbolObject GetAttribute(ObjectId objectId)
        {
            G3EObject        g3eObject        = null;
            CopySymbolObject copySymbolObject = null;

            if (DBEntityFinder.Instance.GetG3EIds(objectId, ref g3eObject))
            {
                copySymbolObject = GetBrotherDBEntity(g3eObject, objectId);
            }
            return(copySymbolObject);
        }
Exemple #3
0
 /// <summary>
 /// 保存复制数据
 /// </summary>
 /// <param name="cso"> </param>
 /// <param name="xmlDB"> </param>
 /// <param name="basePoint"> </param>
 private static XmlDBManager AddXmlDB(CopySymbolObject cso, XmlDBManager xmlDB, Point3d basePoint)
 {
     if (cso.pointDBEntity != null)
     {
         var newObject_pt = cso.pointDBEntity;
         newObject_pt.BasePoint = ConvertGeometry.Instance.GetMultipoint(basePoint.X, basePoint.Y, 0);
         xmlDB.Insert(newObject_pt);
     }
     if (cso.hsDBEntity != null)
     {
         foreach (var nData in cso.hsDBEntity)
         {
             xmlDB.Insert(nData.dbEntity);
         }
     }
     return(xmlDB);
 }
Exemple #4
0
        /// <summary>
        /// 复制属性
        /// </summary>
        /// <param name="objectIds"></param>
        /// <param name="copySymbolObject"> </param>
        public static int CopyAttribute(ObjectId[] objectIds, CopySymbolObject copySymbolObject)
        {
            var copyCount = 0;
            //获取原设备的样式
            var eventArgs = CABLEManager.GetSymbolExecution(copySymbolObject.objectID, copySymbolObject.g3eObject, DBManager.Instance as XmlDBManager);

            if (eventArgs != null)
            {
                //获取原设备的块定义名称
                var blockName = DCadApi.GetBlockDefinitionName(eventArgs, copySymbolObject.g3eObject.G3E_FNO.ToString());
                foreach (var objectId in objectIds)
                {
                    G3EObject g3eObject = null;
                    var       dbObject  = PublicMethod.Instance.GetObject(objectId, OpenMode.ForRead);
                    //排除标注
                    if (dbObject is BlockReference || dbObject is Polyline)
                    {
                        if (DBEntityFinder.Instance.GetG3EIds(objectId, ref g3eObject))
                        {
                            //校验工单
                            if (DBEntityFinder.Instance.VerifyLTTID(objectId))
                            {
                                //判断类型
                                if (copySymbolObject.g3eObject.G3E_FNO == g3eObject.G3E_FNO)
                                {
                                    foreach (var dbEntity in copySymbolObject.hsDBEntity)
                                    {
                                        SetBrotherDBEntity(dbEntity, g3eObject);
                                    }
                                    //更新符号
                                    UpdateSymbol(blockName, objectId, eventArgs);
                                    copyCount++;
                                }
                            }
                        }
                    }
                }
            }
            return(copyCount);
        }