<?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: Issues with Viewport.CanAddViewToSheet method in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8759192#M42749</link>
    <description>&lt;P&gt;Here is the file.&lt;/P&gt;
&lt;P&gt;Views are placed on sheets only if this line is off: (full code is provided in the macro)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 668px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/631077i6A56711F8594798B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Apr 2019 10:58:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-04-29T10:58:22Z</dc:date>
    <item>
      <title>Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8758955#M42747</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;Despite the fact,&amp;nbsp; all the conditions for view placement on sheet are met, Viewport.CanAddViewToSheet method constantly returns false value;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;bool&lt;/SPAN&gt;&amp;nbsp;result = Viewport.&lt;SPAN&gt;CanAddViewToSheet&lt;/SPAN&gt;(view.Document,&amp;nbsp;view.Id,&amp;nbsp;sheet.Id);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if I try to place the view on the sheet without checking whether the view CanAddViewToSheet, everything works fine. I provide the same input arguments in both cases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Viewport.&lt;SPAN&gt;Create&lt;/SPAN&gt;(view.Document,&amp;nbsp;sheet.Id,&amp;nbsp;view.Id,&amp;nbsp;&lt;SPAN&gt;new&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;XYZ&lt;/SPAN&gt;(&lt;SPAN&gt;0&lt;/SPAN&gt;,&amp;nbsp;&lt;SPAN&gt;0&lt;/SPAN&gt;,&amp;nbsp;&lt;SPAN&gt;0&lt;/SPAN&gt;));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have seen, that a year ago&amp;nbsp;@Anonymous asked the same question in the post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-to-add-views-on-a-sheet/td-p/7935024" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/how-to-add-views-on-a-sheet/td-p/7935024&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;and was not answered. Does anyone experienced similar issues with this method?&lt;/P&gt;
&lt;P&gt;Edit: I use views of ViewPlan class&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 08:49:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8758955#M42747</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-29T08:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8758990#M42748</link>
      <description>&lt;P&gt;I tried the same code you provided in Revit 2020 and it returned true. Maybe your file has been corrupted or your sheet, the view has a problem about that method. Can you provide a sample file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps,&lt;/P&gt;
&lt;P&gt;Recep.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 09:16:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8758990#M42748</guid>
      <dc:creator>recepagah12</dc:creator>
      <dc:date>2019-04-29T09:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8759192#M42749</link>
      <description>&lt;P&gt;Here is the file.&lt;/P&gt;
&lt;P&gt;Views are placed on sheets only if this line is off: (full code is provided in the macro)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 668px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/631077i6A56711F8594798B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2019 10:58:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8759192#M42749</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-29T10:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8761470#M42750</link>
      <description>&lt;P&gt;Does anyone?&lt;/P&gt;
&lt;P&gt;I was looking for workarounds, and what I noticed is that views that are placed on sheet has the parameter:&lt;/P&gt;
&lt;P&gt;'Sheet Number', whilst views that are not placed don't. Do you think this could be a good direction to check whether view is already placed on sheet?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 527px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/631446iA8DE21D80961005F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 08:02:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/8761470#M42750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-30T08:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12562640#M42751</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;, 5 years later - did you manage to figure it out?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2024 17:01:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12562640#M42751</guid>
      <dc:creator>mizrachi_amir2</dc:creator>
      <dc:date>2024-02-15T17:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12649756#M42752</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When a view belongs to a sheet Revit adds the Sheet Name parameter, otherwise, when the view does not belong to a sheet the Sheet Name parameter does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I implemented this simple method to check if it is possible to add a view to a sheet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private bool CanAddViewToSheet(Autodesk.Revit.DB.View view)
{
    ParameterSet parameterSet = view.Parameters;
    Parameter sheetName = view.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NAME);

    return !parameterSet.Contains(sheetName);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Use:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;if (CanAddViewToSheet(view))
{
    //Create
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 03:50:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12649756#M42752</guid>
      <dc:creator>Speed_CAD</dc:creator>
      <dc:date>2024-03-19T03:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with Viewport.CanAddViewToSheet method</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12982065#M42753</link>
      <description>&lt;P&gt;Seems like you've passing parameters in the wrong order here. The sheet id should be the second, the view id should be the third parameter.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;bool result = Viewport.CanAddViewToSheet(view.Document, sheet.Id, view.Id);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 17:01:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/issues-with-viewport-canaddviewtosheet-method/m-p/12982065#M42753</guid>
      <dc:creator>alexander_tomkeiev</dc:creator>
      <dc:date>2024-08-26T17:01:57Z</dc:date>
    </item>
  </channel>
</rss>

