39c5ef7737
- piccola miglioria a numerazione curve in analisi.
114 lines
4.4 KiB
VB.net
114 lines
4.4 KiB
VB.net
Imports EgtUILib
|
|
|
|
Module Analyze
|
|
|
|
Private m_AnaGrpId As Integer = GDB_ID.NULL
|
|
|
|
Function CreateAnalyzeGroup() As Boolean
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
If m_AnaGrpId = GDB_ID.NULL Then
|
|
m_AnaGrpId = EgtCreateGroup( GDB_ID.ROOT)
|
|
EgtSetName( m_AnaGrpId, "$$ANALYZE")
|
|
EgtSetLevel( m_AnaGrpId, GDB_LV.TEMP)
|
|
Else
|
|
EgtEmptyGroup( m_AnaGrpId)
|
|
End If
|
|
EgtUnselectableAdd( m_AnaGrpId)
|
|
If bEnMod Then EgtEnableModified()
|
|
Return ( m_AnaGrpId <> GDB_ID.NULL)
|
|
End Function
|
|
|
|
Function ClearAnalyzeGroup() As Boolean
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
EgtEmptyGroup( m_AnaGrpId)
|
|
If bEnMod Then EgtEnableModified()
|
|
Return ( m_AnaGrpId <> GDB_ID.NULL)
|
|
End Function
|
|
|
|
Function EraseAnalyzeGroup() As Boolean
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
EgtUnselectableRemove( m_AnaGrpId)
|
|
EgtErase( m_AnaGrpId)
|
|
m_AnaGrpId = GDB_ID.NULL
|
|
If bEnMod Then EgtEnableModified()
|
|
Return True
|
|
End Function
|
|
|
|
Function CreateNormal( nId As Integer, nFac As Integer) As Boolean
|
|
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
Dim ptC As Point3d
|
|
Dim vtN As Vector3d
|
|
If EgtSurfTmFacetCenter( nId, nFac, GDB_ID.ROOT, ptC, vtN) Then
|
|
Dim nNormId As Integer = EgtCreateGeoVector( m_AnaGrpId, 50 * vtN, ptC, GDB_RT.GLOB)
|
|
EgtSetColor( nNormId, New Color3d( 255, 0,0))
|
|
End If
|
|
If bEnMod Then EgtEnableModified()
|
|
Return True
|
|
End Function
|
|
|
|
Function CreateFacetLoops( nId As Integer, nFac As Integer) As Boolean
|
|
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
Dim nCount As Integer
|
|
Dim nFirstId As Integer = EgtExtractSurfTmFacetLoops( nId, nFac, m_AnaGrpId, nCount)
|
|
If nFirstId <> GDB_ID.NULL Then
|
|
For nCrvId As Integer = nFirstId To nFirstId + nCount - 1
|
|
EgtSetColor( nCrvId, New Color3d( 255, 0,0))
|
|
Next
|
|
End If
|
|
If bEnMod Then EgtEnableModified()
|
|
Return True
|
|
End Function
|
|
|
|
Function CreateCurveCompoPntNbrs( nId As Integer) As Boolean
|
|
If m_AnaGrpId = GDB_ID.NULL Then Return False
|
|
Dim bEnMod As Boolean = EgtGetEnableModified()
|
|
EgtDisableModified()
|
|
'Riferimento della griglia corrente
|
|
Dim refGrid As Frame3d = EgtGetGridFrame()
|
|
'Nuovo riferimento griglia con Z come versore estrusione della curva
|
|
Dim vtExtr As Vector3d : EgtCurveExtrusion( nId, vtExtr)
|
|
If Not vtExtr.IsSmall() Then
|
|
Dim refCrv As New Frame3d : refCrv.Setup( EgtGetGridOrigin(), vtExtr)
|
|
EgtSetGridFrame( refCrv)
|
|
End If
|
|
'Recupero il numero di curve semplici
|
|
Dim dStart, dEnd As Double
|
|
EgtCurveDomain( nId, dStart, dEnd)
|
|
Dim nCount As Integer = CInt( dEnd - dStart) - 1
|
|
' Ciclo sulle curve semplici
|
|
For i As Integer = 0 To nCount
|
|
'Scrivo il punto iniziale di ogni curva componente
|
|
Dim ptS As Point3d
|
|
EgtAtParamPoint( nId, i, GDB_ID.GRID, ptS)
|
|
Dim nPntId As Integer = EgtCreateGeoPoint( m_AnaGrpId, ptS, GDB_RT.GRID)
|
|
EgtSetColor( nPntId, New Color3d( 255, 0,0))
|
|
'Scrivo il numero identificativo di ogni curva componente
|
|
Dim ptP As Point3d
|
|
EgtAtParamPoint( nId, i + 0.5, GDB_ID.GRID, ptP)
|
|
Dim dLen As Double = 2 * Point3d.Dist( ptS, ptP)
|
|
Dim dH As Double = Math.Min( 0.25 * dLen, 10)
|
|
Dim nTxtId As Integer = EgtCreateTextAdv( m_AnaGrpId, ptP, 0, i.ToString(), "", 100, False, dH, 1, 0, INS_POS.MC, GDB_RT.GRID)
|
|
EgtSetColor( nTxtId, New Color3d( 255, 0,0))
|
|
Next
|
|
'Se curva aperta aggiungo il punto finale
|
|
If Not EgtCurveIsClosed( nId) Then
|
|
Dim ptE As Point3d
|
|
EgtEndPoint( nId, GDB_ID.GRID, ptE)
|
|
Dim nPntId As Integer = EgtCreateGeoPoint( m_AnaGrpId, ptE, GDB_RT.GRID)
|
|
EgtSetColor( nPntId, New Color3d( 255, 0,0))
|
|
End If
|
|
'Reimposto il riferimento originale alla griglia
|
|
EgtSetGridFrame( refGrid)
|
|
If bEnMod Then EgtEnableModified()
|
|
Return True
|
|
End Function
|
|
|
|
End Module
|