<?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: Prevent Block from edit from C# API in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430389#M9203</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16015650"&gt;@saurabhvithoba&lt;/a&gt; If the block definition (BlockTableRecord) is created by code, creating an anonymous block will prevent this block to be edited.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var blockDefinition = new BlockTableRecord(){ Name = "*U" };&lt;/LI-CODE&gt;
&lt;P&gt;This has some consequences: this block won't be inserable through the INSERT commands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Apr 2025 06:29:52 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2025-04-17T06:29:52Z</dc:date>
    <item>
      <title>Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891033#M9195</link>
      <description>&lt;P&gt;How can we prevent block from edit?&lt;BR /&gt;Right now if I double click on block it can be edited. I tried to lock the layer and block but unable to do that.&lt;/P&gt;&lt;P&gt;also I have to prevent block from being copied.&lt;/P&gt;&lt;P&gt;Can anyone guide me in this?&lt;BR /&gt;I tried with:&lt;/P&gt;&lt;P&gt;1. _AcAp.DocumentLock Doclk = cDoc.LockDocument()&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;newLayer.IsLocked = true;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:11:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891033#M9195</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2023-04-12T16:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891117#M9196</link>
      <description>&lt;P&gt;So, you want to prevent a block definition from being changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LockDocument() has nothing to do with preventing data in database being modified. It is meant to flag the code execution should occur in Application context or document context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nor setting layer being locked helps, because block definition (BlockTableRecord) is no an Entity, which must sit on a layer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would want to have a good reason as why you do not want to protect the block definition being changed WHILE your application is used in the AutoCAD session, because whatever protection you managed to use with your application, only have its effect while your application is loaded, and while your application is loaded, what business operation could lead to a CAD user to attempt to modify the said block definition(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still think it is absolutely necessary, you can look into ObjectOverrule and overwrite the its Open() and/or Close() method: if the object being opened/closed is the target BlockTableRecord for writing, you can raise an exception so that the Open()/Close() can be silently cancelled during runtime (in debugging, the code would break, though).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 16:44:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891117#M9196</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-04-12T16:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891165#M9197</link>
      <description>Thanks for quick reply.&lt;BR /&gt;I will try ObjectOverrule and see how can i prevent.&lt;BR /&gt;if I stuck somewhere will get back to you.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Apr 2023 17:02:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/11891165#M9197</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2023-04-12T17:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12096106#M9198</link>
      <description>I tried Object overrule for preventing block from erasing.&lt;BR /&gt;Although I am not sure It is right but it is working.&lt;BR /&gt;public override void Erase(DBObject dbObject, bool erasing)&lt;BR /&gt;{&lt;BR /&gt;//base.Erase(dbObject, erasing);&lt;BR /&gt;throw new Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.NotApplicable);&lt;BR /&gt;}&lt;BR /&gt;This will work for me.&lt;BR /&gt;but can you share some idea for copy or selection.</description>
      <pubDate>Wed, 12 Jul 2023 09:28:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12096106#M9198</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2023-07-12T09:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12096605#M9199</link>
      <description>&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2013/01/prevent-coping-of-the-entity.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/autocad/2013/01/prevent-coping-of-the-entity.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 13:13:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12096605#M9199</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2023-07-12T13:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12187365#M9200</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/565180"&gt;@Gepaha&lt;/a&gt;&amp;nbsp;Thanks for answer.&lt;/P&gt;&lt;P&gt;Is there any way to prevent to go to Block editor definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 06:35:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12187365#M9200</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2023-08-22T06:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12187373#M9201</link>
      <description>Thanks I have tried copy overrule and it works good.&lt;BR /&gt;Is there any way that prevent to edit blocks (block editor)</description>
      <pubDate>Tue, 22 Aug 2023 06:37:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/12187373#M9201</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2023-08-22T06:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430369#M9202</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11543096"&gt;@iPranavKulkarni&lt;/a&gt;, did you get any solution for preventing Edit Blocks ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 06:05:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430369#M9202</guid>
      <dc:creator>saurabhvithoba</dc:creator>
      <dc:date>2025-04-17T06:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430389#M9203</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16015650"&gt;@saurabhvithoba&lt;/a&gt; If the block definition (BlockTableRecord) is created by code, creating an anonymous block will prevent this block to be edited.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var blockDefinition = new BlockTableRecord(){ Name = "*U" };&lt;/LI-CODE&gt;
&lt;P&gt;This has some consequences: this block won't be inserable through the INSERT commands.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 06:29:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430389#M9203</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2025-04-17T06:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430402#M9204</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;for the quick reply. I will try this approach.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 06:41:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13430402#M9204</guid>
      <dc:creator>saurabhvithoba</dc:creator>
      <dc:date>2025-04-17T06:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Block from edit from C# API</title>
      <link>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13832246#M85831</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/16015650"&gt;@saurabhvithoba&lt;/a&gt;&amp;nbsp;&lt;SPAN&gt;copy overrule worked for me, from that we prevent to edit block at that time.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2025 04:47:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/prevent-block-from-edit-from-c-api/m-p/13832246#M85831</guid>
      <dc:creator>iPranavKulkarni</dc:creator>
      <dc:date>2025-10-01T04:47:08Z</dc:date>
    </item>
  </channel>
</rss>

