EgtUILib 1.5j5 :
- aggiunti operatori e trasformazioni su Vector, Point e Frame3d - modifiche a funzioni di apertura file di Scene
This commit is contained in:
+466
-24
@@ -2,47 +2,353 @@
|
||||
|
||||
Public Class EgtInterface
|
||||
|
||||
Structure Point3d
|
||||
Dim x, y, z As Double
|
||||
Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double)
|
||||
x = dX
|
||||
y = dY
|
||||
z = dZ
|
||||
End Sub
|
||||
Shared Function Media(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d) As Point3d
|
||||
Dim ptMedia As New Point3d(0.5 * (ptP1.x + ptP2.x), 0.5 * (ptP1.y + ptP2.y), 0.5 * (ptP1.z + ptP2.z))
|
||||
Return ptMedia
|
||||
End Function
|
||||
End Structure
|
||||
|
||||
Structure Vector3d
|
||||
' Membri
|
||||
Dim x, y, z As Double
|
||||
' Costruttori
|
||||
Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double)
|
||||
x = dX
|
||||
y = dY
|
||||
z = dZ
|
||||
End Sub
|
||||
Shared Function FromPointDiff(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d) As Vector3d
|
||||
Dim vtV As New Vector3d
|
||||
vtV.x = ptP1.x - ptP2.x
|
||||
vtV.y = ptP1.y - ptP2.y
|
||||
vtV.z = ptP1.z - ptP2.z
|
||||
Sub New(ByRef VtV As Vector3d)
|
||||
x = VtV.x
|
||||
y = VtV.y
|
||||
z = VtV.z
|
||||
End Sub
|
||||
' Vettore opposto
|
||||
Shared Operator -(ByVal VtV1 As Vector3d) As Vector3d
|
||||
Dim vtV As New Vector3d(-VtV1.x, -VtV1.y, -VtV1.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Somma
|
||||
Shared Operator +(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Vector3d
|
||||
Dim vtV As New Vector3d(VtV1.x + VtV2.x, VtV1.y + VtV2.y, VtV1.z + VtV2.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Sottrazione
|
||||
Shared Operator -(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Vector3d
|
||||
Dim vtV As New Vector3d(VtV1.x - VtV2.x, VtV1.y - VtV2.y, VtV1.z - VtV2.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Prodotto con un numero
|
||||
Shared Operator *(ByVal dNum As Double, ByVal VtV2 As Vector3d) As Vector3d
|
||||
Dim vtV As New Vector3d(dNum * VtV2.x, dNum * VtV2.y, dNum * VtV2.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
Shared Operator *(ByVal VtV1 As Vector3d, ByVal dNum As Double) As Vector3d
|
||||
Dim vtV As New Vector3d(dNum * VtV1.x, dNum * VtV1.y, dNum * VtV1.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Divisione per un numero
|
||||
Shared Operator /(ByVal VtV1 As Vector3d, ByVal dDiv As Double) As Vector3d
|
||||
Dim dMul As Double = 1 / dDiv
|
||||
Dim vtV As New Vector3d(dMul * VtV1.x, dMul * VtV1.y, dMul * VtV1.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Prodotto scalare
|
||||
Shared Operator *(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Double
|
||||
Return (VtV1.x * VtV2.x + VtV1.y * VtV2.y + VtV1.z * VtV2.z)
|
||||
End Operator
|
||||
' Prodotto scalare nel piano XY
|
||||
Shared Function ScalarXY(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Double
|
||||
Return (VtV1.x * VtV2.x + VtV1.y * VtV2.y)
|
||||
End Function
|
||||
' Prodotto vettoriale
|
||||
Shared Operator ^(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Vector3d
|
||||
Dim vtV As New Vector3d(VtV1.y * VtV2.z - VtV1.z * VtV2.y,
|
||||
VtV1.z * VtV2.x - VtV1.x * VtV2.z,
|
||||
VtV1.x * VtV2.y - VtV1.y * VtV2.x)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Prodotto vettoriale nel piano XY
|
||||
Shared Function CrossXY(ByVal VtV1 As Vector3d, ByVal VtV2 As Vector3d) As Double
|
||||
Return (VtV1.x * VtV2.y - VtV1.y * VtV2.x)
|
||||
End Function
|
||||
' Quadrato della lunghezza
|
||||
Function SqLen() As Double
|
||||
Return (x * x + y * y + z * z)
|
||||
End Function
|
||||
' Lunghezza
|
||||
Function Len() As Double
|
||||
Return Math.Sqrt(x * x + y * y + z * z)
|
||||
End Function
|
||||
' Normalizzazione
|
||||
Function Normalize(Optional ByVal dEps As Double = EPS_SMALL) As Boolean
|
||||
Return EgtVectorNormalize(x, y, z, dEps)
|
||||
End Function
|
||||
'Rotazione
|
||||
Function Rotate(ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
Return EgtVectorRotate(x, y, z, VtAx, dAngRotDeg)
|
||||
End Function
|
||||
' Scalatura
|
||||
Function Scale(ByRef frRef As Frame3d, ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
Return EgtVectorScale(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ(),
|
||||
dCoeffX, dCoeffY, dCoeffZ)
|
||||
End Function
|
||||
' Mirror
|
||||
Function Mirror(ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
|
||||
Return EgtVectorMirror(x, y, z, VtNorm)
|
||||
End Function
|
||||
' Shear
|
||||
Function Shear(ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
|
||||
Return EgtVectorShear(x, y, z, VtNorm, VtDir, dCoeff)
|
||||
End Function
|
||||
' Cambio di riferimento : dal riferimento al globale
|
||||
Function ToGlob(ByRef frRef As Frame3d) As Boolean
|
||||
If frRef.IsValid Then
|
||||
Return EgtVectorToGlob(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal globale al riferimento
|
||||
Function ToLoc(ByRef frRef As Frame3d) As Boolean
|
||||
If frRef.IsValid Then
|
||||
Return EgtVectorToLoc(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal primo riferimento al secondo
|
||||
Function LocToLoc(ByRef frSou As Frame3d, ByRef frDest As Frame3d) As Boolean
|
||||
If frSou.IsValid And frDest.IsValid Then
|
||||
Return EgtVectorLocToLoc(x, y, z,
|
||||
frSou.Orig(), frSou.VersX(), frSou.VersY(), frSou.VersZ(),
|
||||
frDest.Orig(), frDest.VersX(), frDest.VersY(), frDest.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Versore Asse X
|
||||
Shared Function X_AX() As Vector3d
|
||||
Dim vtZ As New Vector3d(1, 0, 0)
|
||||
Return vtZ
|
||||
End Function
|
||||
' Versore Asse Y
|
||||
Shared Function Y_AX() As Vector3d
|
||||
Dim vtZ As New Vector3d(0, 1, 0)
|
||||
Return vtZ
|
||||
End Function
|
||||
' Versore Asse Z
|
||||
Shared Function Z_AX() As Vector3d
|
||||
Dim vtZ As New Vector3d(0, 0, 1)
|
||||
Return vtZ
|
||||
End Function
|
||||
End Structure
|
||||
|
||||
Structure Point3d
|
||||
' Membri
|
||||
Dim x, y, z As Double
|
||||
' Costruttori
|
||||
Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double)
|
||||
x = dX
|
||||
y = dY
|
||||
z = dZ
|
||||
End Sub
|
||||
Sub New(ByRef PtP As Point3d)
|
||||
x = PtP.x
|
||||
y = PtP.y
|
||||
z = PtP.z
|
||||
End Sub
|
||||
' Somma di un punto e un vettore
|
||||
Shared Operator +(ByVal PtP1 As Point3d, ByVal VtV2 As Vector3d) As Point3d
|
||||
Dim ptP As New Point3d(PtP1.x + VtV2.x, PtP1.y + VtV2.y, PtP1.z + VtV2.z)
|
||||
Return ptP
|
||||
End Operator
|
||||
Shared Operator +(ByVal VtV1 As Vector3d, ByVal PtP2 As Point3d) As Point3d
|
||||
Dim ptP As New Point3d(VtV1.x + PtP2.x, VtV1.y + PtP2.y, VtV1.z + PtP2.z)
|
||||
Return ptP
|
||||
End Operator
|
||||
' Differenza di due punti (produce un vettore)
|
||||
Shared Operator -(ByVal PtP1 As Point3d, ByVal PtP2 As Point3d) As Vector3d
|
||||
Dim vtV As New Vector3d(PtP1.x - PtP2.x, PtP1.y - PtP2.y, PtP1.z - PtP2.z)
|
||||
Return vtV
|
||||
End Operator
|
||||
' Media pesata di due punti (con 0 è il primo, con 1 il secondo, con 0.5 il medio, ...)
|
||||
Shared Function Media(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d, Optional ByVal dCoeff As Double = 0.5) As Point3d
|
||||
Dim ptMedia As New Point3d((1 - dCoeff) * ptP1.x + dCoeff * ptP2.x,
|
||||
(1 - dCoeff) * ptP1.y + dCoeff * ptP2.y,
|
||||
(1 - dCoeff) * ptP1.z + dCoeff * ptP2.z)
|
||||
Return ptMedia
|
||||
End Function
|
||||
' Traslazione
|
||||
Function Move(ByRef VtMove As Vector3d) As Boolean
|
||||
Return EgtPointTranslate(x, y, z, VtMove)
|
||||
End Function
|
||||
' Rotazione
|
||||
Function Rotate(ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
Return EgtPointRotate(x, y, z, PtAx, VtAx, dAngRotDeg)
|
||||
End Function
|
||||
' Scalatura
|
||||
Function Scale(ByRef frRef As Frame3d, ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
Return EgtPointScale(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ(),
|
||||
dCoeffX, dCoeffY, dCoeffZ)
|
||||
End Function
|
||||
' Mirror
|
||||
Function Mirror(ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
|
||||
Return EgtPointMirror(x, y, z, PtOn, VtNorm)
|
||||
End Function
|
||||
' Shear
|
||||
Function Shear(ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
|
||||
Return EgtPointShear(x, y, z, PtOn, VtNorm, VtDir, dCoeff)
|
||||
End Function
|
||||
' Cambio di riferimento : dal riferimento al globale
|
||||
Function ToGlob(ByRef frRef As Frame3d) As Boolean
|
||||
If frRef.IsValid Then
|
||||
Return EgtPointToGlob(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal globale al riferimento
|
||||
Function ToLoc(ByRef frRef As Frame3d) As Boolean
|
||||
If frRef.IsValid Then
|
||||
Return EgtPointToLoc(x, y, z, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal primo riferimento al secondo
|
||||
Function LocToLoc(ByRef frSou As Frame3d, ByRef frDest As Frame3d) As Boolean
|
||||
If frSou.IsValid And frDest.IsValid Then
|
||||
Return EgtPointLocToLoc(x, y, z,
|
||||
frSou.Orig(), frSou.VersX(), frSou.VersY(), frSou.VersZ(),
|
||||
frDest.Orig(), frDest.VersX(), frDest.VersY(), frDest.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Punto Origine
|
||||
Shared Function ORIG() As Point3d
|
||||
Dim ptP As New Point3d(0, 0, 0)
|
||||
Return ptP
|
||||
End Function
|
||||
End Structure
|
||||
|
||||
Class Frame3d
|
||||
' Membri
|
||||
Private PtOrig As Point3d
|
||||
Private VtDirX, VtDirY, VtDirZ As Vector3d
|
||||
Private bOk As Boolean
|
||||
' Costruttori
|
||||
Sub New()
|
||||
PtOrig = Point3d.ORIG
|
||||
VtDirX = Vector3d.X_AX
|
||||
VtDirY = Vector3d.Y_AX
|
||||
VtDirZ = Vector3d.Z_AX
|
||||
bOk = True
|
||||
End Sub
|
||||
Sub New(ByRef PtOri As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d)
|
||||
PtOrig = PtOri
|
||||
VtDirX = VtX
|
||||
VtDirY = VtY
|
||||
VtDirZ = VtZ
|
||||
bOk = VtDirX.Normalize() And VtDirY.Normalize() And VtDirZ.Normalize() And Verify()
|
||||
End Sub
|
||||
Sub New(ByRef PtOri As Point3d)
|
||||
PtOrig = PtOri
|
||||
VtDirX = Vector3d.X_AX
|
||||
VtDirY = Vector3d.Y_AX
|
||||
VtDirZ = Vector3d.Z_AX
|
||||
bOk = True
|
||||
End Sub
|
||||
' Inizializzatori
|
||||
Public Function Setup(ByRef PtOri As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
|
||||
PtOrig = PtOri
|
||||
VtDirX = VtX
|
||||
VtDirY = VtY
|
||||
VtDirZ = VtZ
|
||||
bOk = VtDirX.Normalize() And VtDirY.Normalize() And VtDirZ.Normalize() And Verify()
|
||||
Return bOk
|
||||
End Function
|
||||
Public Function Setup(ByRef PtOri As Point3d) As Boolean
|
||||
PtOrig = PtOri
|
||||
VtDirX = Vector3d.X_AX
|
||||
VtDirY = Vector3d.Y_AX
|
||||
VtDirZ = Vector3d.Z_AX
|
||||
bOk = True
|
||||
Return bOk
|
||||
End Function
|
||||
' Verifica
|
||||
Private Function Verify() As Boolean
|
||||
' verifica della ortogonalità dei versori e del senso destrorso
|
||||
Dim dOrtXY As Double = VtDirX * VtDirY
|
||||
Dim dOrtYZ As Double = VtDirY * VtDirZ
|
||||
Dim dOrtZX As Double = VtDirZ * VtDirX
|
||||
Dim vtTmp As Vector3d = VtDirX ^ VtDirY
|
||||
Dim dRight As Double = vtTmp * VtDirZ
|
||||
If Math.Abs(dOrtXY) > EPS_ZERO Or
|
||||
Math.Abs(dOrtYZ) > EPS_ZERO Or
|
||||
Math.Abs(dOrtZX) > EPS_ZERO Or
|
||||
dRight < EPS_ZERO Then
|
||||
Return False
|
||||
Else
|
||||
Return True
|
||||
End If
|
||||
End Function
|
||||
Public Function IsValid() As Boolean
|
||||
Return bOk
|
||||
End Function
|
||||
' Restituzione componenti
|
||||
Function Orig() As Point3d
|
||||
Return PtOrig
|
||||
End Function
|
||||
Function VersX() As Vector3d
|
||||
Return VtDirX
|
||||
End Function
|
||||
Function VersY() As Vector3d
|
||||
Return VtDirY
|
||||
End Function
|
||||
Function VersZ() As Vector3d
|
||||
Return VtDirZ
|
||||
End Function
|
||||
' Traslazione
|
||||
Function Move(ByRef VtMove As Vector3d) As Boolean
|
||||
If bOk Then
|
||||
Return EgtFrameTranslate(PtOrig, VtDirX, VtDirY, VtDirZ, VtMove)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Rotazione
|
||||
Function Rotate(ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
If bOk Then
|
||||
Return EgtFrameRotate(PtOrig, VtDirX, VtDirY, VtDirZ, PtAx, VtAx, dAngRotDeg)
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal riferimento al globale
|
||||
Function ToGlob(ByRef frRef As Frame3d) As Boolean
|
||||
If bOk And frRef.IsValid Then
|
||||
Return EgtFrameToGlob(PtOrig, VtDirX, VtDirY, VtDirZ,
|
||||
frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal globale al riferimento
|
||||
Function ToLoc(ByRef frRef As Frame3d) As Boolean
|
||||
If bOk And frRef.IsValid Then
|
||||
Return EgtFrameToLoc(PtOrig, VtDirX, VtDirY, VtDirZ,
|
||||
frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
' Cambio di riferimento : dal primo riferimento al secondo
|
||||
Function LocToLoc(ByRef frSou As Frame3d, ByRef frDest As Frame3d) As Boolean
|
||||
If frSou.IsValid And frDest.IsValid Then
|
||||
Return EgtFrameLocToLoc(PtOrig, VtDirX, VtDirY, VtDirZ,
|
||||
frSou.Orig(), frSou.VersX(), frSou.VersY(), frSou.VersZ(),
|
||||
frDest.Orig(), frDest.VersX(), frDest.VersY(), frDest.VersZ())
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Structure Color
|
||||
Dim R, G, B, A As Integer
|
||||
Sub New(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer, Optional ByVal nAlpha As Integer = 100)
|
||||
@@ -51,6 +357,12 @@ Structure Color
|
||||
B = nBlue
|
||||
A = nAlpha
|
||||
End Sub
|
||||
Sub Setup(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer, Optional ByVal nAlpha As Integer = 100)
|
||||
R = nRed
|
||||
G = nGreen
|
||||
B = nBlue
|
||||
A = nAlpha
|
||||
End Sub
|
||||
End Structure
|
||||
|
||||
#If PLATFORM = "x64" Then
|
||||
@@ -90,6 +402,118 @@ Public Shared Function EgtFreeMemory(ByVal sB As IntPtr) As Boolean
|
||||
End Function
|
||||
|
||||
|
||||
'---------- Geo Base -----------------------------------------------------------
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorNormalize(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
Optional ByVal dEps As Double = EPS_SMALL) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorRotate(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorScale(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorMirror(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef VtNorm As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorShear(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorToGlob(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorToLoc(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtVectorLocToLoc(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtO1 As Point3d, ByRef VtX1 As Vector3d, ByRef VtY1 As Vector3d, ByRef VtZ1 As Vector3d,
|
||||
ByRef PtO2 As Point3d, ByRef VtX2 As Vector3d, ByRef VtY2 As Vector3d, ByRef VtZ2 As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointTranslate(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef VtMove As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointRotate(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointScale(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointMirror(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointShear(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointToGlob(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointToLoc(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtPointLocToLoc(ByRef X As Double, ByRef Y As Double, ByRef Z As Double,
|
||||
ByRef PtO1 As Point3d, ByRef VtX1 As Vector3d, ByRef VtY1 As Vector3d, ByRef VtZ1 As Vector3d,
|
||||
ByRef PtO2 As Point3d, ByRef VtX2 As Vector3d, ByRef VtY2 As Vector3d, ByRef VtZ2 As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtFrameTranslate(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByRef VtMove As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtFrameRotate(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtFrameToGlob(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByRef PtO1 As Point3d, ByRef VtX1 As Vector3d, ByRef VtY1 As Vector3d, ByRef VtZ1 As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtFrameToLoc(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByRef PtO1 As Point3d, ByRef VtX1 As Vector3d, ByRef VtY1 As Vector3d, ByRef VtZ1 As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function EgtFrameLocToLoc(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByRef PtO1 As Point3d, ByRef VtX1 As Vector3d, ByRef VtY1 As Vector3d, ByRef VtZ1 As Vector3d,
|
||||
ByRef PtO2 As Point3d, ByRef VtX2 As Vector3d, ByRef VtY2 As Vector3d, ByRef VtZ2 As Vector3d) As Boolean
|
||||
End Function
|
||||
|
||||
|
||||
'---------- GeomDb -------------------------------------------------------------
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function EgtInitGeomDB() As Integer
|
||||
@@ -390,15 +814,23 @@ Public Shared Function EgtRotateGroup(ByVal nId As Integer, ByRef PtAx As Point3
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function EgtScale(ByVal nId As Integer, ByRef PtOrig As Point3d,
|
||||
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
Private Shared Function EgtScale(ByVal nId As Integer, ByRef PtOrig As Point3d,
|
||||
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
End Function
|
||||
Public Shared Function EgtScale(ByVal nId As Integer, ByRef Frame As Frame3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
Return EgtScale(nId, Frame.Orig(), Frame.VersX(), Frame.VersY(), Frame.VersZ(), dCoeffX, dCoeffY, dCoeffZ)
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function EgtScaleGlob(ByVal nId As Integer, ByRef PtOrig As Point3d,
|
||||
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
Private Shared Function EgtScaleGlob(ByVal nId As Integer, ByRef PtOrig As Point3d,
|
||||
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
End Function
|
||||
Public Shared Function EgtScaleGlob(ByVal nId As Integer, ByRef Frame As Frame3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
Return EgtScaleGlob(nId, Frame.Orig(), Frame.VersX(), Frame.VersY(), Frame.VersZ(), dCoeffX, dCoeffY, dCoeffZ)
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
@@ -406,6 +838,10 @@ Public Shared Function EgtScaleGroup(ByVal nId As Integer, ByRef PtOrig As Point
|
||||
ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
End Function
|
||||
Public Shared Function EgtScaleGroup(ByVal nId As Integer, ByRef Frame As Frame3d,
|
||||
ByVal dCoeffX As Double, ByVal dCoeffY As Double, ByVal dCoeffZ As Double) As Boolean
|
||||
Return EgtScaleGroup(nId, Frame.Orig(), Frame.VersX(), Frame.VersY(), Frame.VersZ(), dCoeffX, dCoeffY, dCoeffZ)
|
||||
End Function
|
||||
|
||||
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function EgtMirror(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean
|
||||
@@ -611,7 +1047,9 @@ Public Shared Function EgtLuaGetLastError(ByRef sError As String) As Boolean
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
|
||||
'Costanti : GEOMETRIA
|
||||
Public Const EPS_SMALL As Double = 0.001
|
||||
Public Const EPS_ZERO As Double = 0.000000099999999999999995
|
||||
'Costanti : TIPO DI FILE
|
||||
Public Const FT_NULL As Integer = 0
|
||||
Public Const FT_NGE As Integer = 1
|
||||
@@ -619,6 +1057,8 @@ Public Const FT_NFE As Integer = 2
|
||||
Public Const FT_DXF As Integer = 11
|
||||
Public Const FT_STL As Integer = 12
|
||||
Public Const FT_CNC As Integer = 13
|
||||
Public Const FT_TSC As Integer = 101
|
||||
Public Const FT_LUA As Integer = 102
|
||||
'Costanti : FORMATO FILE NGE
|
||||
Public Const NGE_TEXT As Integer = 0
|
||||
Public Const NGE_BIN As Integer = 1
|
||||
@@ -675,9 +1115,11 @@ Public Const SP_END As Integer = 0
|
||||
Public Const SP_MID As Integer = 1
|
||||
Public Const SP_CENTER As Integer = 2
|
||||
Public Const SP_NEAR As Integer = 3
|
||||
'Costanti : falg per BBOX
|
||||
'Costanti : flag per BBOX
|
||||
Public Const BBF_STANDARD As Integer = 0
|
||||
Public Const BBF_ONLY_VISIBLE As Integer = 1
|
||||
Public Const BBF_IGNORE_TEXT As Integer = 2
|
||||
Public Const BBF_IGNORE_DIM As Integer = 3
|
||||
Public Const BBF_EXACT As Integer = 4
|
||||
|
||||
End Class
|
||||
|
||||
+39
-7
@@ -1,9 +1,18 @@
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text
|
||||
Imports EgtUILib.EgtInterface
|
||||
|
||||
Public Class GenInterface
|
||||
|
||||
'-------------------------------- IniFile --------------------------------------------------------
|
||||
'-------------------------------- IniFile : Get --------------------------------------------------
|
||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function GetPrivateProfileInt(
|
||||
ByVal lpAppName As String,
|
||||
ByVal lpKeyName As String,
|
||||
ByVal nDefault As Integer,
|
||||
ByVal lpFileName As String) As Integer
|
||||
End Function
|
||||
|
||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
||||
Private Shared Function GetPrivateProfileString(
|
||||
ByVal lpAppName As String,
|
||||
@@ -28,17 +37,38 @@ End Function
|
||||
Public Shared Function GetPrivateProfileColor(
|
||||
ByVal lpAppName As String,
|
||||
ByVal lpKeyName As String,
|
||||
ByRef nRed As Integer,
|
||||
ByRef nGreen As Integer,
|
||||
ByRef nBlue As Integer,
|
||||
ByRef Col As Color,
|
||||
ByVal lpFileName As String) As Boolean
|
||||
Dim sVal As String = String.Empty
|
||||
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
||||
Dim sItems() As String = sVal.Split(",".ToCharArray)
|
||||
If sItems.Count() >= 3 Then
|
||||
nRed = Int(sItems(0))
|
||||
nGreen = Int(sItems(1))
|
||||
nBlue = Int(sItems(2))
|
||||
Col.R = Int(sItems(0))
|
||||
Col.G = Int(sItems(1))
|
||||
Col.B = Int(sItems(2))
|
||||
If sItems.Count() >= 4 Then
|
||||
Col.A = Int(sItems(3))
|
||||
End If
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Public Shared Function GetPrivateProfileZoomWin(
|
||||
ByVal lpAppName As String,
|
||||
ByVal lpKeyName As String,
|
||||
ByRef bOutline As Boolean,
|
||||
ByRef Col As Color,
|
||||
ByVal lpFileName As String) As Boolean
|
||||
Dim sVal As String = String.Empty
|
||||
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
|
||||
Dim sItems() As String = sVal.Split(",".ToCharArray)
|
||||
If sItems.Count() >= 5 Then
|
||||
bOutline = (Int(sItems(0)) <> 0)
|
||||
Col.R = Int(sItems(1))
|
||||
Col.G = Int(sItems(2))
|
||||
Col.B = Int(sItems(3))
|
||||
Col.A = Int(sItems(4))
|
||||
Return True
|
||||
End If
|
||||
Return False
|
||||
@@ -67,6 +97,8 @@ Public Shared Function GetPrivateProfileWinPos(
|
||||
Return False
|
||||
End Function
|
||||
|
||||
|
||||
'-------------------------------- IniFile : Write ------------------------------------------------
|
||||
<DllImport("kernel32.dll", CharSet:=CharSet.Unicode)>
|
||||
Public Shared Function WritePrivateProfileString(
|
||||
ByVal lpAppName As String,
|
||||
|
||||
@@ -42,5 +42,5 @@ Imports System.Runtime.InteropServices
|
||||
' È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
' utilizzando l'asterisco (*) come descritto di seguito:
|
||||
|
||||
<Assembly: AssemblyVersion("1.5.10.4")>
|
||||
<Assembly: AssemblyFileVersion("1.5.10.4")>
|
||||
<Assembly: AssemblyVersion("1.5.10.5")>
|
||||
<Assembly: AssemblyFileVersion("1.5.10.5")>
|
||||
|
||||
@@ -24,19 +24,18 @@ Public Class Scene
|
||||
Private m_nSnapType As Integer
|
||||
Private m_PrevPoint As Point
|
||||
Private m_ptPrev As Point3d
|
||||
Private m_nDefMatRed As Integer
|
||||
Private m_nDefMatGreen As Integer
|
||||
Private m_nDefMatBlue As Integer
|
||||
Private m_nDriver As Integer
|
||||
Private m_b2Buff As Boolean
|
||||
Private m_nColorBits As Integer
|
||||
Private m_nDepthBits As Integer
|
||||
Private m_nBackTopRed As Integer
|
||||
Private m_nBackTopGreen As Integer
|
||||
Private m_nBackTopBlue As Integer
|
||||
Private m_nBackBotRed As Integer
|
||||
Private m_nBackBotGreen As Integer
|
||||
Private m_nBackBotBlue As Integer
|
||||
Private m_BackTopColor As Color
|
||||
Private m_BackBotColor As Color
|
||||
Private m_DefColor As Color
|
||||
Private m_MarkColor As Color
|
||||
Private m_bZwOutline As Boolean
|
||||
Private m_ZwColor As Color
|
||||
Private m_DstLnColor As Color
|
||||
|
||||
|
||||
'---- Constructor -----
|
||||
Sub New()
|
||||
@@ -52,29 +51,21 @@ Public Class Scene
|
||||
m_nOldStatus = ST.NULL
|
||||
m_nSnapType = SP_END
|
||||
m_PrevPoint = Point.Empty
|
||||
m_nDefMatRed = 255
|
||||
m_nDefMatGreen = 165
|
||||
m_nDefMatBlue = 0
|
||||
m_nDriver = 3
|
||||
m_b2Buff = True
|
||||
m_nColorBits = 24
|
||||
m_nDepthBits = 32
|
||||
m_nBackTopRed = 140
|
||||
m_nBackTopGreen = 154
|
||||
m_nBackTopBlue = 168
|
||||
m_nBackBotRed = 40
|
||||
m_nBackBotGreen = 44
|
||||
m_nBackBotBlue = 48
|
||||
m_BackTopColor.Setup(140, 154, 168)
|
||||
m_BackBotColor.Setup(40, 44, 48)
|
||||
m_DefColor.Setup(255, 165, 0)
|
||||
m_MarkColor.Setup(255, 255, 0)
|
||||
m_bZwOutline = True
|
||||
m_ZwColor.Setup(0, 0, 0)
|
||||
m_DstLnColor.Setup(255, 0, 0)
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
'---- Initials --------
|
||||
Public Sub SetDefaultMaterial(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer)
|
||||
m_nDefMatRed = nRed
|
||||
m_nDefMatGreen = nGreen
|
||||
m_nDefMatBlue = nBlue
|
||||
End Sub
|
||||
|
||||
Public Sub SetViewAttributes(ByVal nDriver As Integer, ByVal b2Buff As Boolean, ByVal nColorBits As Integer, ByVal nDepthBits As Integer)
|
||||
m_nDriver = nDriver
|
||||
m_b2Buff = b2Buff
|
||||
@@ -82,14 +73,26 @@ Public Class Scene
|
||||
m_nDepthBits = nDepthBits
|
||||
End Sub
|
||||
|
||||
Public Sub SetViewBackground(ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer,
|
||||
ByVal nBottomRed As Integer, ByVal nBottomGreen As Integer, ByVal nBottomBlue As Integer)
|
||||
m_nBackTopRed = nTopRed
|
||||
m_nBackTopGreen = nTopGreen
|
||||
m_nBackTopBlue = nTopBlue
|
||||
m_nBackBotRed = nBottomRed
|
||||
m_nBackBotGreen = nBottomGreen
|
||||
m_nBackBotBlue = nBottomBlue
|
||||
Public Sub SetViewBackground(ByRef BackTopColor As Color, ByRef BackBotColor As Color)
|
||||
m_BackTopColor = BackTopColor
|
||||
m_BackBotColor = BackBotColor
|
||||
End Sub
|
||||
|
||||
Public Sub SetDefaultMaterial(ByRef DefColor As Color)
|
||||
m_DefColor = DefColor
|
||||
End Sub
|
||||
|
||||
Public Sub SetMarkMaterial(ByRef DefColor As Color)
|
||||
m_MarkColor = DefColor
|
||||
End Sub
|
||||
|
||||
Public Sub SetZoomWinAttribs(ByVal bZwOutline As Boolean, ByRef ZwColor As Color)
|
||||
m_bZwOutline = bZwOutline
|
||||
m_ZwColor = ZwColor
|
||||
End Sub
|
||||
|
||||
Public Sub SetDistLineMaterial(ByRef DstLnColor As Color)
|
||||
m_DstLnColor = DstLnColor
|
||||
End Sub
|
||||
|
||||
'Mettere EgtInit, EgtSetKey e EgtSetFont nell'evento Load del Form, prima di inizializzare la o le Scene
|
||||
@@ -97,10 +100,13 @@ Public Class Scene
|
||||
|
||||
Public Sub Init()
|
||||
m_nGseContext = EgtInitGeomDB()
|
||||
EgtSetDefaultMaterial(m_nDefMatRed, m_nDefMatGreen, m_nDefMatBlue)
|
||||
EgtSetDefaultMaterial(m_DefColor.R, m_DefColor.G, m_DefColor.B)
|
||||
EgtInitScene(Handle, m_nDriver, m_b2Buff, m_nColorBits, m_nDepthBits)
|
||||
EgtSetBackground(m_nBackTopRed, m_nBackTopGreen, m_nBackTopBlue,
|
||||
m_nBackBotRed, m_nBackBotGreen, m_nBackBotBlue)
|
||||
EgtSetBackground(m_BackTopColor.R, m_BackTopColor.G, m_BackTopColor.B,
|
||||
m_BackBotColor.R, m_BackBotColor.G, m_BackBotColor.B)
|
||||
EgtSetMarkAttribs(m_MarkColor.R, m_MarkColor.G, m_MarkColor.B)
|
||||
EgtSetWinRectAttribs(m_bZwOutline, m_ZwColor.R, m_ZwColor.G, m_ZwColor.B, m_ZwColor.A)
|
||||
EgtSetGeoLineAttribs(m_DstLnColor.R, m_DstLnColor.G, m_DstLnColor.B)
|
||||
EgtInitTscExec()
|
||||
End Sub
|
||||
|
||||
@@ -467,34 +473,61 @@ Public Class Scene
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function OpenProject()
|
||||
'Scelta file con dialogo
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Open"
|
||||
OpenFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge" &
|
||||
"|New font EgalTech(*.nfe)|*.nfe" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 1
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
Public Function OpenProject(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean
|
||||
Dim sFile As String = sDir
|
||||
' Scelta file con dialogo
|
||||
If bWithDlg Then
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Open"
|
||||
OpenFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge" &
|
||||
"|New font EgalTech(*.nfe)|*.nfe" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 1
|
||||
OpenFileDialog.InitialDirectory = sDir
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
End If
|
||||
sFile = OpenFileDialog.FileName
|
||||
End If
|
||||
'Prima del caricamento
|
||||
RaiseEvent OnOpeningProject(Me)
|
||||
'Caricamento del progetto
|
||||
Cursor = Cursors.WaitCursor
|
||||
Dim bOk As Boolean = EgtOpenFile(OpenFileDialog.FileName)
|
||||
EgtZoom(m_nGseContext, ZM_ALL)
|
||||
Dim bOk As Boolean = EgtOpenFile(sFile)
|
||||
EgtZoom(ZM_ALL)
|
||||
Cursor = Cursors.Default
|
||||
'Gestione risultato
|
||||
If bOk Then
|
||||
RaiseEvent OnOpenProject(Me, OpenFileDialog.FileName)
|
||||
RaiseEvent OnOpenProject(Me, sFile)
|
||||
Else
|
||||
MessageBox.Show("Error opening file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function SaveProject(Optional ByVal sFile As String = "")
|
||||
Public Function SaveProject(Optional ByVal sFile As String = "") As Boolean
|
||||
If String.IsNullOrEmpty(sFile) Or EgtGetFileType(sFile) <> FT_NGE Then
|
||||
Return SaveAsProject(sFile)
|
||||
Else
|
||||
'Prima del salvataggio
|
||||
RaiseEvent OnSavingProject(Me, sFile)
|
||||
'Salvataggio del progetto
|
||||
Cursor = Cursors.WaitCursor
|
||||
Dim bOk As Boolean = EgtSaveFile(sFile, NGE_CMPTEXT)
|
||||
Cursor = Cursors.Default
|
||||
'Gestione risultato
|
||||
If bOk Then
|
||||
RaiseEvent OnSavedProject(Me)
|
||||
Else
|
||||
MessageBox.Show("Error saving file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
End If
|
||||
Return bOk
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function SaveAsProject(Optional ByVal sFile As String = "") As Boolean
|
||||
'Eventuale sistemazione estensione
|
||||
sFile = Path.ChangeExtension(sFile, "nge")
|
||||
'Assegnazione nome file con dialogo
|
||||
Dim SaveFileDialog As New SaveFileDialog
|
||||
SaveFileDialog.Title = "Save"
|
||||
@@ -518,20 +551,25 @@ Public Class Scene
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function ImportProject()
|
||||
Public Function ImportProject(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean
|
||||
Dim sFile As String = sDir
|
||||
'Scelta file con dialogo
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Import"
|
||||
OpenFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" &
|
||||
"|Stereolithography (*.stl)|*.stl" &
|
||||
"|Part program ISO (*.cnc)|*.cnc" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 1
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
If bWithDlg Then
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Import"
|
||||
OpenFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" &
|
||||
"|Stereolithography (*.stl)|*.stl" &
|
||||
"|Part program ISO (*.cnc)|*.cnc" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 4
|
||||
OpenFileDialog.InitialDirectory = sDir
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
End If
|
||||
sFile = OpenFileDialog.FileName
|
||||
End If
|
||||
'Riconoscimento tipo file
|
||||
Dim nFileType As Integer = EgtGetFileType(OpenFileDialog.FileName)
|
||||
Dim nFileType As Integer = EgtGetFileType(sFile)
|
||||
If nFileType <> FT_DXF And nFileType <> FT_STL And nFileType <> FT_CNC Then
|
||||
MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
Return False
|
||||
@@ -543,30 +581,31 @@ Public Class Scene
|
||||
Dim bOk As Boolean = EgtNewFile()
|
||||
'Importazione
|
||||
If nFileType = FT_DXF Then
|
||||
bOk = bOk And EgtImportDxf(OpenFileDialog.FileName)
|
||||
bOk = bOk And EgtImportDxf(sFile)
|
||||
ElseIf nFileType = FT_STL Then
|
||||
bOk = bOk And EgtImportStl(OpenFileDialog.FileName)
|
||||
bOk = bOk And EgtImportStl(sFile)
|
||||
ElseIf nFileType = FT_CNC Then
|
||||
bOk = bOk And EgtImportCnc(OpenFileDialog.FileName)
|
||||
bOk = bOk And EgtImportCnc(sFile)
|
||||
End If
|
||||
EgtZoom(m_nGseContext, ZM_ALL)
|
||||
EgtZoom(ZM_ALL)
|
||||
Cursor = Cursors.Default
|
||||
'Gestione risultato
|
||||
If bOk Then
|
||||
RaiseEvent OnImportedProject(Me, OpenFileDialog.FileName)
|
||||
RaiseEvent OnImportedProject(Me, sFile)
|
||||
Else
|
||||
MessageBox.Show("Error importing file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
End If
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function ExportProject(Optional ByVal sFile As String = "")
|
||||
Public Function ExportProject(Optional ByVal sFile As String = "") As Boolean
|
||||
'Assegnazione nome file con dialogo
|
||||
Dim SaveFileDialog As New SaveFileDialog
|
||||
SaveFileDialog.Title = "Export"
|
||||
SaveFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" &
|
||||
"|Stereolithography (*.stl)|*.stl" &
|
||||
"|All Files (*.*)|*.*"
|
||||
SaveFileDialog.FilterIndex = 3
|
||||
SaveFileDialog.FileName = sFile
|
||||
If SaveFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
@@ -597,34 +636,39 @@ Public Class Scene
|
||||
Return bOk
|
||||
End Function
|
||||
|
||||
Public Function Exec()
|
||||
Public Function Exec(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean
|
||||
Dim sFile As String = sDir
|
||||
'Scelta file con dialogo
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Exec Script"
|
||||
OpenFileDialog.Filter = "Lua commands(*.lua)|*.lua" &
|
||||
"|Test commands(*.tsc)|*.tsc" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 1
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
If bWithDlg Then
|
||||
Dim OpenFileDialog As New OpenFileDialog
|
||||
OpenFileDialog.Title = "Exec Script"
|
||||
OpenFileDialog.Filter = "Lua commands(*.lua)|*.lua" &
|
||||
"|Test commands(*.tsc)|*.tsc" &
|
||||
"|All Files (*.*)|*.*"
|
||||
OpenFileDialog.FilterIndex = 1
|
||||
OpenFileDialog.InitialDirectory = sDir
|
||||
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
|
||||
Return True
|
||||
End If
|
||||
sFile = OpenFileDialog.FileName
|
||||
End If
|
||||
'Ne verifico il tipo
|
||||
Dim sExt As String = UCase(Path.GetExtension(OpenFileDialog.FileName))
|
||||
Dim sExt As String = UCase(Path.GetExtension(sFile))
|
||||
If (sExt <> ".LUA" And sExt <> ".TSC") Then
|
||||
MessageBox.Show("Script type unknow", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
||||
Return False
|
||||
End If
|
||||
'Prima dell'esecuzione
|
||||
RaiseEvent OnExecutingScript(Me, OpenFileDialog.FileName)
|
||||
RaiseEvent OnExecutingScript(Me, sFile)
|
||||
'Esecuzione
|
||||
Cursor = Cursors.WaitCursor
|
||||
Dim bOk As Boolean = False
|
||||
If (sExt = ".LUA") Then
|
||||
bOk = EgtLuaExecFile(OpenFileDialog.FileName)
|
||||
bOk = EgtLuaExecFile(sFile)
|
||||
Else
|
||||
bOk = EgtTscExecFile(OpenFileDialog.FileName)
|
||||
bOk = EgtTscExecFile(sFile)
|
||||
End If
|
||||
EgtZoom(m_nGseContext, ZM_ALL)
|
||||
EgtZoom(ZM_ALL)
|
||||
Cursor = Cursors.Default
|
||||
'Gestione risultato
|
||||
If bOk Then
|
||||
@@ -696,10 +740,22 @@ Public Class Scene
|
||||
EgtSetView(CT_TOP)
|
||||
End Sub
|
||||
|
||||
Public Sub IsoView()
|
||||
Public Sub IsoViewSW()
|
||||
EgtSetView(CT_ISO_SW)
|
||||
End Sub
|
||||
|
||||
Public Sub IsoViewSE()
|
||||
EgtSetView(CT_ISO_SE)
|
||||
End Sub
|
||||
|
||||
Public Sub IsoViewNE()
|
||||
EgtSetView(CT_ISO_NE)
|
||||
End Sub
|
||||
|
||||
Public Sub IsoViewNW()
|
||||
EgtSetView(CT_ISO_NW)
|
||||
End Sub
|
||||
|
||||
Public Sub FrontView()
|
||||
EgtSetView(CT_FRONT)
|
||||
End Sub
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
End Sub
|
||||
|
||||
Private Sub btnIso_Click(sender As System.Object, e As System.EventArgs) Handles Me.Click
|
||||
m_scene.IsoView()
|
||||
m_scene.IsoViewSW()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@
|
||||
End Sub
|
||||
|
||||
Private Sub btnIso_Click(sender As Object, e As System.EventArgs)
|
||||
m_scene.IsoView()
|
||||
m_scene.IsoViewSW()
|
||||
End Sub
|
||||
|
||||
Private Sub btnFront_Click(sender As Object, e As System.EventArgs)
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@
|
||||
End Sub
|
||||
|
||||
Private Sub btnIso_Click(sender As Object, e As System.EventArgs)
|
||||
m_scene.IsoView()
|
||||
m_scene.IsoViewSW()
|
||||
End Sub
|
||||
|
||||
Private Sub btnFront_Click(sender As Object, e As System.EventArgs)
|
||||
|
||||
Reference in New Issue
Block a user