<?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: Creating BuildingPad : Default Type Not Found in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543063#M24380</link>
    <description>&lt;P&gt;there is a mismatch in your FilteredElementCollector. The elementtype of a buildingpad is BuildingPadType , so your casting to BuildingPad is faulty.&lt;/P&gt;&lt;P&gt;Actually you don't need a collector at all. Just query revit for&amp;nbsp; the default BuildingPadTypeId&lt;/P&gt;&lt;LI-CODE lang="general"&gt;doc.GetDefaultElementTypeId(ElementTypeGroup.BuildingPadType)&lt;/LI-CODE&gt;&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Aug 2021 12:01:23 GMT</pubDate>
    <dc:creator>FAIR59</dc:creator>
    <dc:date>2021-08-13T12:01:23Z</dc:date>
    <item>
      <title>Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10542586#M24378</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I&amp;nbsp; am&amp;nbsp; trying to create a building pad. To pass the BuildingPad Type's Id as an argument for the BuildingPad.Create () method, I am trying to get the "first" type in the document like this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;BuildingPad buildingPad = new FilteredElementCollector(doc)
                	.OfCategory(BuiltInCategory.OST_BuildingPad)
                	.WhereElementIsElementType()
                	.ToElements().First() as BuildingPad;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, this doesn't return a building pad type.&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;I checked if the count() of the collector, and&amp;nbsp; could see that it was 0 (zero).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;I tried creating an instance of the default buildingpad type and deleted the instance and tried running the code and then it showed&amp;nbsp; 1 item in the collector. So I understand, unless an instance is created, the type&amp;nbsp; is not counted. Why is it so?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a new document&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 08:29:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10542586#M24378</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-13T08:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543033#M24379</link>
      <description>&lt;P&gt;Probably has been purged out of template you are using somehow (shouldn't usually be possible these days). Historically we've been able to remove things with API that shouldn't be removed i.e. last types and even project browser view.&amp;nbsp; If you start a blank metric template you can see such Types with RevitLookup.&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="210813a.PNG" style="width: 298px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/952456i44BFC28E72330AA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="210813a.PNG" alt="210813a.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However BuildingPad elements can only exist once you have a TopographicalSurface in the project:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g. so similarly&amp;nbsp; in the UI the Building Pad icon will be unavailable if there is no topo:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="210813.PNG" style="width: 252px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/952454i3CB9155F08219EAB/image-size/large?v=v2&amp;amp;px=999" role="button" title="210813.PNG" alt="210813.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So that could be part of the reason.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 11:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543033#M24379</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-08-13T11:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543063#M24380</link>
      <description>&lt;P&gt;there is a mismatch in your FilteredElementCollector. The elementtype of a buildingpad is BuildingPadType , so your casting to BuildingPad is faulty.&lt;/P&gt;&lt;P&gt;Actually you don't need a collector at all. Just query revit for&amp;nbsp; the default BuildingPadTypeId&lt;/P&gt;&lt;LI-CODE lang="general"&gt;doc.GetDefaultElementTypeId(ElementTypeGroup.BuildingPadType)&lt;/LI-CODE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 12:01:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543063#M24380</guid>
      <dc:creator>FAIR59</dc:creator>
      <dc:date>2021-08-13T12:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543687#M24381</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 for the info, Thomas. I had not considered that possibility. Now I notice it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I thought Pad&amp;nbsp; was a system family like walls or floors. How come they are not 'activated' until one instance is created? Is it a similar algorithm&amp;nbsp; running in&amp;nbsp; background to save memory like other component families, for which the Types are to be activated before using...?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 16:12:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543687#M24381</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-13T16:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543694#M24382</link>
      <description>I Tried this too. But this also is working only if atleast one pad instance was created....</description>
      <pubDate>Fri, 13 Aug 2021 16:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10543694#M24382</guid>
      <dc:creator>harilalmn</dc:creator>
      <dc:date>2021-08-13T16:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating BuildingPad : Default Type Not Found</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10545985#M24383</link>
      <description>&lt;P&gt;Some templates such as the 'Construction Template' do not have any BuildingPadType elements within them. Therefore you need to see if you find any and then use&amp;nbsp;BuildingPadType.CreateDefault if you don't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that as previously noted you'll need a topo surface under the pad or you'll get InvalidOperationException upon trying to create the BuildingPad instance.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public Result Obj_210814a(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
{

    UIDocument UIDoc = commandData.Application.ActiveUIDocument;
    if (UIDoc == null)
        return Result.Cancelled;
    Document IntDoc = UIDoc.Document;

    FilteredElementCollector FEC = new FilteredElementCollector(IntDoc);
    ElementCategoryFilter ECF = new ElementCategoryFilter(BuiltInCategory.OST_BuildingPad);
    List&amp;lt;ElementId&amp;gt; Eids = FEC.WherePasses(ECF).WhereElementIsElementType().ToElementIds() as List&amp;lt;ElementId&amp;gt;;

    BuildingPadType BPType = null;
    if (Eids.Count == 0)
    {
        using (Transaction Tx = new Transaction(IntDoc, "Create default pad type"))
        {
            if (Tx.Start() == TransactionStatus.Started)
            {
                BPType = BuildingPadType.CreateDefault(IntDoc);
                Tx.Commit();
            }
        }
    }
    else
    {
        BPType = IntDoc.GetElement(Eids[0]) as BuildingPadType;
    }
     FilteredElementCollector FEC_L = new FilteredElementCollector(IntDoc);
     ElementClassFilter ECF_L = new ElementClassFilter(typeof(Level));
     List&amp;lt;Level&amp;gt; Lvs = FEC_L.WherePasses(ECF_L).ToElements().Cast&amp;lt;Level&amp;gt;().ToList();
     Level Lv = Lvs.Find(L =&amp;gt; L.Elevation == Lvs.Min(L0 =&amp;gt; L0.Elevation));

    using (Transaction Tx = new Transaction(IntDoc, "Create pad imstance"))
    {

        if (Tx.Start() == TransactionStatus.Started)
        {
            double Val = 3000 / 304.8;
            XYZ C0 = new XYZ(-Val / 2, Val / 2, 0);
            XYZ C1 = new XYZ(-Val / 2, -Val / 2, 0);
            XYZ C2 = new XYZ(Val / 2, -Val / 2, 0);
            XYZ C3 = new XYZ(Val / 2, Val / 2, 0);

            CurveLoop CL = new CurveLoop();
            CL.Append(Line.CreateBound(C0, C1));
            CL.Append(Line.CreateBound(C1, C2));
            CL.Append(Line.CreateBound(C2, C3));
            CL.Append(Line.CreateBound(C3, C0));

            BuildingPad.Create(IntDoc, BPType.Id, Lv.Id, new CurveLoop[] { CL }.ToList());

            Tx.Commit();
        }
    }
    return Result.Succeeded;
}&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 14 Aug 2021 22:53:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/creating-buildingpad-default-type-not-found/m-p/10545985#M24383</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-08-14T22:53:07Z</dc:date>
    </item>
  </channel>
</rss>

