<?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: Writing wall builtin parameter (width) to a shared parameter for wall types in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7273104#M57035</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2825272" target="_blank"&gt;msweeney&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;SPAN&gt;Benoit mentioned:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"The width parameter is a parameter of the WallType not of the Wall itself."&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you want to set width to Wall itself, you need to do as follows:&lt;/P&gt;
&lt;P&gt;1. define a shared parameter to Wall&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. copy the width value from WallType to shared parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As how to create a shared parameter, you can refer to the attachment.&lt;/P&gt;
&lt;P&gt;It is a SDK sample project.&lt;/P&gt;
&lt;P&gt;The core codes to create shared parameter as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// cache application handle
                Autodesk.Revit.ApplicationServices.Application revitApp = m_commandData.Application.Application;

                // prepare shared parameter file
                m_commandData.Application.Application.SharedParametersFilename = paramFile;

                // open shared parameter file
                DefinitionFile parafile = revitApp.OpenSharedParameterFile();

                // create a group
                DefinitionGroup apiGroup = parafile.Groups.Create("SDKSampleRoomScheduleGroup");

                // create a visible "External Room ID" of text type.
                ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions = new ExternalDefinitionCreationOptions(RoomsData.SharedParam, ParameterType.Text);
                Definition roomSharedParamDef = apiGroup.Definitions.Create(ExternalDefinitionCreationOptions);

                // get Rooms category
                Category roomCat = m_commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms);
                CategorySet categories = revitApp.Create.NewCategorySet();
                categories.Insert(roomCat);

                // insert the new parameter
                InstanceBinding binding = revitApp.Create.NewInstanceBinding(categories);
                m_commandData.Application.ActiveUIDocument.Document.ParameterBindings.Insert(roomSharedParamDef, binding);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Aug 2017 04:14:37 GMT</pubDate>
    <dc:creator>JimJia</dc:creator>
    <dc:date>2017-08-03T04:14:37Z</dc:date>
    <item>
      <title>Writing wall builtin parameter (width) to a shared parameter for wall types</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7253434#M57032</link>
      <description>&lt;P&gt;I am fairly new to coding and the Revit API and I'm trying to write what should be a pretty basic Macro in C# to take the built in parameter of wall width and write it to a taggable shared parameter. I have been struggling to make this work. This seems so simple and I can make it work in Dynamo without an issue. I've tried getting the built in parameter, tried it as an element. i'm really struggling with what seems to be fairly easy. any pointers would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;//collect all wall types
			FilteredElementCollector wallTypeColl = new FilteredElementCollector(doc);
			wallTypeColl.OfClass(typeof(WallType));

			//get basic walls
			foreach(WallType wt in wallTypeColl)
			{
				dblWidth=wt.Width;
				wallsBasic.Add(dblWidth.ToString());
				wt.LookupParameter(wallThickness).Set(dblWidth);
			}&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jul 2017 18:40:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7253434#M57032</guid>
      <dc:creator>msweeneyPES</dc:creator>
      <dc:date>2017-07-25T18:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: Writing wall builtin parameter (width) to a shared parameter for wall types</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7270138#M57033</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_6d55a23fe56e64" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2825272" target="_self"&gt;msweeney&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;I am afraid that I am not quite follow your question.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Could you describe what is the problem you met?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;You cannot set the shared parameter value or there is any exception when you run the code or anything else?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Per your codes, you get wall type, find its "wallThickness" parameter and set its value to wt.Width.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;we can give you some help if we can get some more details.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 03:55:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7270138#M57033</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2017-08-02T03:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Writing wall builtin parameter (width) to a shared parameter for wall types</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7270420#M57034</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have been struggling with that issue for a while.&lt;/P&gt;&lt;P&gt;The width parameter is a parameter of the WallType not of the Wall itself.&lt;/P&gt;&lt;P&gt;Try&amp;nbsp;&lt;/P&gt;&lt;P&gt;myWall.WallType.Width&lt;/P&gt;&lt;P&gt;as parameter on which you base your search instead of a direct parameter of the wall itself (I have tried all of them with no success).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Benoit&lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 07:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7270420#M57034</guid>
      <dc:creator>BenoitE&amp;A</dc:creator>
      <dc:date>2017-08-02T07:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Writing wall builtin parameter (width) to a shared parameter for wall types</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7273104#M57035</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2825272" target="_blank"&gt;msweeney&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;SPAN&gt;Benoit mentioned:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"The width parameter is a parameter of the WallType not of the Wall itself."&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you want to set width to Wall itself, you need to do as follows:&lt;/P&gt;
&lt;P&gt;1. define a shared parameter to Wall&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. copy the width value from WallType to shared parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As how to create a shared parameter, you can refer to the attachment.&lt;/P&gt;
&lt;P&gt;It is a SDK sample project.&lt;/P&gt;
&lt;P&gt;The core codes to create shared parameter as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// cache application handle
                Autodesk.Revit.ApplicationServices.Application revitApp = m_commandData.Application.Application;

                // prepare shared parameter file
                m_commandData.Application.Application.SharedParametersFilename = paramFile;

                // open shared parameter file
                DefinitionFile parafile = revitApp.OpenSharedParameterFile();

                // create a group
                DefinitionGroup apiGroup = parafile.Groups.Create("SDKSampleRoomScheduleGroup");

                // create a visible "External Room ID" of text type.
                ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions = new ExternalDefinitionCreationOptions(RoomsData.SharedParam, ParameterType.Text);
                Definition roomSharedParamDef = apiGroup.Definitions.Create(ExternalDefinitionCreationOptions);

                // get Rooms category
                Category roomCat = m_commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms);
                CategorySet categories = revitApp.Create.NewCategorySet();
                categories.Insert(roomCat);

                // insert the new parameter
                InstanceBinding binding = revitApp.Create.NewInstanceBinding(categories);
                m_commandData.Application.ActiveUIDocument.Document.ParameterBindings.Insert(roomSharedParamDef, binding);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2017 04:14:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7273104#M57035</guid>
      <dc:creator>JimJia</dc:creator>
      <dc:date>2017-08-03T04:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Writing wall builtin parameter (width) to a shared parameter for wall types</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7692207#M57036</link>
      <description>&lt;P&gt;The answer seemed to be more in the collection of walls. Adjusting the filtered element collector to this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//collect all wall types&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FilteredElementCollector wallTypeColl =&amp;nbsp;&lt;SPAN&gt;new&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;FilteredElementCollector&lt;/SPAN&gt;(doc);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;wallTypeColl.&lt;SPAN&gt;OfClass&lt;/SPAN&gt;(&lt;SPAN&gt;typeof&lt;/SPAN&gt;(WallType)).&lt;SPAN&gt;OfCategory&lt;/SPAN&gt;(BuiltInCategory.OST_Walls);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;allowed the previously posted code to work as intended.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2018 21:12:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/writing-wall-builtin-parameter-width-to-a-shared-parameter-for/m-p/7692207#M57036</guid>
      <dc:creator>msweeneyPES</dc:creator>
      <dc:date>2018-01-15T21:12:04Z</dc:date>
    </item>
  </channel>
</rss>

