Ejemplo n.º 1
0
        private static List <string> IterateCADInsertsATTRIB(CadImage cadImage)
        {
            List <string> items = new List <string>();

            foreach (CadBlockEntity blockEntity in cadImage.BlockEntities.Values)
            {
                foreach (var entity in blockEntity.Entities)
                {
                    switch (entity.TypeName)
                    {
                    case CadEntityTypeName.INSERT:
                        CadInsertObject childInsertObject = (CadInsertObject)entity;
                        foreach (var attributes in childInsertObject.ChildObjects)
                        {
                            if (attributes.TypeName == CadEntityTypeName.ATTRIB)
                            {
                                CadAttrib attribute = (CadAttrib)attributes;
                                string    attr      = attribute.DefinitionTagString.Value;
                                items.Add(attr);
                            }
                        }
                        break;
                    }
                }
            }
            return(items);
        }
Ejemplo n.º 2
0
        private static void IterateCADInserts(CadImage cadImage, List <object> attrList)
        {
            int map_id = Form1.map_id;
            int sys_id = Form1.sys_id;
            int grp_id = Form1.grp_id;

            foreach (CadBlockEntity blockEntity in cadImage.BlockEntities.Values)
            {
                foreach (var entity in blockEntity.Entities)
                {
                    switch (entity.TypeName)
                    {
                    case CadEntityTypeName.INSERT:
                        CadInsertObject childInsertObject = (CadInsertObject)entity;
                        ArrayList       mtext             = IterateMTEXTNodes(cadImage);
                        string          BTNdsc            = string.Empty;
                        foreach (CadMText text in mtext)
                        {
                            double ABSposX = Math.Abs(childInsertObject.InsertionPoint.X - text.InsertionPoint.X);
                            double ABSposY = Math.Abs(childInsertObject.InsertionPoint.Y - text.InsertionPoint.Y);
                            if (ABSposX <= 40 && ABSposY <= 40)
                            {
                                BTNdsc = text.Text;
                            }
                        }
                        foreach (var attributes in childInsertObject.ChildObjects)
                        {
                            if (attributes.TypeName == CadEntityTypeName.ATTRIB)
                            {
                                CadAttrib at = (CadAttrib)attributes;
                                foreach (string attrName in attrList)
                                {
                                    if (at.DefinitionTagString.Value == attrName)
                                    {
                                        BTNdsc = at.DefaultText;
                                    }
                                }
                            }
                        }
                        Database db = new Database();
                        db.InsertMap_zne(map_id, sys_id, grp_id, childInsertObject.InsertionPoint.X, childInsertObject.InsertionPoint.Y, childInsertObject.RotationAngle, childInsertObject.Name, BTNdsc);
                        db.Dispose();
                        break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
      private static void IterateCADNodes(CadBaseEntity obj)
      {
          switch (obj.TypeName)
          {
          case CadEntityTypeName.TEXT:
              CadText childObjectText = (CadText)obj;

              Console.WriteLine(childObjectText.DefaultValue);

              break;

          case CadEntityTypeName.MTEXT:
              CadMText childObjectMText = (CadMText)obj;

              Console.WriteLine(childObjectMText.Text);

              break;

          case CadEntityTypeName.INSERT:
              CadInsertObject childInsertObject = (CadInsertObject)obj;

              foreach (var tempobj in childInsertObject.ChildObjects)
              {
                  IterateCADNodes(tempobj);
              }
              break;

          case CadEntityTypeName.ATTDEF:
              CadAttDef attDef = (CadAttDef)obj;

              Console.WriteLine(attDef.DefaultString);
              break;

          case CadEntityTypeName.ATTRIB:
              CadAttrib attAttrib = (CadAttrib)obj;

              Console.WriteLine(attAttrib.DefaultText);
              break;
          }
      }