<?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: Illegal attempt to modify document. Reason: Changes are disabled for the act in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774591#M52497</link>
    <description>&lt;P&gt;Hi, Thanks for the reply!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I think the link is broken&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 16:26:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-13T16:26:58Z</dc:date>
    <item>
      <title>Illegal attempt to modify document. Reason: Changes are disabled for the active</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774545#M52495</link>
      <description>&lt;P&gt;I'm trying to change the parameters of a certain selected element. However, I'm getting the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Illegal attempt to modify document. Reason: Changes are disabled for the active document!"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The strange part is that this error only occurs when the appended value is different from the original value, which makes me think that the error is caused by the setvaluestring command. I've done some googling but haven't really found a good way to solve this. In the API I read something about Revit API firewall which stated that the activedocument should be closed when trying to execute an external command. However, as I'm quite new to Revit, I have no idea where to start.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Reflection;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Windows.Media.Imaging;

using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;

namespace Walkthrough
{
    /// &amp;lt;remarks&amp;gt;
    /// This application's main class. The class must be Public.
    /// &amp;lt;/remarks&amp;gt;
    public class CsAddPanel : IExternalApplication
    {
        // Both OnStartup and OnShutdown must be implemented as public method
        public Result OnStartup(UIControlledApplication application)
        {
            // Add a new ribbon panel
            RibbonPanel ribbonPanel = application.CreateRibbonPanel("Custom Functies");

            // Create a push button to trigger a command add it to the ribbon panel.
            string thisAssemblyPath = Assembly.GetExecutingAssembly().Location;
            PushButtonData buttonData = new PushButtonData("cmdHelloWorld",
               "Hello Form", thisAssemblyPath, "Walkthrough.Document_Selection");

            PushButton pushButton = ribbonPanel.AddItem(buttonData) as PushButton;

            // Optionally, other properties may be assigned to the button
            // a) tool-tip
            pushButton.ToolTip = "Say hello to Form.";

            // b) large bitmap
            Uri uriImage = new Uri(@"C:\Users\ramdas\Desktop\Revit Test Resources\logosmall.png");
         BitmapImage largeImage = new BitmapImage(uriImage);
         pushButton.LargeImage = largeImage;

         return Result.Succeeded;
      }

      public Result OnShutdown(UIControlledApplication application)
      {
         // nothing to clean up in this simple case
         return Result.Succeeded;
      }
   }
   /// &amp;lt;remarks&amp;gt;
   /// The "HelloWorld" external command. The class must be Public.
   /// &amp;lt;/remarks&amp;gt;
   [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    public class HelloWorld : IExternalCommand
        {
            // The main Execute method (inherited from IExternalCommand) must be public
            public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
                ref string message, ElementSet elements)
            {
                TaskDialog.Show("Revit", "Hello Form");
                return Autodesk.Revit.UI.Result.Succeeded;
            }
        }

    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.ReadOnly)]
    public class Document_Selection : IExternalCommand
    {
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
            ref string message, ElementSet elements)
        {
            try
            {

                // Select an element in Revit before invoking this command
            
                // Get the handle of current document.
                UIDocument uidoc = commandData.Application.ActiveUIDocument;
                
                Selection selection = uidoc.Selection;
                Document doc = uidoc.Document;
                Reference ref1 = selection.PickObject(ObjectType.Element, "Pick element to change its property");
                
                Element elem = doc.GetElement(ref1.ElementId);
               // TaskDialog.Show("Revit", ref1.ElementId.ToString());
               
                Parameter para = elem.LookupParameter("beukbreedte");
                para.SetValueString("5700");

            }
            catch (Exception e)
            {
                message = e.Message;
                return Autodesk.Revit.UI.Result.Failed;
            }


            return Autodesk.Revit.UI.Result.Succeeded;
        }


        
    }





}&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Feb 2018 16:09:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774545#M52495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-13T16:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Illegal attempt to modify document. Reason: Changes are disabled for the act</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774569#M52496</link>
      <description>&lt;P&gt;You need to start a transaction in order to modify a document: &lt;A href="http://help.autodesk.com/view/RVT/2017/ENU/?guid=GUID-C946A4BA-2E70-4467-91A0-1B6BA69DBFBE" target="_blank"&gt;Revit API Developers Guide: Transactions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 16:36:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774569#M52496</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2018-02-13T16:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: Illegal attempt to modify document. Reason: Changes are disabled for the act</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774591#M52497</link>
      <description>&lt;P&gt;Hi, Thanks for the reply!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I think the link is broken&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 16:26:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774591#M52497</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-13T16:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Illegal attempt to modify document. Reason: Changes are disabled for the act</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774629#M52498</link>
      <description>&lt;P&gt;Link fixed.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 16:37:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7774629#M52498</guid>
      <dc:creator>FRFR1426</dc:creator>
      <dc:date>2018-02-13T16:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Illegal attempt to modify document. Reason: Changes are disabled for the act</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7800215#M52499</link>
      <description>&lt;P&gt;Thanks! Sorry for the late reply but it worked! Sorry for the nooby question&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 16:18:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/illegal-attempt-to-modify-document-reason-changes-are-disabled/m-p/7800215#M52499</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-22T16:18:07Z</dc:date>
    </item>
  </channel>
</rss>

