<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: All dublicate objects Overkill c# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597586#M15376</link>
    <description>&lt;P&gt;What application are you using to compile your code? Is it visual studio?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Sep 2021 17:29:59 GMT</pubDate>
    <dc:creator>jtoverka</dc:creator>
    <dc:date>2021-09-03T17:29:59Z</dc:date>
    <item>
      <title>All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10591317#M15366</link>
      <description>&lt;P&gt;Hello guys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I delete all duplicate objects in the dwg file?&lt;/P&gt;&lt;P&gt;overkill&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* I will integrate this into another code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 17:58:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10591317#M15366</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-01T17:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10593239#M15367</link>
      <description>&lt;OL&gt;&lt;LI&gt;Create a class called Duplicates or something&lt;/LI&gt;&lt;LI&gt;In the constructor do the following&lt;UL&gt;&lt;LI&gt;Database database,&amp;nbsp;Transaction transaction as parameters&lt;OL&gt;&lt;LI&gt;The calling function should be responsible for creating the starting transaction.&lt;/LI&gt;&lt;LI&gt;Your class should have checks to verify that Database, Transaction, ObjectIds are valid and usable.&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Scan all of the layouts (to ensure the entire drawing is scanned), sort each entity id in a dictionary.&lt;OL&gt;&lt;LI&gt;Example: Dictionary&amp;lt;Type, List&amp;lt;ObjectId&amp;gt;&amp;gt; entitiesField = new();&lt;/LI&gt;&lt;LI&gt;An Example of type is BlockReference&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Putting these into buckets will make your application more efficient instead of scanning the drawing for every entity&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Create a public method called RemoveDuplicate_Entity&lt;UL&gt;&lt;LI&gt;_Entity can be replaced with say BlockReference as an Example&lt;OL&gt;&lt;LI&gt;List&amp;lt;ObjectId&amp;gt; ids = entitiesField[typeof(BlockReference)];&lt;/LI&gt;&lt;LI&gt;Scan the ids and find duplicates, remove as needed&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Create as many as you need for your application.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Create a public method called RemoveAllDuplicates&lt;UL&gt;&lt;LI&gt;Invoke all of the other RemoveDuplicate_Entity methods.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Create properties of duplication parameters&lt;UL&gt;&lt;LI&gt;Example, layer matching, linetype matching, tolerances, etc.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Put it all together&lt;UL&gt;&lt;LI&gt;Create the transaction to the database.&lt;/LI&gt;&lt;LI&gt;Create the object, pass constructor parameters transaction and database.&lt;/LI&gt;&lt;LI&gt;Pass properties to adjust the duplicate matching.&lt;/LI&gt;&lt;LI&gt;Invoke the remove duplicates methods&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Notes&lt;UL&gt;&lt;LI&gt;Only store object ids in fields, not references, it's harder to keep track of disposing these objects when the references are stored in fields. Get the object id and get the object from the transaction.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 02 Sep 2021 10:41:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10593239#M15367</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-02T10:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10593282#M15368</link>
      <description>&lt;P&gt;Thank you very much for the suggestion. But I'm not that good at C# yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* If there is a small example, I think I will.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 11:06:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10593282#M15368</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-02T11:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10595123#M15369</link>
      <description>&lt;P&gt;I don't have it complete, but it should be working, I think.&lt;BR /&gt;Basically you create an object Duplicates, and you call the methods on that object that you want to use.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Name: J. Overkamp
// Date: 09/02/2021

