<?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: Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!... in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/analysis-spatial-field-maganer-with-curve-reference-diagram/m-p/10284015#M26199</link>
    <description>&lt;P&gt;Ok... find myself the solution, back to the REVIT API reference &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 01 May 2021 17:10:01 GMT</pubDate>
    <dc:creator>antonio_hipolito</dc:creator>
    <dc:date>2021-05-01T17:10:01Z</dc:date>
    <item>
      <title>Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!...</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/analysis-spatial-field-maganer-with-curve-reference-diagram/m-p/10283853#M26198</link>
      <description>&lt;P&gt;I'm having trouble with using Spatial Field Manager applied with curve reference, since the diagram is plotted always in vertical direction. If the line is vertical, the diagram cannot be seen...&lt;/P&gt;&lt;P&gt;In the image bellow, the diagram of the horizontal line is OK, orthogonal to the line, that is, vertically plotted; on the other hand, the diagram for the vertical line is not ok since the diagram is also plotted vertically, not orthogonal to the line!&lt;/P&gt;&lt;P&gt;Any clue? It is a definition within Display style?&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="SFM with curves" style="width: 439px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/914212i40A035C90AC7A754/image-size/large?v=v2&amp;amp;px=999" role="button" title="SFM Curve.jpg" alt="SFM with curves" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SFM with curves&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code (VB .NET)&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim ref As Reference
            ref = uidoc.Selection.PickObject(ObjectType.Element, New TypeFilter(Of ModelLine), "Please pick a line")

            If ref IsNot Nothing Then
                Dim mcurve As ModelCurve = doc.GetElement(ref)
                Dim curve = mcurve.GeometryCurve

                Dim sfmanager As SpatialFieldManager = SpatialFieldManager.GetSpatialFieldManager(Data.View)
                If sfmanager Is Nothing Then
                    sfmanager = SpatialFieldManager.CreateSpatialFieldManager(Data.View, 1)
                End If

                ' Get current settings
                Dim resultsIndexList As List(Of Integer) = sfmanager.GetRegisteredResults
                Dim resultsSchemaNameDictionary As New Dictionary(Of String, Integer)
                For Each i As Integer In resultsIndexList
                    resultsSchemaNameDictionary.Add(sfmanager.GetResultSchema(i).Name, i)
                Next

                Dim resultSchema As AnalysisResultSchema
                Dim schemaIndex As Integer
                Dim schemaName As String = "AnalysisTestCurve"
                If resultsSchemaNameDictionary.ContainsKey(schemaName) Then
                    schemaIndex = resultsSchemaNameDictionary(schemaName)
                Else
                    resultSchema = New AnalysisResultSchema(schemaName, "Teste operacional")
                    schemaIndex = sfmanager.RegisterResult(resultSchema)
                    resultsSchemaNameDictionary.Add(schemaName, schemaIndex)
                End If

                Dim ptsList As New List(Of Double)
                Dim valList As New List(Of ValueAtPoint)
                For d As Double = 0 To 1 Step 0.1
                    ptsList.Add(curve.ComputeRawParameter(d))
                    valList.Add(New ValueAtPoint(New List(Of Double) From {(-0.10 + 1 * d - 1 * d ^ 2) * 10}))
                Next
                Dim pnts As New FieldDomainPointsByParameter(ptsList)
                Dim vals As FieldValues = New FieldValues(valList)

                Dim sfprimitive As Integer = sfmanager.AddSpatialFieldPrimitive(curve.Reference)
                sfmanager.UpdateSpatialFieldPrimitive(sfprimitive, pnts, vals, schemaIndex)
            End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 14:51:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/analysis-spatial-field-maganer-with-curve-reference-diagram/m-p/10283853#M26198</guid>
      <dc:creator>antonio_hipolito</dc:creator>
      <dc:date>2021-05-01T14:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!...</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/analysis-spatial-field-maganer-with-curve-reference-diagram/m-p/10284015#M26199</link>
      <description>&lt;P&gt;Ok... find myself the solution, back to the REVIT API reference &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 01 May 2021 17:10:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/analysis-spatial-field-maganer-with-curve-reference-diagram/m-p/10284015#M26199</guid>
      <dc:creator>antonio_hipolito</dc:creator>
      <dc:date>2021-05-01T17:10:01Z</dc:date>
    </item>
  </channel>
</rss>

