<?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: Copy Parameters in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970355#M3538</link>
    <description>&lt;P&gt;So, what is the problem with your script? What happens?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Aug 2024 16:57:32 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2024-08-20T16:57:32Z</dc:date>
    <item>
      <title>Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970132#M3534</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I need to copy the content from the source parameters to the target parameters. I've written the following code, but it doesn't seem to work correctly. Can anyone help me figure out what's wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    [Transaction(TransactionMode.Manual)]
    public class CopyParameterCommand : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            Autodesk.Revit.DB.Document doc = uiApp.ActiveUIDocument.Document;

            FilteredElementCollector collector = new FilteredElementCollector(doc);
            ICollection&amp;lt;Element&amp;gt; allElements = collector.WhereElementIsNotElementType().ToElements();

            using (Transaction trans = new Transaction(doc, "Copiar parámetro "))
            {
                trans.Start();

                foreach (Element element in allElements)
                {
                    Parameter sourceParam = element.LookupParameter("Source-parameter");
                    Parameter targetParam = element.LookupParameter("Target-parameter");


                    if (sourceParam != null &amp;amp;&amp;amp; sourceParam.HasValue)
                    {
                        string sourceValue = sourceParam.AsString();

                        if (targetParam != null &amp;amp;&amp;amp; targetParam.StorageType == StorageType.String)
                        {
                            targetParam.Set(sourceValue);
                            sourceParam.Set(string.Empty);
                        }
                    }
                }

                trans.Commit();
            }

            return Result.Succeeded;
        }
    }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Aug 2024 15:18:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970132#M3534</guid>
      <dc:creator>emaguilera</dc:creator>
      <dc:date>2024-08-20T15:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970243#M3535</link>
      <description>&lt;P&gt;I cannot tell what the problem might be. What behaviour do you observe?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code looks sort of OK-ish, although I see a couple of issues that could easily be optimised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 16:04:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970243#M3535</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-08-20T16:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970276#M3536</link>
      <description>&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 16:25:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970276#M3536</guid>
      <dc:creator>emaguilera</dc:creator>
      <dc:date>2024-08-20T16:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970280#M3537</link>
      <description>&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="emaguilera_0-1724171130177.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1399962iB0FC39A57EB3D60C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="emaguilera_0-1724171130177.png" alt="emaguilera_0-1724171130177.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want what is in red to become what is in yellow.&lt;BR /&gt;I can't get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 16:25:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970280#M3537</guid>
      <dc:creator>emaguilera</dc:creator>
      <dc:date>2024-08-20T16:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970355#M3538</link>
      <description>&lt;P&gt;So, what is the problem with your script? What happens?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 16:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970355#M3538</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-08-20T16:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970366#M3539</link>
      <description>&lt;P&gt;maybe source and target parameter are type parameters, you look for them in instance not in symbol. debug it or if you don't know how make a simple dialog that show if any parameter was found.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 17:06:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970366#M3539</guid>
      <dc:creator>MarryTookMyCoffe</dc:creator>
      <dc:date>2024-08-20T17:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970368#M3540</link>
      <description>&lt;P&gt;The code basically doesn't work, it doesn't do what I want it to do.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 17:05:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970368#M3540</guid>
      <dc:creator>emaguilera</dc:creator>
      <dc:date>2024-08-20T17:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Copy Parameters</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970402#M3541</link>
      <description>&lt;P&gt;I managed to fix it, the error was in the parameter name...&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Emanuel.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 17:23:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/copy-parameters/m-p/12970402#M3541</guid>
      <dc:creator>emaguilera</dc:creator>
      <dc:date>2024-08-20T17:23:47Z</dc:date>
    </item>
  </channel>
</rss>

