public partial class AlignTagFrm : Form
 {
     public Leader SourceLeader { get; set; }
     public ObjectAttributes SourceLeaderAttribute { get; set; }
     public Guid SourceLeaderGUID { get; set; }
     public Point3d SourceLeaderAlignePoint { get; set; }

     public List<Leader> ModifiedLeaders { get; set; }
     public List<ObjectAttributes> ModifiedLeadersObjectAttributes { get; set; }
     public List<Guid> ModifiedLeadersGUID { get; set; }
     //public Vector3d TransferVector { get; set; }
     public AlignTagFrm()
     {
         InitializeComponent();
     }

     public void FormDifine()
     {
         if (!this.IsDisposed)
         {
             Show();
         }
     }

     private void SourceTagBtn_Click(object sender, EventArgs e)
     {
         //Getting just Anotation Types with 512U ObjectType Id
         int filterobject = 512;
         var SelectedObjects = EIGetRihnoTl.GetAllGeomatry("Objeleri Seçin", filterobject, false, true, true, false, false);
         foreach (var objRef in SelectedObjects)
         {
             SourceLeaderAttribute = objRef.Object().Attributes;
             SourceLeaderGUID = objRef.ObjectId;


             var geometry = objRef.Object();
             if (geometry.Geometry is Leader)
             {
                 Leader sourceLeader = (Leader)geometry.Geometry;
                 SourceLeader = sourceLeader;
                 SourceLeaderAlignePoint = sourceLeader.Points3D[1];
             }
         }
         //RhinoDoc.ActiveDoc.Objects.Delete(SourceLeaderGUID, true);

     }

     private void TagstomodifyBtn_Click(object sender, EventArgs e)
     {
         //Getting just Anotation Types with 512U ObjectType Id
         int filterobject = 512;
         var SelectedObjects = EIGetRihnoTl.GetAllGeomatry("Objeleri Seçin", filterobject, false, true, true, false, true);
         
         ModifiedLeaders ??= [];
         ModifiedLeadersGUID ??= [];
         ModifiedLeadersObjectAttributes ??= [];

         foreach (var objRef in SelectedObjects)
         {
             var geometry = objRef.Object();

             ModifiedLeadersGUID.Add(objRef.ObjectId);
             if (geometry.Geometry is Leader)
             {
                 Leader sourceLeader = (Leader)geometry.Geometry;
                 ModifiedLeaders.Add(sourceLeader);
             }
         }

         //foreach (var leader in ModifiedLeaders)
         //{
         //    RhinoDoc.ActiveDoc.Objects.Find(ModifiedLeadersGUID[i])
         //    //Vector3d TransferVector = SourceLeaderAlignePoint - leader.Points3D[1];
         //    Vector3d TransferVector =  new Vector3d(SourceLeaderAlignePoint.X - leader.Points3D[1].X,0,0);
         //    Transform move = Transform.Translation(TransferVector);
         //    leader.Points3D[1].Transform(move);
         //    leader.Points3D[2].Transform(move);
         //}
         for (int i = 0; i < ModifiedLeaders.Count; i++)
         {
              var leader = (Leader) RhinoDoc.ActiveDoc.Objects.Find(ModifiedLeadersGUID[i]).Geometry;
              Vector3d TransferVector = SourceLeaderAlignePoint - leader.Points3D[1];
              Transform move = Transform.Translation(TransferVector);
              leader.Points3D[1].Transform(move);
              leader.Points3D[2].Transform(move);


             //// Delete the original object
             //RhinoDoc.ActiveDoc.Objects.Delete(ModifiedLeadersGUID[i], true);
         }
     }

   
 }