Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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 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
Solved! Go to Solution.