Hatching array of circles in AutoCAD using c#
<p>I am beginner in <code>AutoCad Plugins</code>.I have created an array of circle using following code. Now, I have to hatch those circles in array .How to do that??How to hatch all circles at once? Moreover, how can i return hatch from method and use it to hatch objects.Sorry for language.Thanks in advance.</p>

<pre><code>[assembly: CommandClass(typeof(BeamSection.Class1))]
namespace BeamSection
{
    public class Class1
    {
        //Class1 obj = new Class1();

        [CommandMethod("BeamAtSupport")]
        public void AddLightweightPolyline()
        {
            // Get the current document and database
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;
            PromptPointResult ppr = acDoc.Editor.GetPoint("\nSelect starting point ");
            var ucs = acDoc.Editor.CurrentUserCoordinateSystem;
            Point3d StartingPt = ppr.Value.TransformBy(ucs);



            List&lt;double&gt; radius = new List&lt;double&gt;();
            radius.Add(0.5);
            radius.Add(1);
           double[]   pickPont = new double[3];
            pickPont = new double[3];
            pickPont[0] = StartingPt[0];
            pickPont[1] = StartingPt[1];
            pickPont[2] = StartingPt[2];
            double w = 12.0;
            double b = 18.0;
            double t = 1.0;
            double c = 1.0;
            int nb = 3;







            // Start a transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // Open the Block table for read
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                                OpenMode.ForRead) as BlockTable;
                //Open the Block table record Model space for write
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
                                               OpenMode.ForWrite) as BlockTableRecord;
                pickPont[0] = StartingPt[0];
                pickPont[1] = StartingPt[1];
                pickPont[2] = StartingPt[2];
                Application.ShowAlertDialog(pickPont[0].ToString());


              double x = calculate(w, b, c, radius, nb);
              Circle acCircle = new Circle();
              acCircle.Radius = 1.5 * 0.5;
              acCircle.Center = new Point3d(pickPont[0] - (w / 2 - 2 * c) - x - 0.1, pickPont[1] + 2 * c, 0);
              //acBlkTblRec.AppendEntity(acCircle);
              //acTrans.AddNewlyCreatedDBObject(acCircle, true);

            /*  ObjectIdCollection objColls = new ObjectIdCollection();
              objColls.Add(acCircle.ObjectId);
              Hatch oHatch = new Hatch();
              oHatch.Elevation = 0.0;
              oHatch.PatternScale = 2.0;
              oHatch.SetHatchPattern(HatchPatternType.PreDefined, "Solid");
              oHatch.ColorIndex = 4;

              oHatch.Associative = true;
              oHatch.AppendLoop(HatchLoopTypes.Outermost, objColls);
              oHatch.EvaluateHatch(true);*/




              //ObjectIdCollection objColls = new ObjectIdCollection();
              //objColls.Add(acCircle.ObjectId);




                /*  Matrix3d curUCSMatrix = acDoc.Editor.CurrentUserCoordinateSystem;
                  CoordinateSystem3d curUCS = curUCSMatrix.CoordinateSystem3d;
                  Vector2d acVec2dAng = new Vector2d(curUCS.Xaxis.X, curUCS.Xaxis.Y);*/

                //dArrayAng = dArrayAng; //+ acVec2dAng.Angle;
                      int nRows = 1;
                      int nColumns = nb;
                      double dRowOffset = 1;
                      double dColumnOffset = x;
                      Application.ShowAlertDialog(x.ToString());
                      double dArrayAng = 0;
                      for (int i = 0; i &lt; 2; i++)
                      {
                          Extents3d acExts = acCircle.Bounds.GetValueOrDefault();
                          Point2d acPt2dArrayBase = new Point2d(acExts.MinPoint.X, acExts.MaxPoint.Y);



                          if (i == 1)
                          {
                              acCircle.Center = new Point3d(pickPont[0] - (w / 2 - 2 * c) - x - 0.1, pickPont[1] + 2 * c, 0);

                          }
                          else 
                          {
                              acCircle.Center = new Point3d(pickPont[0] - (w / 2 - 2 * c) - x - 0.1, pickPont[1] + (b - 3 * t) + 1, 0);
                          }
                          DBObjectCollection acDBObjCollCols = new DBObjectCollection();
                          acDBObjCollCols.Add(acCircle);

                          int nColumnsCount = 1;
                          while (nColumns &gt;= nColumnsCount)
                          {
                              Entity acEntClone = acCircle.Clone() as Entity;




                              acDBObjCollCols.Add(acEntClone);
                              // Caclucate the new point for the copied object (move)          
                              Point2d acPt2dTo = PolarPoints(acPt2dArrayBase, dArrayAng, dColumnOffset * nColumnsCount);
                              Vector2d acVec2d = acPt2dArrayBase.GetVectorTo(acPt2dTo);
                              Vector3d acVec3d = new Vector3d(acVec2d.X, acVec2d.Y, 0);
                              acEntClone.TransformBy(Matrix3d.Displacement(acVec3d));


                              acBlkTblRec.AppendEntity(acEntClone);
                              acTrans.AddNewlyCreatedDBObject(acEntClone, true);
                              nColumnsCount = nColumnsCount + 1;

                          }

                          double dAng = Math.PI / 2;

                          DBObjectCollection acDBObjCollLvls = new DBObjectCollection();
                          foreach (DBObject acObj in acDBObjCollCols)
                          {
                              acDBObjCollLvls.Add(acObj);
                          }
                          foreach (Entity acEnt1 in acDBObjCollCols)
                          {
                              int nRowsCount = 1;
                              while (nRows &gt; nRowsCount)
                              {
                                  Entity acEntClone = acEnt1.Clone() as Entity;
                                  acDBObjCollLvls.Add(acEntClone);

                                  // Caclucate the new point for the copied object (move)              
                                  Point2d acPt2dTo = PolarPoints(acPt2dArrayBase, dArrayAng + dAng, dRowOffset * nRowsCount);
                                  Vector2d acVec2d = acPt2dArrayBase.GetVectorTo(acPt2dTo);
                                  Vector3d acVec3d = new Vector3d(acVec2d.X, acVec2d.Y, 0);
                                  acEntClone.TransformBy(Matrix3d.Displacement(acVec3d));

                                  acBlkTblRec.AppendEntity(acEntClone);
                                  acTrans.AddNewlyCreatedDBObject(acEntClone, true);
                                  nRowsCount = nRowsCount + 1;
                              }
                          }
                      }





                    //acBlkTblRec.AppendEntity(oHatch);
                  //  acTrans.AddNewlyCreatedDBObject(oHatch, true);





                    acTrans.Commit();
                }
                acDoc.SendStringToExecute("._zoom _e ", true, false, false);
            }
</code></pre>