<?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 SEHException when CreatingGroup during Updater in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843597#M60598</link>
    <description>&lt;P&gt;We got a function that generates 2D symbols for Rebars in Revit. They Consist of FamilyInstances and DetailLines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All Elements that is created for each Rebar is grouped and the GroupID is stored as a Parameter on the Rebar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each time the command is run, it deletes the Group stored on the Rebar Parameter and re-creates everything that's needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running the function manually it works perfectly but when called from an Updater it crashes on the following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group grp = view.Document.Create.NewGroup(collectionToGroup);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the following Exception:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.Runtime.InteropServices.SEHException occurred&lt;/P&gt;&lt;P&gt;&amp;nbsp; HResult=-2147467259&lt;/P&gt;&lt;P&gt;&amp;nbsp; Message=External component has thrown an exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Source=RevitAPI&lt;/P&gt;&lt;P&gt;&amp;nbsp; ErrorCode=-2147467259&lt;/P&gt;&lt;P&gt;&amp;nbsp; StackTrace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ElementGroupType.createBackup(ADocument* , ElementId , Boolean* , ElementId )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Autodesk.Revit.Creation.ItemFactoryBase.NewGroup(ICollection`1 elementIds)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at AECAB.Structure.Rebar2D.RebarHelperFunctions.Add2DDetalingToRebar(Element el, View view, DetailCurve&amp;amp; MainRebarCurve, Settings settings) in C:\tfs\AECPlus\Revit\2017\Kod\AECABStructual\Rebar2D\HelperFunctions\RebarHelperFunctions.cs:line 658&lt;/P&gt;&lt;P&gt;&amp;nbsp; InnerException:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Is this a bug in Revit or am I missing something?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 16:02:34 GMT</pubDate>
    <dc:creator>clwi</dc:creator>
    <dc:date>2017-01-31T16:02:34Z</dc:date>
    <item>
      <title>SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843597#M60598</link>
      <description>&lt;P&gt;We got a function that generates 2D symbols for Rebars in Revit. They Consist of FamilyInstances and DetailLines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All Elements that is created for each Rebar is grouped and the GroupID is stored as a Parameter on the Rebar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each time the command is run, it deletes the Group stored on the Rebar Parameter and re-creates everything that's needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running the function manually it works perfectly but when called from an Updater it crashes on the following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Group grp = view.Document.Create.NewGroup(collectionToGroup);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the following Exception:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;System.Runtime.InteropServices.SEHException occurred&lt;/P&gt;&lt;P&gt;&amp;nbsp; HResult=-2147467259&lt;/P&gt;&lt;P&gt;&amp;nbsp; Message=External component has thrown an exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Source=RevitAPI&lt;/P&gt;&lt;P&gt;&amp;nbsp; ErrorCode=-2147467259&lt;/P&gt;&lt;P&gt;&amp;nbsp; StackTrace:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ElementGroupType.createBackup(ADocument* , ElementId , Boolean* , ElementId )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Autodesk.Revit.Creation.ItemFactoryBase.NewGroup(ICollection`1 elementIds)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at AECAB.Structure.Rebar2D.RebarHelperFunctions.Add2DDetalingToRebar(Element el, View view, DetailCurve&amp;amp; MainRebarCurve, Settings settings) in C:\tfs\AECPlus\Revit\2017\Kod\AECABStructual\Rebar2D\HelperFunctions\RebarHelperFunctions.cs:line 658&lt;/P&gt;&lt;P&gt;&amp;nbsp; InnerException:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Is this a bug in Revit or am I missing something?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 16:02:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843597#M60598</guid>
      <dc:creator>clwi</dc:creator>
      <dc:date>2017-01-31T16:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843715#M60599</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The IUpdater documentation lists a host of methods that cannot be called (ones that "introduce cross references between elements").&amp;nbsp; NewGroup is not specifically listed and is apparently not throwing the ForbiddenForDynamicUpdateException so in order to figure it out, your best bet is to put together a minimally reproducible case: simple updater, app that registers it, simple file, and addin and post it here so that the Autodesk team can investigate the problem.&amp;nbsp; This type of exception sometimes suggests a potential bug on the Revit side but they need a reproducible case to make that determination.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;strip out all unnecessary steps, just the newLine and the newGroup calls, see if you can reproduce it that way and then post the zipped reproducible case with addin file and specific instructions on how to reproduce.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is an example:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/sehexception-on-checkoutelements/m-p/6049533#M14462" target="_blank"&gt;https://forums.autodesk.com/t5/revit-api-forum/sehexception-on-checkoutelements/m-p/6049533#M14462&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 16:39:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843715#M60599</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-31T16:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843862#M60600</link>
      <description>&lt;P&gt;Yes, I'll try to reproduce this issue in a more clean project and post it here as soon as I can.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the information.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 17:24:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6843862#M60600</guid>
      <dc:creator>clwi</dc:creator>
      <dc:date>2017-01-31T17:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845383#M60601</link>
      <description>&lt;P&gt;Got an Updater example with example project file attached below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Video in zip: NewGroupUpdater_SEHException.swf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Claes&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 08:45:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845383#M60601</guid>
      <dc:creator>clwi</dc:creator>
      <dc:date>2017-02-01T08:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845496#M60602</link>
      <description>&lt;P&gt;Hi Claes,&lt;/P&gt;
