<?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: Material Takeoff Schedule for Selected Elements in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518967#M34592</link>
    <description>&lt;P&gt;After creating the schedule you would have to add a ScheduleFilter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ScheduleFilter(ScheduleFieldId, ScheduleFilterType, String)&lt;/P&gt;&lt;P&gt;With ScheduleFilterType =&amp;nbsp;ScheduleFilterType.Equal and String is the Unique GUID string you've set at an instance in time for your selected elements&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;How to obtain ScheduleFieldId for above:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ViewShedule.Definition = ScheduleDefinition class noted below&lt;/P&gt;&lt;P&gt;Seems you have to iterate all fields via ScheduleDefinition.GetField(Int32) and&amp;nbsp;ScheduleDefinition.GetFieldCount&lt;/P&gt;&lt;P&gt;Not sure if index is 0 based or 1 based (index is related to field order in schedule).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The .GetField metod returns a ScheduleField object that has a .ParameterID property you can use to match against your target SharedParameterElement. Would be nice if there was a method to get the relationship directly i.e.&amp;nbsp; .GetField(SharedParameterGUID as GUID) but it seems not to exist,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can add the filter via.&lt;/P&gt;&lt;P&gt;ViewSchedule.Definition.AddFilter(ScheduleFilter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you cycle the selection you need to remove all the filters (ScheduleDefinition.ClearFilters) and add an updated filter.&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 May 2020 14:41:03 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2020-05-15T14:41:03Z</dc:date>
    <item>
      <title>Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9486531#M34589</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to understand if it's possible to create a &lt;EM&gt;Material Takeoff ViewSchedule&lt;/EM&gt; for &lt;STRONG&gt;&lt;U&gt;specific&lt;/U&gt;&lt;/STRONG&gt; elements selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that I can create a schedule for the "&lt;STRONG&gt;Category&lt;/STRONG&gt;" of the &lt;EM&gt;ElementIds&lt;/EM&gt; of the selected elements:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;schedule = ViewSchedule.CreateMaterialTakeoff(document, selectedElementCategoryId);&lt;/LI-CODE&gt;&lt;P&gt;but I'm not sure if that's the same as the actual elements themselves.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone assist to clarify this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 08:19:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9486531#M34589</guid>
      <dc:creator>yafimski</dc:creator>
      <dc:date>2020-05-02T08:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9487256#M34590</link>
      <description>&lt;P&gt;Probably not directly. You could try using .AddFilter and adding a selection filter but I assume that would fail since it isn't something you can do in the UI and Schedules don't support visibility graphics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An indirect method may be to add a shared parameter value to all elements of the category and set a uniform value for the elements within the selection, then filter by that in the schedule. This is a standard approach within the UI so could definitely be automated with the API. Would use a unique string such as a GUID so that every time the command is run elements with the parameter set previously but not currently are filtered out. Don't use a Yes/No parameter because values for Yes will remain from previous in non-selected elements and you'll have to go though those to reset them rather than just setting a new string to filter with.&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2020 19:17:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9487256#M34590</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-05-02T19:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518035#M34591</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;Thanks for your reply. I've been thinking on how to approach this. If I'm not mistaken, you are suggesting to tag a &lt;STRONG&gt;Category&lt;/STRONG&gt; based on the &lt;STRONG&gt;Selection&lt;/STRONG&gt;, and then filter out the &lt;STRONG&gt;ElementIds&lt;/STRONG&gt; that have that tag.&lt;/P&gt;&lt;P&gt;It makes sense, but the generic method for creating the takeoff schedule is:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ViewSchedule CreateMaterialTakeoff(Document document, ElementId categoryId);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example if I have 20 walls of type &lt;EM&gt;Generic_100&lt;/EM&gt;, and I selected only 5 of them, I'd like to send only those 5 to the schedule, not all 20.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you think would be the best way to do this or can you clarify this process?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 07:37:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518035#M34591</guid>
      <dc:creator>yafimski</dc:creator>
      <dc:date>2020-05-15T07:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518967#M34592</link>
      <description>&lt;P&gt;After creating the schedule you would have to add a ScheduleFilter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ScheduleFilter(ScheduleFieldId, ScheduleFilterType, String)&lt;/P&gt;&lt;P&gt;With ScheduleFilterType =&amp;nbsp;ScheduleFilterType.Equal and String is the Unique GUID string you've set at an instance in time for your selected elements&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;How to obtain ScheduleFieldId for above:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;ViewShedule.Definition = ScheduleDefinition class noted below&lt;/P&gt;&lt;P&gt;Seems you have to iterate all fields via ScheduleDefinition.GetField(Int32) and&amp;nbsp;ScheduleDefinition.GetFieldCount&lt;/P&gt;&lt;P&gt;Not sure if index is 0 based or 1 based (index is related to field order in schedule).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The .GetField metod returns a ScheduleField object that has a .ParameterID property you can use to match against your target SharedParameterElement. Would be nice if there was a method to get the relationship directly i.e.&amp;nbsp; .GetField(SharedParameterGUID as GUID) but it seems not to exist,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can add the filter via.&lt;/P&gt;&lt;P&gt;ViewSchedule.Definition.AddFilter(ScheduleFilter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you cycle the selection you need to remove all the filters (ScheduleDefinition.ClearFilters) and add an updated filter.&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 14:41:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518967#M34592</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-05-15T14:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518998#M34593</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1035859"&gt;@RPTHOMAS108&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;I'm not very familiar with &lt;STRONG&gt;Schedule Filters&lt;/STRONG&gt;, but I understand you mean that the selected elements should be filtered in the schedule, based on the unique &lt;STRONG&gt;GUID&lt;/STRONG&gt; string right?&lt;/P&gt;&lt;P&gt;But in that case, if I selected 5 walls but gave the &lt;STRONG&gt;GUID&lt;/STRONG&gt; to 20 of them based on the wall &lt;STRONG&gt;CategoryId&lt;/STRONG&gt;, the schedule will still contain 20 elements.&lt;/P&gt;&lt;P&gt;Not sure I understand how schedule filters can be applied in a way that helps me &lt;U&gt;before&lt;/U&gt; placing the elements in the schedule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did I understand your reply correctly..?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I need to assign the SharedParameter to the entire Type of wall, and then apply the GUID only to selected instances? That would make more sense right? Just not sure if that's the way to go about it / if it's possible like that.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 14:50:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9518998#M34593</guid>
      <dc:creator>yafimski</dc:creator>
      <dc:date>2020-05-15T14:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Material Takeoff Schedule for Selected Elements</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9519024#M34594</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you select 5 elements the GUID is added within your new parameter to those five elements and the schedule is filtered to those 5 elements because the filter condition of the schedule is to only show items with that parameter containing that GUID value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you then select 5 alternative elements then you create a new GUID set the parameter value of those 5 elements to that and update the filters in the schedule (remove all filter and add new filter).&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 14:59:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/material-takeoff-schedule-for-selected-elements/m-p/9519024#M34594</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2020-05-15T14:59:41Z</dc:date>
    </item>
  </channel>
</rss>