using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace Utilities
{
	/// &amp;lt;summary&amp;gt;
	/// Represents a .NET database container to implement overkill.
	/// &amp;lt;/summary&amp;gt;
	public class Duplicates : INotifyPropertyChanged
	{
		#region Static FIelds

		private static readonly RXClass rxLine = RXObject.GetClass(typeof(Line));
		private static readonly RXClass rxPolyLine = RXObject.GetClass(typeof(Polyline));
		private static readonly RXClass rxPolyLine2d = RXObject.GetClass(typeof(Polyline2d));
		private static readonly RXClass rxPolyLine3d = RXObject.GetClass(typeof(Polyline3d));
		private static readonly RXClass rxBlockReference = RXObject.GetClass(typeof(BlockReference));
		private static readonly RXClass rxAttributeDefinition = RXObject.GetClass(typeof(AttributeDefinition));
		private static readonly RXClass rxAttributeReference = RXObject.GetClass(typeof(AttributeReference));
		private static readonly RXClass rxDbText = RXObject.GetClass(typeof(DBText));
		private static readonly RXClass rxMText = RXObject.GetClass(typeof(MText));
		private static readonly RXClass rxCircle = RXObject.GetClass(typeof(Circle));

		#endregion

		#region Fields

		// flag for error checks.
		private bool check = true;

		private readonly Transaction transactionField = null;
		private readonly Database databaseField = null;

		// Dictionary to sort out buckets of entities by type.
		private readonly Dictionary&amp;lt;RXClass, List&amp;lt;ObjectId&amp;gt;&amp;gt; entityDictionary = new();

		// Property field defaults.
		private bool removeZeroLengthLinesField = true;
		private bool removeZeroDiameterCirclesField = true;
		private double toleranceField = 0.0000001;

		#endregion

		#region Properties

		/// &amp;lt;summary&amp;gt;
		/// Gets or sets the flag to remove zero length lines.
		/// &amp;lt;/summary&amp;gt;
		public bool RemoveZeroLengthLines
		{
			get { return removeZeroLengthLinesField; }
			set 
			{
				if (removeZeroLengthLinesField == value)
					return;

				removeZeroLengthLinesField = value;
				OnPropertyChanged(this, new(nameof(RemoveZeroLengthLines)));
			}
		}

		/// &amp;lt;summary&amp;gt;
		/// Gets or sets the flag to remove zero diameter circles.
		/// &amp;lt;/summary&amp;gt;
		public bool RemoveZeroDiameterCircles
		{
			get { return removeZeroDiameterCirclesField; }
			set 
			{
				if (removeZeroLengthLinesField == value)
					return;

				removeZeroDiameterCirclesField = value;
				OnPropertyChanged(this, new(nameof(RemoveZeroDiameterCircles)));
			}
		}

		/// &amp;lt;summary&amp;gt;
		/// Gets or sets the measurement tolerance to determine a match.
		/// &amp;lt;/summary&amp;gt;
		public double Tolerance
		{
			get { return toleranceField; }
			set 
			{
				if (toleranceField == value)
					return;

				toleranceField = value;
				OnPropertyChanged(this, new(nameof(Tolerance)));
			}
		}

		#endregion

		#region Constructor

		/// &amp;lt;summary&amp;gt;
		/// Create a new instance of this class.
		/// &amp;lt;/summary&amp;gt;
		/// &amp;lt;param name="transaction"&amp;gt;&amp;lt;/param&amp;gt;
		/// &amp;lt;param name="database"&amp;gt;&amp;lt;/param&amp;gt;
		public Duplicates(Transaction transaction, Database database)
		{
			if (check)
			{
				CheckDatabase(database, true);
				CheckTransaction(transaction, true);
			}

			databaseField = database;
			transactionField = transaction;

			InitializeDictionary();

			// Get Layout dictionary
			using DBDictionary layouts = transaction.GetObject(database.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;

			// Iterate through the layouts
			foreach (DBDictionaryEntry layout in layouts)
			{
				ObjectId layoutId = layout.Value;

				if (!CheckObjectId(layoutId, false))
					continue;

				// Get the layout
				using BlockTableRecord space = transaction.GetObject(layoutId, OpenMode.ForRead) as BlockTableRecord;

				// Iterate through the entities in each layout
				foreach (ObjectId entityId in space)
				{
					// Put each entity type into it's respective buckets.
					if (!CheckObjectId(entityId, false))
						continue;

					if (entityId.ObjectClass == rxLine)
						entityDictionary[rxLine].Add(entityId);

					else if (entityId.ObjectClass == rxPolyLine)
						entityDictionary[rxPolyLine].Add(entityId);

					else if (entityId.ObjectClass == rxPolyLine2d)
						entityDictionary[rxPolyLine2d].Add(entityId);
					
					else if (entityId.ObjectClass == rxPolyLine3d)
						entityDictionary[rxPolyLine3d].Add(entityId);
					
					else if (entityId.ObjectClass == rxBlockReference)
						entityDictionary[rxBlockReference].Add(entityId);
					
					else if (entityId.ObjectClass == rxAttributeDefinition)
						entityDictionary[rxAttributeDefinition].Add(entityId);
					
					else if (entityId.ObjectClass == rxAttributeReference)
						entityDictionary[rxAttributeReference].Add(entityId);
					
					else if (entityId.ObjectClass == rxDbText)
						entityDictionary[rxDbText].Add(entityId);
					
					else if (entityId.ObjectClass == rxMText)
						entityDictionary[rxMText].Add(entityId);
					
					else if (entityId.ObjectClass == rxCircle)
						entityDictionary[rxCircle].Add(entityId);
				}
			}
		}

		#endregion

		#region Static Methods

		/// &amp;lt;summary&amp;gt;
		/// Check Object Id for errors.
		/// &amp;lt;/summary&amp;gt;
		/// &amp;lt;param name="id"&amp;gt;ObjectId to check.&amp;lt;/param&amp;gt;
		/// &amp;lt;param name="error"&amp;gt;Flag to throw error.&amp;lt;/param&amp;gt;
		/// &amp;lt;returns&amp;gt;True if no errors found; otherwise, false.&amp;lt;/returns&amp;gt;
		private static bool CheckObjectId(ObjectId id, bool error)
		{
			if (error)
			{
				if (id.IsNull)
					throw new NullReferenceException("Transaction is null");

				if (id.IsEffectivelyErased || id.IsErased)
					throw new AccessViolationException("Object Id is erased");

				if (!id.IsValid)
					throw new System.Exception("Object Id is not valid");
			}
			else
			{
				if (id.IsNull || id.IsEffectivelyErased || id.IsErased || !id.IsValid)
					return false;
			}

			return true;
		}

		/// &amp;lt;summary&amp;gt;
		/// Check transaction for errors.
		/// &amp;lt;/summary&amp;gt;
		/// &amp;lt;param name="transaction"&amp;gt;Transaction to check.&amp;lt;/param&amp;gt;
		/// &amp;lt;param name="argument"&amp;gt;Flag whether it is an argument check.&amp;lt;/param&amp;gt;
		/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
		private static bool CheckTransaction(Transaction transaction, bool argument)
		{
			if (argument)
			{
				if (transaction == null)
					throw new ArgumentNullException("Transaction is null");
			}
			else
			{
				if (transaction == null)
					throw new NullReferenceException("Transaction is null");
			}

			if (transaction.IsDisposed)
				throw new ArgumentException("Transaction has been disposed");

			return true;
		}

		/// &amp;lt;summary&amp;gt;
		/// Check database for errors.
		/// &amp;lt;/summary&amp;gt;
		/// &amp;lt;param name="database"&amp;gt;Database to check.&amp;lt;/param&amp;gt;
		/// &amp;lt;param name="argument"&amp;gt;Flag whether it is an argument check.&amp;lt;/param&amp;gt;
		/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
		private static bool CheckDatabase(Database database, bool argument)
		{
			if (argument)
			{
				if (database == null)
					throw new ArgumentNullException("Database is null");
			}
			else
			{
				if (database == null)
					throw new NullReferenceException("Database is null");
			}

			if (database.IsBeingDestroyed)
				throw new AccessViolationException("Database cannot be used, it is being destroyed");
			if (database.IsDisposed)
				throw new ObjectDisposedException("Database has been disposed");

			return true;
		}

		#endregion

		#region Methods

		/// &amp;lt;summary&amp;gt;
		/// Invoke property change event.
		/// &amp;lt;/summary&amp;gt;
		/// &amp;lt;param name="sender"&amp;gt;The object that invoked the event.&amp;lt;/param&amp;gt;
		/// &amp;lt;param name="e"&amp;gt;The property that changed.&amp;lt;/param&amp;gt;
		protected void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			PropertyChanged?.Invoke(sender, e);
		}

		/// &amp;lt;summary&amp;gt;
		/// Initialize each entity key in the dictionary with a list.
		/// &amp;lt;/summary&amp;gt;
		private void InitializeDictionary()
		{
			entityDictionary[rxLine] = new();
			entityDictionary[rxPolyLine] = new();
			entityDictionary[rxPolyLine2d] = new();
			entityDictionary[rxPolyLine3d] = new();
			entityDictionary[rxBlockReference] = new();
			entityDictionary[rxAttributeDefinition] = new();
			entityDictionary[rxAttributeReference] = new();
			entityDictionary[rxDbText] = new();
			entityDictionary[rxMText] = new();
			entityDictionary[rxCircle] = new();
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate lines.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_Line()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			foreach (ObjectId lineId in entityDictionary[rxLine])
			{
				if (!CheckObjectId(lineId, false))
					continue;

				using Line line = transactionField.GetObject(lineId, OpenMode.ForRead) as Line;
				if (RemoveZeroLengthLines)
				{
					if (line.Length &amp;lt; Tolerance)
						line.Erase();
				}
			}
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate polylines.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_PolyLine()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate polyline2d objects.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_PolyLine2d()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate polyline3d objects.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_PolyLine3d()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate block references.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_BlockReference()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate attribute definitions.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_AttributeDefinition()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate attribute references.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_AttributeReference()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate text.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_DBText()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate MText.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_MText()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicate Circles.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill_Circle()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			// Insert additional code here
		}

		/// &amp;lt;summary&amp;gt;
		/// Remove duplicates of all entities.
		/// &amp;lt;/summary&amp;gt;
		public void Overkill()
		{
			if (check)
			{
				CheckDatabase(databaseField, false);
				CheckTransaction(transactionField, false);
			}
			
			check = false;

			try
			{
				Overkill_Line();
				Overkill_PolyLine();
				Overkill_PolyLine2d();
				Overkill_PolyLine3d();
				Overkill_BlockReference();
				Overkill_AttributeDefinition();
				Overkill_AttributeReference();
				Overkill_DBText();
				Overkill_MText();
				Overkill_Circle();
			}
			catch
			{
				throw;
			}
			finally
			{
				check = true;
			}
		}

		#endregion

		#region Delegates, Events, Handlers

		/// &amp;lt;summary&amp;gt;
		/// Invoked on property changed.
		/// &amp;lt;/summary&amp;gt;
		public event PropertyChangedEventHandler PropertyChanged;

		#endregion
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 23:39:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10595123#M15369</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-02T23:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10595696#M15370</link>
      <description>&lt;P&gt;Thank you very much, I will review the code and try it. I will write the result again here.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 06:30:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10595696#M15370</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T06:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597494#M15371</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;  private static bool CheckDatabase(Database database, bool argument)
        {
            if (argument)
            {
                if (database == null)
                    throw new ArgumentNullException("Database is null");
            }
            else
            {
                if (database == null)
                    throw new NullReferenceException("Database is null");
            }

            if (database.IsBeingDestroyed)
                throw new AccessViolationException("Database cannot be used, it is being destroyed");
            if (database.IsDisposed)
                throw new ObjectDisposedException("Database has been disposed");

            return true;
        }
        private static bool CheckTransaction(Transaction transaction, bool argument)
        {
            if (argument)
            {
                if (transaction == null)
                    throw new ArgumentNullException("Transaction is null");
            }
            else
            {
                if (transaction == null)
                    throw new NullReferenceException("Transaction is null");
            }

            if (transaction.IsDisposed)
                throw new ArgumentException("Transaction has been disposed");

            return true;
        }
        private bool check = true;
        private readonly Database databaseField = null;
        private readonly Transaction transactionField = null;


        public void Overkill_PolyLine()
        {
            if (check)
            {
                CheckDatabase(databaseField, false);
                CheckTransaction(transactionField, false);
            }
            // Insert additional code here
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to adapt the code.&lt;/P&gt;&lt;P&gt;I just called overkill_polyline.&lt;/P&gt;&lt;P&gt;but I got "database null" error.&lt;/P&gt;&lt;P&gt;A sample drawing is attached.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 16:56:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597494#M15371</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T16:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597509#M15372</link>
      <description>&lt;P&gt;It would be best to attach the code file you used so I can look at it.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 16:56:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597509#M15372</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T16:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597515#M15373</link>
      <description>&lt;LI-CODE lang="csharp"&gt; [CommandMethod("dht")]
        public void BreaComtest()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            birimCeviri(); //BİRİM ÇEVİRİ METODUM. DEĞİŞKENLER ÜSTTE
            ed.WriteMessage("\nAktif Birim : {0}", cZimBrimi);

            PromptPointResult ppr = ed.GetPoint("\nHesaplanacak Alan Tıkla &amp;gt;");
            if (ppr.Status != PromptStatus.OK) return;


            DBObjectCollection objs = ed.TraceBoundary(ppr.Value, true);
            if (objs.Count == 0) return;
            ObjectIdCollection ids = new ObjectIdCollection();
            ObjectId idmain = ObjectId.Null;
            
            double area = 0;

            //using (DocumentLock docLock = doc.LockDocument())
            using (Transaction tr = doc.TransactionManager.StartTransaction())
            {
                BlockTableRecord cspace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                foreach (DBObject obj in objs)
                {
                    Curve c = obj as Curve;
                    if (c != null)
                    {
                        ObjectId curveId = cspace.AppendEntity(c);
                        tr.AddNewlyCreatedDBObject(c, true);
                        ids.Add(curveId);
                        if (c.Area &amp;gt; area)
                        {
                            idmain = curveId; area = c.Area;
                        }
                    }
                }
                tr.Commit();
            }

            using (Transaction tr = doc.TransactionManager.StartTransaction())
            {
                BlockTableRecord cspace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

                Hatch hat = new Hatch();
                hat.SetDatabaseDefaults();
                cspace.AppendEntity(hat);
                tr.AddNewlyCreatedDBObject(hat, true);
                hat.HatchStyle = HatchStyle.Outer;
                hat.SetHatchPattern(HatchPatternType.PreDefined, "SOLID");
                hat.Associative = true;
                hat.AppendLoop(HatchLoopTypes.External, new ObjectIdCollection() { idmain });
                foreach (ObjectId id in ids)
                {
                    if (id != idmain)
                        hat.AppendLoop(HatchLoopTypes.Default, new ObjectIdCollection() { id });
                }
                hat.EvaluateHatch(true);

                ed.WriteMessage("\nTaranmış Alan : {0}", (hat.Area / BolenA).ToString("F2") + " m²");
                tr.Commit();
            }
            Overkill_PolyLine();
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Sep 2021 16:59:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597515#M15373</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T16:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597556#M15374</link>
      <description>&lt;P&gt;That's not the correct use of the class.&lt;BR /&gt;So my class file will be separate, modify that file only in the scope of overkill. Add your code to remove duplicates of polylines in the class file I provided.&lt;BR /&gt;&lt;BR /&gt;To use the class appropriately, create the commands in another file and use the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// C# 9.0
Duplicates duplicates = new(tr, db);
duplicates.Overkill_Polyline();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:16:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597556#M15374</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T17:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597568#M15375</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How in another file? I do not understand., all the codes you sent?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:22:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597568#M15375</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T17:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597586#M15376</link>
      <description>&lt;P&gt;What application are you using to compile your code? Is it visual studio?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:29:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597586#M15376</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T17:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597595#M15377</link>
      <description>&lt;P&gt;Yes. Visual Studio 2019&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File type : dll ( plug-in)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:32:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597595#M15377</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T17:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597609#M15378</link>
      <description>&lt;P&gt;So your hierarchy is this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Solution&lt;UL&gt;&lt;LI&gt;Project&lt;UL&gt;&lt;LI&gt;References&lt;/LI&gt;&lt;LI&gt;Files&lt;UL&gt;&lt;LI&gt;Class1.cs&lt;/LI&gt;&lt;LI&gt;Class2.cs&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;and so on&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Make a class called Duplicates.cs, put the code I wrote in that class.&lt;BR /&gt;Make another class called Commands.cs and make your AutoCAD commands there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These separate classes will be compiled into one dll.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:37:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597609#M15378</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T17:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597627#M15379</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you create the class and add it?&lt;/P&gt;&lt;P&gt;I created it. but there are errors.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:47:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597627#M15379</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T17:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597704#M15380</link>
      <description>&lt;P&gt;I can't see the errors from the photo, what are the errors?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 18:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597704#M15380</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T18:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597710#M15381</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created Duplicate.cs but it gave 17 errors.&lt;BR /&gt;you send me the file, let's talk about it.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 18:30:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597710#M15381</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T18:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597752#M15382</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6070895"&gt;@jtoverka&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All right, I've added Dublicates.cs.&lt;/P&gt;&lt;P&gt;Duplicates duplicates = new(tr, db); --&amp;gt; I'm getting an error in this part. C# 7.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 18:50:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597752#M15382</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T18:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597793#M15383</link>
      <description>&lt;P&gt;Yes,&lt;BR /&gt;&lt;BR /&gt;This is where you open KalayCad.csproj&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Insert&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;LangVersion&amp;gt;9.0&amp;lt;/LangVersion&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;under the first ProjectGroup you see.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 19:03:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597793#M15383</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T19:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597818#M15384</link>
      <description>Make sure you save your project before doing this.&lt;BR /&gt;This will ensure your project allows C# 9.0&lt;BR /&gt;It's the language version that I wrote the code in.</description>
      <pubDate>Fri, 03 Sep 2021 19:13:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597818#M15384</guid>
      <dc:creator>jtoverka</dc:creator>
      <dc:date>2021-09-03T19:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: All dublicate objects Overkill c#</title>
      <link>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597823#M15385</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is an error again... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 19:16:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/all-dublicate-objects-overkill-c/m-p/10597823#M15385</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2021-09-03T19:16:02Z</dc:date>
    </item>
  </channel>
</rss>