&lt;P&gt;I've had a quick run over your code.&lt;/P&gt;
&lt;P&gt;There are some issues.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The subtransactions don't appear to be necessary at all, unless you have the need to roll something back.&lt;/LI&gt;
&lt;LI&gt;I could create a group with an updater, but *not* with the elements created within the updater. This makes sense as they haven't been added to the database yet. This will be why your exception is throwing (the first time at least).&lt;/LI&gt;
&lt;LI&gt;When creating a group within the updater, I'm pretty sure the updater fires again as the elements added to the group are modified as a consequence of the grouping.&lt;/LI&gt;
&lt;LI&gt;I understand why you'd want to add lines and group/regroup them with a newly created rebar, but I don't understand why you'd want to do this when modifying a rebar each time.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;While I understand what you are trying to do, I wonder if there is a better way of approaching it? Could you add the updater to the relevant group category? Is there a different workflow you could use?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, I hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:26:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845496#M60602</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-02-01T10:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845526#M60603</link>
      <description>&lt;P&gt;Hi Matt, thanks for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The example code I got doesn't reflect our project to a full extent, to explain it a bit better what happens for us and why some things need to be changed/recreated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since we move or change the Rebar(in our case) it could reflect that the placement of the 2Dsymbols that we're creating showing lines and various symbols depending on the rebar. if the rebar is changed, the placement of the lines drawn should center once again depending on the change(that's why we're currently deleting everything(the whole group so to speak) and re-create them again, reding new FamilyInstances of the symbols we're using and drawing New DetailLines etc that's needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps like you say there's a better workflow(none that I can think of from the top of my head).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In our application we give the user an option to enable/disable the updater so it doesn't nessesary is active the whole time someone changes a rebar, but for thoose working with rebars and what them to show and reflect the corresponding 2D symbols, we more or less need to update the information regulary.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Claes&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:40:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845526#M60603</guid>
      <dc:creator>clwi</dc:creator>
      <dc:date>2017-02-01T10:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: SEHException when CreatingGroup during Updater</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845782#M60604</link>
      <description>&lt;P&gt;Hi Claes,&lt;/P&gt;
&lt;P&gt;Is it possible to repurpose the lines and familyinstances that you already have in the existing group? (Change the location curve, family symbol etc)&lt;/P&gt;
&lt;P&gt;That would stop the need for creating a group at all.&amp;nbsp;It would be just modifying an existing group, and the warning&amp;nbsp;that that creates (modifying the only instance of group) can be suppressed.&lt;/P&gt;
&lt;P&gt;I believe you can probably do what you want without the Group. Your updater would need to store the unique Ids of the associated symbols and lines (extensible storage?), so that modifying the rebar would trigger your updater to check the lines/symbols. You could allow/deny (manual)&amp;nbsp;editing of the lines/symbols as required.&lt;/P&gt;
&lt;P&gt;The method required would be as little like that shown in this blog post of Jeremy's:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2010/08/structural-dynamic-model-update-sample.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2010/08/structural-dynamic-model-update-sample.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Matt&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 12:42:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/sehexception-when-creatinggroup-during-updater/m-p/6845782#M60604</guid>
      <dc:creator>matthew_taylor</dc:creator>
      <dc:date>2017-02-01T12:42:18Z</dc:date>
    </item>
  </channel>
</rss>

