<?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: Need location of geometry imorted from OBJ file in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662555#M50674</link>
    <description>&lt;P&gt;I am sure there are workable solutions for this, e.g., create a family definition containing a direct shape and place instances of that, which do have a valid location point, or explore how to use the&amp;nbsp;DirectShapeLibrary class:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm" target="_blank"&gt;https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt; DirectShapeLibrary is used to store pre-created geometry for further referencing via the definition/instance mechanism.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Oct 2021 19:46:49 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2021-10-02T19:46:49Z</dc:date>
    <item>
      <title>Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/7945065#M50671</link>
      <description>&lt;P&gt;I used DirectShape to load the geometry from obj file. Model is coming good in Revit. However I want to create family&amp;nbsp;for all components in OBJ file.&amp;nbsp;To place instance of each family&amp;nbsp;at correction location so that complete assembly can be formed correctly, I need location of each family created&amp;nbsp;by using DirectShape. DirectShape does have property as&amp;nbsp;"Location", but it is giving NULL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me how to get location of newly imported geometry by using DirectShape.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Apr 2018 14:41:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/7945065#M50671</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-19T14:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/7950809#M50672</link>
      <description>&lt;P&gt;I think the direct shape is always created exactly where you specify it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please check what happens if you move it manually after it has been created?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe that sets the location somehow?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use RevitLookup to examine the result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have not yet installed RevitLookup, you should do so immediately, right away, before doing a single other thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is an invaluable Revit database exploration and analysis tool, and you cannot effectively develop add-ins without it.&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;Jeremy&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 16:41:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/7950809#M50672</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-22T16:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662532#M50673</link>
      <description>&lt;P&gt;Still not possible in Revit 2021 .. Element.Location property returns a Location object that can't be cast to Location Point or Location Curve .. Dead end ..&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 19:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662532#M50673</guid>
      <dc:creator>bahaaeldien.metwaly</dc:creator>
      <dc:date>2021-10-02T19:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662555#M50674</link>
      <description>&lt;P&gt;I am sure there are workable solutions for this, e.g., create a family definition containing a direct shape and place instances of that, which do have a valid location point, or explore how to use the&amp;nbsp;DirectShapeLibrary class:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm" target="_blank"&gt;https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;gt; DirectShapeLibrary is used to store pre-created geometry for further referencing via the definition/instance mechanism.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 19:46:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662555#M50674</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-10-02T19:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662570#M50675</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/824630"&gt;@jeremy_tammik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I am sure there are workable solutions for this, &lt;U&gt;&lt;STRONG&gt;e.g., create a family definition containing a direct shape and place instances of that, which do have a valid location point&lt;/STRONG&gt;&lt;/U&gt;, or explore how to use the&amp;nbsp;DirectShapeLibrary class:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm" target="_blank" rel="noopener"&gt;https://www.revitapidocs.com/2022/07489bae-ab9f-e2a8-0ac1-0a4d70cea458.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;gt; DirectShapeLibrary is used to store pre-created geometry for further referencing via the definition/instance mechanism.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;The underlined is exactly what we are looking to do .. but automatically, so Imagine you received a model in IFC format , and you need to replace a couple of hundred elements(DirectShape)s with proper families .. You can't extract their location and you can't change their type to proper FamilyType of the same category.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I'll try to explore the&amp;nbsp;DirectShapeLibrary a bit though. Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 20:06:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10662570#M50675</guid>
      <dc:creator>bahaaeldien.metwaly</dc:creator>
      <dc:date>2021-10-02T20:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10663210#M50676</link>
      <description>&lt;P&gt;Yes you can use the Transform.Origin of the direct shape instance when you use instance/type approach rather than just creating a isolated direct shape.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using type/instance approach with DirectShapeLibrary or DirectShape.CreateElementInstance also allows type category bound parameters to be added in the project to the direct shape type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Function Obj_211003a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result
        Dim uidoc = commandData.Application.ActiveUIDocument
        Dim IntDoc = uidoc.Document

        Dim Pt As New XYZ(0, 0, 0)
        Dim Unit As Double = 0.5

        Dim Fr As New Frame(Pt, XYZ.BasisX, XYZ.BasisY, XYZ.BasisZ)
        Dim LN As Line = Line.CreateBound(Pt - (XYZ.BasisZ * Unit), Pt + (XYZ.BasisZ * Unit))
        Dim Pl As Plane = Plane.CreateByNormalAndOrigin(XYZ.BasisY, Pt)
        Dim Arc As Arc = Arc.Create(Pl, Unit, 0, Math.PI)
        Dim Cl As New CurveLoop
        Cl.Append(LN)
        Cl.Append(Arc)
        Dim CLa = New CurveLoop() {Cl}.ToList
        Dim Ob As Solid = GeometryCreationUtilities.CreateRevolvedGeometry(Fr, CLa, 0, 2 * Math.PI)

        Using Tr As New Transaction(IntDoc, "DS")
            If Tr.Start = TransactionStatus.Started Then

                Dim DSt As DirectShapeType = DirectShapeType.Create(IntDoc, "Sphere", New ElementId(BuiltInCategory.OST_GenericModel))
                DSt.AppendShape(New GeometryObject(0) {Ob}.ToList)

                Dim Location As New XYZ(10, 15, 20)
                Dim T As Transform = Transform.CreateTranslation(Location)

                Dim DSL = DirectShapeLibrary.GetDirectShapeLibrary(IntDoc)
                DSL.AddDefinitionType("Sphere_AA", DSt.Id)

                'Contains geometry transform with origin
                Dim LL As List(Of GeometryObject) = DirectShape.CreateGeometryInstance(IntDoc, "Sphere_AA", T)

                Dim DSX = DirectShape.CreateElement(IntDoc, New ElementId(BuiltInCategory.OST_GenericModel))
                DSX.SetShape(LL)

                'This set below is apparently not required but it associates the instance with the type
                'Therefore any type parameters added in project to the associated category will be available in the DS type
                DSX.SetTypeId(DSt.Id)

                Tr.Commit()

            End If
        End Using

        Return Result.Succeeded
    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you extract the geometry of the above shape it will contain a GeometryInstance with Transform.Origin set to 10,15,20 and the symbol geometry will be at 0,0,0.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 11:21:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10663210#M50676</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-10-03T11:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need location of geometry imorted from OBJ file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10663238#M50677</link>
      <description>That's very helpful .. Thank you Thomas!..</description>
      <pubDate>Sun, 03 Oct 2021 11:37:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/need-location-of-geometry-imorted-from-obj-file/m-p/10663238#M50677</guid>
      <dc:creator>bahaaeldien.metwaly</dc:creator>
      <dc:date>2021-10-03T11:37:39Z</dc:date>
    </item>
  </channel>
</rss>

