Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!...

Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!...

antonio_hipolito
Enthusiast Enthusiast
773 Views
1 Reply
Message 1 of 2

Analysis Spatial Field Maganer with Curve Reference - Diagram always vertical!...

antonio_hipolito
Enthusiast
Enthusiast

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...

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!

Any clue? It is a definition within Display style?

 

SFM with curvesSFM with curves

 

code (VB .NET)

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

 

0 Likes
Accepted solutions (1)
774 Views
1 Reply
Reply (1)
Message 2 of 2

antonio_hipolito
Enthusiast
Enthusiast
Accepted solution

Ok... find myself the solution, back to the REVIT API reference 🙂

0 Likes