EgtUILib 1.5j6 :

- aggiornamenti vari.
This commit is contained in:
Dario Sassi
2014-10-30 08:52:05 +00:00
parent 740f6bec09
commit 66757316e2
8 changed files with 658 additions and 272 deletions
+334 -82
View File
@@ -120,6 +120,27 @@ Structure Vector3d
Return False
End If
End Function
' Restituisce vettore in globale partendo da espressione nel riferimento dell'oggetto
Function Glob(ByVal nId As Integer) As Vector3d
Dim vtV As New Vector3d(x, y, z)
EgtVectorToIdGlob(vtV, nId)
Return vtV
End Function
' Restituisce vettore nel riferimento dell'oggetto partendo da espressione in globale
Function Loc(ByVal nId As Integer) As Vector3d
Dim vtV As New Vector3d(x, y, z)
EgtVectorToIdLoc(vtV, nId)
Return vtV
End Function
' Restituisce vettore nel riferimento del 2°oggetto partendo da espressione nel riferimento del 1° oggetto
Function LocLoc(ByVal nIdSou As Integer, ByVal nIdDest As Integer) As Vector3d
Dim vtV As New Vector3d(x, y, z)
If EgtVectorToIdGlob(vtV, nIdSou) And EgtVectorToIdLoc(vtV, nIdDest) Then
Return vtV
Else
Return Me
End If
End Function
' Versore Asse X
Shared Function X_AX() As Vector3d
Dim vtZ As New Vector3d(1, 0, 0)
@@ -219,6 +240,27 @@ Structure Point3d
Return False
End If
End Function
' Restituisce punto in globale partendo da espressione nel riferimento dell'oggetto
Function Glob(ByVal nId As Integer) As Point3d
Dim ptP As New Point3d(x, y, z)
EgtPointToIdGlob(ptP, nId)
Return ptP
End Function
' Restituisce punto nel riferimento dell'oggetto partendo da espressione in globale
Function Loc(ByVal nId As Integer) As Point3d
Dim ptP As New Point3d(x, y, z)
EgtPointToIdLoc(ptP, nId)
Return ptP
End Function
' Restituisce punto nel riferimento del 2°oggetto partendo da espressione nel riferimento del 1° oggetto
Function LocLoc(ByVal nIdSou As Integer, ByVal nIdDest As Integer) As Point3d
Dim ptP As New Point3d(x, y, z)
If EgtPointToIdGlob(ptP, nIdSou) And EgtPointToIdLoc(ptP, nIdDest) Then
Return ptP
Else
Return Me
End If
End Function
' Punto Origine
Shared Function ORIG() As Point3d
Dim ptP As New Point3d(0, 0, 0)
@@ -347,22 +389,42 @@ Class Frame3d
Return False
End If
End Function
' Riferimento Globale o Identità
Shared Function GLOB() As Frame3d
Dim frRef As New Frame3d
Return frRef
End Function
End Class
Structure Color
Structure Color3d
' Membri
Dim R, G, B, A As Integer
' Costruttori
Sub New(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
' Inizializzatori
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
' Conversione a System.Drawing.Color
Function ToColor() As System.Drawing.Color
Return System.Drawing.Color.FromArgb(A * 255 / 100, R, G, B)
End Function
' Conversione da System.Drawing.Color
Sub FromColor(ByVal SysCol As System.Drawing.Color)
R = SysCol.R
G = SysCol.G
B = SysCol.B
A = SysCol.A * 100 / 255
End Sub
End Structure
#If PLATFORM = "x64" Then
@@ -445,6 +507,12 @@ Private Shared Function EgtVectorLocToLoc(ByRef X As Double, ByRef Y As Double,
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)>
Public Shared Function EgtGetVectorRotation(ByRef VtS As Vector3d, ByRef VtE As Vector3d, ByRef VtAx As Vector3d,
ByRef dAngRotDeg As Double, ByRef bDet As Boolean) 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
@@ -532,7 +600,7 @@ Public Shared Function EgtGetCurrentContext() As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetDefaultMaterial(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean
Public Shared Function EgtSetDefaultMaterial(ByRef DefCol As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -544,7 +612,7 @@ Public Shared Function EgtOpenFile(ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSaveFile(ByVal sFilePath As String, ByVal nFlag As Integer) As Boolean
Public Shared Function EgtSaveFile(ByVal sFilePath As String, ByVal nFlag As NGE) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -584,8 +652,40 @@ Public Shared Function EgtCreateGroup(ByVal nParentId As Integer) As Integer
Return EgtCreateGroup(nParentId, Point3d.ORIG(), Vector3d.X_AX(), Vector3d.Y_AX(), Vector3d.Z_AX())
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCreateGeoPoint(ByVal nParentId As Integer,
ByRef PtP As Point3d) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCreateCurveLine(ByVal nParentId As Integer,
ByRef PtStart As Point3d, ByRef PtEnd As Point3d) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCreateCurveArc3P(ByVal nParentId As Integer,
ByRef PtStart As Point3d, ByRef PtMid As Point3d, ByRef PtEnd As Point3d) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCreateCurveArcC2PN(ByVal nParentId As Integer,
ByRef PtCen As Point3d, ByRef PtStart As Point3d, ByRef PtEnd As Point3d,
ByRef VtNorm As Vector3d) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCreateSurfTriMeshByContour(ByVal nParentId As Integer, ByVal nCrvId As Integer, ByVal dLinTol As Double) As Integer
End Function
'---------- GeomDb Objects Modify ----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtChangeGroupFrame(ByVal nId As Integer,
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
End Function
Public Shared Function EgtChangeGroupFrame(ByVal nId As Integer, ByRef frRef As Frame3d) As Boolean
Return EgtChangeGroupFrame(nId, frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtFlipText(ByVal nId As Integer) As Boolean
End Function
@@ -595,9 +695,45 @@ Public Shared Function EgtMirrorText(ByVal nId As Integer, ByVal bOnL As Boolean
End Function
'---------- GeomDb Curves Modify -----------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInvertCurve(ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtModifyCurveEndPoint(ByVal nId As Integer, ByRef PtEnd As Point3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtModifyCurveArc3P(ByVal nId As Integer, ByRef PtMid As Point3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtModifyCurveArcC2PN(ByVal nId As Integer, ByRef PtEnd As Point3d) As Boolean
End Function
'---------- GeomDb Objects -----------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtExistsObj(ByVal nGroupId As Integer) As Boolean
Public Shared Function EgtExistsObj(ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetParent(ByVal nId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtGetGroupGlobFrame(ByVal nId As Integer,
ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
End Function
Public Shared Function EgtGetGroupGlobFrame(ByVal nId As Integer, ByRef frGRef As Frame3d) As Boolean
Dim PtOrig As Point3d
Dim VtDirX, VtDirY, VtDirZ As Vector3d
If Not EgtGetGroupGlobFrame(nId, PtOrig, VtDirX, VtDirY, VtDirZ) Then
Return False
Else
Return frGRef.Setup(PtOrig, VtDirX, VtDirY, VtDirZ)
End If
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -620,6 +756,22 @@ End Function
Public Shared Function EgtGetPrev(ByVal nId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetFirstGroupInGroup(ByVal nGroupId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetNextGroup(ByVal nId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetLastGroupInGroup(ByVal nGroupId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetPrevGroup(ByVal nId As Integer) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetBBox(ByVal nId As Integer, ByVal nFlag As Integer,
ByRef PtMin As Point3d, ByRef PtMax As Point3d) As Boolean
@@ -631,23 +783,23 @@ Public Shared Function EgtGetBBoxGlob(ByVal nId As Integer, ByVal nFlag As Integ
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCopy(ByVal nId As Integer, ByVal nRefId As Integer, ByVal nSonBeforeAfter As Integer) As Integer
Public Shared Function EgtCopy(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtCopyGlob(ByVal nId As Integer, ByVal nRefId As Integer, ByVal nSonBeforeAfter As Integer) As Integer
Public Shared Function EgtCopyGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRelocate(ByVal nId As Integer, ByVal nRefId As Integer, ByVal nSonBeforeAfter As Integer) As Integer
Public Shared Function EgtRelocate(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRelocateGlob(ByVal nId As Integer, ByVal nRefId As Integer, ByVal nSonBeforeAfter As Integer) As Integer
Public Shared Function EgtRelocateGlob(ByVal nId As Integer, ByVal nRefId As Integer, Optional ByVal nSonBeforeAfter As GDB_POS = GDB_POS.SON) As Integer
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtErase(ByVal nId As Integer) As Integer
Public Shared Function EgtErase(ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -753,6 +905,18 @@ End Function
Public Shared Function EgtGetCalcMark(ByVal nId As Integer, ByRef bMark As Boolean) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetColor(ByVal nId As Integer, ByRef ColObj As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetColor(ByVal nId As Integer, ByRef ColObj As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetCalcColor(ByVal nId As Integer, ByRef ColObj As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetName(ByVal nId As Integer, ByVal sName As String) As Boolean
End Function
@@ -909,6 +1073,24 @@ Public Shared Function EgtShearGroup(ByVal nId As Integer, ByRef PtOn As Point3d
End Function
'---------- GeomDb Snap Vector/Point/Frame -------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtVectorToIdGlob(ByRef VtV As Vector3d, ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtVectorToIdLoc(ByRef VtV As Vector3d, ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtPointToIdGlob(ByRef PtP As Point3d, ByVal nId As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtPointToIdLoc(ByRef PtP As Point3d, ByVal nId As Integer) As Boolean
End Function
'---------- Scene --------------------------------------------------------------
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitScene(ByVal hWnd As IntPtr, ByVal nDriver As Integer,
@@ -916,21 +1098,58 @@ Public Shared Function EgtInitScene(ByVal hWnd As IntPtr, ByVal nDriver As Integ
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetBackground(ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer,
ByVal nBottomRed As Integer, ByVal nBottomGreen As Integer, ByVal nBottomBlue As Integer,
Optional ByVal bRedraw As Boolean = True) As Boolean
Public Shared Function EgtSetBackground(ByRef colTop As Color3d, ByRef colBottom As Color3d, Optional ByVal bRedraw As Boolean = True) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetMarkAttribs(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean
Public Shared Function EgtSetMarkAttribs(ByRef colMark As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetGeoLineAttribs(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean
Public Shared Function EgtSetGeoLineAttribs(ByRef colGl As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetWinRectAttribs(ByVal bOutline As Boolean, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer, ByVal nAlpha As Integer) As Boolean
Public Shared Function EgtSetWinRectAttribs(ByVal bOutline As Boolean, ByRef colWr As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetGridShow(ByVal bShowGrid As Boolean, ByVal bShowFrame As Boolean) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtSetGridFrame(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
End Function
Public Shared Function EgtSetGridFrame(ByRef frRef As Frame3d) As Boolean
Return EgtSetGridFrame(frRef.Orig(), frRef.VersX(), frRef.VersY(), frRef.VersZ())
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetGridGeo(ByVal dSnapStep As Double, ByVal nMinLineSstep As Integer, ByVal nMajLineSstep As Integer, ByVal nExtSstep As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetGridColor(ByRef colMinLine As Color3d, ByRef colMajLine As Color3d) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtGetGridFrame(ByRef PtOrig As Point3d, ByRef VtX As Vector3d, ByRef VtY As Vector3d, ByRef VtZ As Vector3d) As Boolean
End Function
Public Shared Function EgtGetGridFrame(ByRef frRef As Frame3d) As Boolean
Dim PtOrig As Point3d
Dim VtDirX, VtDirY, VtDirZ As Vector3d
If Not EgtGetGridFrame(PtOrig, VtDirX, VtDirY, VtDirZ) Then
Return False
Else
Return frRef.Setup(PtOrig, VtDirX, VtDirY, VtDirZ)
End If
End Function
Public Shared Function EgtGetGridVersZ() As Vector3d
Dim PtOrig As Point3d
Dim VtDirX, VtDirY, VtDirZ As Vector3d
EgtGetGridFrame(PtOrig, VtDirX, VtDirY, VtDirZ)
Return VtDirZ
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -971,13 +1190,18 @@ Public Shared Function EgtUnselectableClearAll() As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetSelectedSnapPoint(ByVal nSnap As Integer,
Private Shared Function EgtGetGraphicSnapPoint(ByVal nSnap As Integer,
ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal nSelW As Integer, ByVal nSelH As Integer,
ByRef ptP As Point3d) As Boolean
End Function
Public Shared Function EgtGetGraphicSnapPoint(ByVal nSnap As Integer,
ByVal PtWin As Point, ByVal nSelW As Integer, ByVal nSelH As Integer,
ByRef ptP As Point3d) As Boolean
Return EgtGetGraphicSnapPoint(nSnap, PtWin.X, PtWin.Y, nSelW, nSelH, ptP)
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetShowMode(ByVal nShowMode As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean
Public Shared Function EgtSetShowMode(ByVal nShowMode As SM, Optional ByVal bRedraw As Boolean = True) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -993,7 +1217,7 @@ Public Shared Function EgtGetShowCurveDirection() As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtZoom(ByVal nZoom As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean
Public Shared Function EgtZoom(ByVal nZoom As ZM, Optional ByVal bRedraw As Boolean = True) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -1030,7 +1254,7 @@ Public Shared Function EgtZoomWin(ByVal Prev As Point, ByVal Curr As Point, Opti
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetView(ByVal nView As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean
Public Shared Function EgtSetView(ByVal nView As VT, Optional ByVal bRedraw As Boolean = True) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
@@ -1101,80 +1325,108 @@ End Function
Public Const EPS_SMALL As Double = 0.001
Public Const EPS_ZERO As Double = 0.0000001
'Costanti : TIPO DI FILE
Public Const FT_NULL As Integer = 0
Public Const FT_NGE As Integer = 1
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
Public Enum FT As Integer
NULL = 0
NGE = 1
NFE = 2
DXF = 11
STL = 12
CNC = 13
TSC = 101
LUA = 102
End Enum
'Costanti : FORMATO FILE NGE
Public Const NGE_TEXT As Integer = 0
Public Const NGE_BIN As Integer = 1
Public Const NGE_CMPTEXT As Integer = 2
Public Enum NGE As Integer
TEXT = 0
BIN = 1
CMPTEXT = 2
End Enum
'Costanti : ID GEOMDB
Public Const GDB_ID_ROOT As Integer = 0
Public Const GDB_ID_NULL As Integer = -1
Public Const GDB_ID_SEL As Integer = -2
Public Enum GDB_ID As Integer
ROOT = 0
NULL = -1
SEL = -2
End Enum
'Costanti : TIPO OGGETTI
Public Const TY_NONE As Integer = 0
Public Const TY_GROUP As Integer = 2
Public Const TY_GEO_VECTOR As Integer = 128
Public Const TY_GEO_POINT As Integer = 129
Public Const TY_GEO_FRAME As Integer = 130
Public Const TY_CRV_LINE As Integer = 256
Public Const TY_CRV_ARC As Integer = 257
Public Const TY_CRV_BEZ As Integer = 258
Public Const TY_CRV_COMPO As Integer = 259
Public Const TY_SRF_MESH As Integer = 512
Public Const TY_EXT_TEXT As Integer = 1024
Public Enum TY As Integer
NONE = 0
GROUP = 2
GEO_VECTOR = 128
GEO_POINT = 129
GEO_FRAME = 130
CRV_LINE = 256
CRV_ARC = 257
CRV_BEZ = 258
CRV_COMPO = 259
SRF_MESH = 512
EXT_TEXT = 1024
End Enum
'Costanti : POSIZIONE DI COPIA DI UN OGGETTO
Public Const GDB_BEFORE As Integer = -1
Public Const GDB_SON As Integer = 0
Public Const GDB_AFTER As Integer = 1
Public Enum GDB_POS As Integer
BEFORE = -1
SON = 0
AFTER = 1
End Enum
'Costanti : LIVELLO DI UN OGGETTO
Public Const GDB_LV_USER As Integer = 1
Public Const GDB_LV_SYSTEM As Integer = 2
Public Const GDB_LV_TEMP As Integer = 3
Public Enum GDB_LV As Integer
USER = 1
SYSTEM = 2
TEMP = 3
End Enum
'Costanti : MODO DI UN OGGETTO
Public Const GDB_MD_STD As Integer = 1
Public Const GDB_MD_LOCKED As Integer = 2
Public Const GDB_MD_HIDDEN As Integer = 3
Public Enum GDB_MD As Integer
STD = 1
LOCKED = 2
HIDDEN = 3
End Enum
'Costanti : STATO DI UN OGGETTO
Public Const GDB_ST_OFF As Integer = 0
Public Const GDB_ST_ON As Integer = 1
Public Const GDB_ST_SEL As Integer = 2
Public Enum GDB_ST As Integer
OFF = 0
ON_ = 1
SEL = 2
End Enum
'Costanti : TIPO VISUALIZZAZIONE
Public Const SM_WIREFRAME As Integer = 0
Public Const SM_HIDDENLINE As Integer = 1
Public Const SM_SHADING As Integer = 2
Public Enum SM As Integer
WIREFRAME = 0
HIDDENLINE = 1
SHADING = 2
End Enum
'Costanti : TIPO ZOOM
Public Const ZM_ALL As Integer = 1
Public Const ZM_IN As Integer = 2
Public Const ZM_OUT As Integer = 3
Public Enum ZM As Integer
ALL = 1
IN_ = 2
OUT = 3
End Enum
'Costanti : TIPO VISTA
Public Const CT_NONE As Integer = 0
Public Const CT_TOP As Integer = 1
Public Const CT_FRONT As Integer = 2
Public Const CT_RIGHT As Integer = 3
Public Const CT_BACK As Integer = 4
Public Const CT_LEFT As Integer = 5
Public Const CT_BOTTOM As Integer = 6
Public Const CT_ISO_SW As Integer = 7
Public Const CT_ISO_SE As Integer = 8
Public Const CT_ISO_NE As Integer = 9
Public Const CT_ISO_NW As Integer = 10
Public Enum VT As Integer
NONE = 0
TOP = 1
FRONT = 2
RIGHT = 3
BACK = 4
LEFT = 5
BOTTOM = 6
ISO_SW = 7
ISO_SE = 8
ISO_NE = 9
ISO_NW = 10
End Enum
'Costanti : TIPO SNAP POINT
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
Public Enum SP As Integer
PT_SKETCH = 0
PT_GRID = 1
PT_END = 2
PT_MID = 3
CENTER = 4
PT_NEAR = 5
End Enum
'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
Public Enum BBF As Integer
STANDARD = 0
ONLY_VISIBLE = 1
IGNORE_TEXT = 2
IGNORE_DIM = 3
EXACT = 4
End Enum
End Class
+2 -2
View File
@@ -37,7 +37,7 @@ End Function
Public Shared Function GetPrivateProfileColor(
ByVal lpAppName As String,
ByVal lpKeyName As String,
ByRef Col As Color,
ByRef Col As Color3d,
ByVal lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
@@ -58,7 +58,7 @@ Public Shared Function GetPrivateProfileZoomWin(
ByVal lpAppName As String,
ByVal lpKeyName As String,
ByRef bOutline As Boolean,
ByRef Col As Color,
ByRef Col As Color3d,
ByVal lpFileName As String) As Boolean
Dim sVal As String = String.Empty
GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName)
+2 -2
View File
@@ -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.5")>
<Assembly: AssemblyFileVersion("1.5.10.5")>
<Assembly: AssemblyVersion("1.5.10.6")>
<Assembly: AssemblyFileVersion("1.5.10.6")>
+47 -8
View File
@@ -24,21 +24,49 @@ Partial Class Scene
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.MenuScene = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.cmdSelectAll = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdDeselectAll = New System.Windows.Forms.ToolStripMenuItem()
Me.SepSel1 = New System.Windows.Forms.ToolStripSeparator()
Me.cmdWinSelect = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdEndPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdMidPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdCenterPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdNearPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdDeselectAll = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdSketchPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.cmdGridPoint = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuScene.SuspendLayout()
Me.SuspendLayout()
'
'MenuScene
'
Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdDeselectAll, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint})
Me.MenuScene.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.cmdSelectAll, Me.cmdDeselectAll, Me.SepSel1, Me.cmdWinSelect, Me.cmdSketchPoint, Me.cmdGridPoint, Me.cmdEndPoint, Me.cmdMidPoint, Me.cmdCenterPoint, Me.cmdNearPoint})
Me.MenuScene.Name = "ContextMenuStrip1"
Me.MenuScene.ShowCheckMargin = True
Me.MenuScene.ShowImageMargin = False
Me.MenuScene.Size = New System.Drawing.Size(153, 136)
Me.MenuScene.Size = New System.Drawing.Size(153, 230)
'
'cmdSelectAll
'
Me.cmdSelectAll.Name = "cmdSelectAll"
Me.cmdSelectAll.Size = New System.Drawing.Size(152, 22)
Me.cmdSelectAll.Text = "Select All"
'
'cmdDeselectAll
'
Me.cmdDeselectAll.Name = "cmdDeselectAll"
Me.cmdDeselectAll.Size = New System.Drawing.Size(152, 22)
Me.cmdDeselectAll.Text = "Deselect All"
'
'SepSel1
'
Me.SepSel1.Name = "SepSel1"
Me.SepSel1.Size = New System.Drawing.Size(149, 6)
'
'cmdWinSelect
'
Me.cmdWinSelect.Name = "cmdWinSelect"
Me.cmdWinSelect.Size = New System.Drawing.Size(152, 22)
Me.cmdWinSelect.Text = "Select Window"
'
'cmdEndPoint
'
@@ -50,7 +78,7 @@ Partial Class Scene
'
Me.cmdMidPoint.Name = "cmdMidPoint"
Me.cmdMidPoint.Size = New System.Drawing.Size(152, 22)
Me.cmdMidPoint.Text = "MidPoint"
Me.cmdMidPoint.Text = "Mid Point"
'
'cmdCenterPoint
'
@@ -64,11 +92,17 @@ Partial Class Scene
Me.cmdNearPoint.Size = New System.Drawing.Size(152, 22)
Me.cmdNearPoint.Text = "Near Point"
'
'cmdDeselectAll
'cmdSketchPoint
'
Me.cmdDeselectAll.Name = "cmdDeselectAll"
Me.cmdDeselectAll.Size = New System.Drawing.Size(152, 22)
Me.cmdDeselectAll.Text = "Deselect All"
Me.cmdSketchPoint.Name = "cmdSketchPoint"
Me.cmdSketchPoint.Size = New System.Drawing.Size(152, 22)
Me.cmdSketchPoint.Text = "Sketch Point"
'
'cmdGridPoint
'
Me.cmdGridPoint.Name = "cmdGridPoint"
Me.cmdGridPoint.Size = New System.Drawing.Size(152, 22)
Me.cmdGridPoint.Text = "Grid Point"
'
'Scene
'
@@ -86,5 +120,10 @@ End Sub
Friend WithEvents cmdCenterPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdNearPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdDeselectAll As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdSelectAll As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdWinSelect As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents SepSel1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents cmdSketchPoint As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents cmdGridPoint As System.Windows.Forms.ToolStripMenuItem
End Class
+261 -166
View File
@@ -10,17 +10,18 @@ Public Class Scene
'---- Members ---------
Private m_nGseContext As Integer
Private m_nStatus As Integer
Private m_nOldStatus As Integer
Private m_nStatus As ST
Private m_nOldStatus As ST
Private Enum ST As Integer
NULL = 0
PAN = 1
ROT = 2
ZOOMWIN = 3
ANALYZE = 4
GETDIST = 5
GETDIST2 = 6
SELPOINT = 7
WINSEL = 4
ANALYZE = 5
GETDIST = 6
GETDIST2 = 7
SELPOINT = 8
End Enum
Private m_nSnapType As Integer
Private m_PrevPoint As Point
@@ -29,13 +30,13 @@ Public Class Scene
Private m_b2Buff As Boolean
Private m_nColorBits As Integer
Private m_nDepthBits As Integer
Private m_BackTopColor As Color
Private m_BackBotColor As Color
Private m_DefColor As Color
Private m_MarkColor As Color
Private m_BackTopColor As Color3d
Private m_BackBotColor As Color3d
Private m_DefColor As Color3d
Private m_MarkColor As Color3d
Private m_bZwOutline As Boolean
Private m_ZwColor As Color
Private m_DstLnColor As Color
Private m_ZwColor As Color3d
Private m_DstLnColor As Color3d
'---- Constructor -----
@@ -50,7 +51,7 @@ Public Class Scene
m_nGseContext = 0
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
m_nSnapType = SP_END
m_nSnapType = SP.PT_GRID
m_PrevPoint = Point.Empty
m_nDriver = 3
m_b2Buff = True
@@ -74,25 +75,25 @@ Public Class Scene
m_nDepthBits = nDepthBits
End Sub
Public Sub SetViewBackground(ByRef BackTopColor As Color, ByRef BackBotColor As Color)
Public Sub SetViewBackground(ByRef BackTopColor As Color3d, ByRef BackBotColor As Color3d)
m_BackTopColor = BackTopColor
m_BackBotColor = BackBotColor
End Sub
Public Sub SetDefaultMaterial(ByRef DefColor As Color)
Public Sub SetDefaultMaterial(ByRef DefColor As Color3d)
m_DefColor = DefColor
End Sub
Public Sub SetMarkMaterial(ByRef DefColor As Color)
Public Sub SetMarkMaterial(ByRef DefColor As Color3d)
m_MarkColor = DefColor
End Sub
Public Sub SetZoomWinAttribs(ByVal bZwOutline As Boolean, ByRef ZwColor As Color)
Public Sub SetZoomWinAttribs(ByVal bZwOutline As Boolean, ByRef ZwColor As Color3d)
m_bZwOutline = bZwOutline
m_ZwColor = ZwColor
End Sub
Public Sub SetDistLineMaterial(ByRef DstLnColor As Color)
Public Sub SetDistLineMaterial(ByRef DstLnColor As Color3d)
m_DstLnColor = DstLnColor
End Sub
@@ -101,13 +102,12 @@ Public Class Scene
Public Sub Init()
m_nGseContext = EgtInitGeomDB()
EgtSetDefaultMaterial(m_DefColor.R, m_DefColor.G, m_DefColor.B)
EgtSetDefaultMaterial(m_DefColor)
EgtInitScene(Handle, m_nDriver, m_b2Buff, m_nColorBits, m_nDepthBits)
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)
EgtSetBackground(m_BackTopColor, m_BackBotColor)
EgtSetMarkAttribs(m_MarkColor)
EgtSetWinRectAttribs(m_bZwOutline, m_ZwColor)
EgtSetGeoLineAttribs(m_DstLnColor)
EgtInitTscExec()
End Sub
@@ -155,7 +155,7 @@ Public Class Scene
End Sub
'---- Events ----------
Public Event OnMouseSelected(ByVal sender As Object, ByVal nId As Integer)
Public Event OnMouseSelected(ByVal sender As Object, ByVal nId As Integer, ByVal bLast As Boolean)
Public Event OnMouseAnalyzed(ByVal sender As Object, ByVal nId As Integer)
Public Event OnMouseDownScene(ByVal sender As Object)
Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String)
@@ -184,14 +184,22 @@ Public Class Scene
Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)
' Imposto il contesto della scena come corrente
EgtSetCurrentContext(m_nGseContext)
' --- Pressione tasto sinistro ---
If e.Button = Windows.Forms.MouseButtons.Left Then
If m_nStatus = ST.NULL Or m_nStatus = ST.ANALYZE Then
' se stato WINSEL oppure NULL e premuto SHIFT allora inizio selezione a finestra
If m_nStatus = ST.WINSEL Or
(m_nStatus = ST.NULL And (Control.ModifierKeys And Keys.Shift) = Keys.Shift) Then
Cursor = New Cursor(Me.GetType(), "WinSelect.cur")
m_PrevPoint = e.Location
m_nStatus = ST.WINSEL
' se stato NULL (selezione) o analisi
ElseIf m_nStatus = ST.NULL Or m_nStatus = ST.ANALYZE Then
If m_nStatus = ST.NULL Then
Cursor = New Cursor(Me.GetType(), "Select.cur")
Else
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
End If
Dim nId As Integer = GDB_ID_NULL
Dim nId As Integer = GDB_ID.NULL
Dim nSel As Integer
EgtSelect(e.Location, DIM_SEL, DIM_SEL, nSel)
If nSel = 1 Then
@@ -206,24 +214,26 @@ Public Class Scene
nId = MselDlg.GetId()
End If
End If
If nId <> GDB_ID_NULL Then
If nId <> GDB_ID.NULL Then
If m_nStatus = ST.NULL Then
RaiseEvent OnMouseSelected(Me, nId)
RaiseEvent OnMouseSelected(Me, nId, True)
Else
RaiseEvent OnMouseAnalyzed(Me, nId)
End If
End If
' se stato misura di distanza (primo punto)
ElseIf m_nStatus = ST.GETDIST Then
If EgtGetSelectedSnapPoint(m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, m_ptPrev) Then
If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then
' salvo il punto di riferimento
Dim ptWin As Point3d
EgtProjectPoint(m_ptPrev, ptWin)
m_PrevPoint = New Point(ptWin.x, ptWin.y)
m_nStatus = ST.GETDIST2
End If
' se stato misura di distanza (secondo punto)
ElseIf m_nStatus = ST.GETDIST2 Then
Dim ptSel As Point3d
If EgtGetSelectedSnapPoint(m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, ptSel) Then
If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, ptSel) Then
' disegno la linea (coordinate geo globali)
EgtSetGeoLine(m_ptPrev, ptSel)
' calcolo la distanza e il delta e li visualizzo
@@ -245,32 +255,33 @@ Public Class Scene
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
' se stato selezione punto
ElseIf m_nStatus = ST.SELPOINT Then
If EgtGetSelectedSnapPoint(m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, m_ptPrev) Then
If EgtGetGraphicSnapPoint(m_nSnapType, e.Location, DIM_SEL, DIM_SEL, m_ptPrev) Then
RaiseEvent OnMouseSelectedPoint(Me, m_ptPrev)
End If
End If
' --- Pressione tasto medio (rotella) ---
ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then
' se premuto SHIFT entro in zoom a finestra
If (Control.ModifierKeys And Keys.Shift) = Keys.Shift Then
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then
m_nOldStatus = m_nStatus
End If
SaveCurrStatus()
m_nStatus = ST.ZOOMWIN
Cursor = New Cursor(Me.GetType(), "ZoomWin.cur")
' se premuto CTRL entro in rotazione vista
ElseIf (Control.ModifierKeys And Keys.Control) = Keys.Control Then
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then
m_nOldStatus = m_nStatus
End If
SaveCurrStatus()
m_nStatus = ST.ROT
Cursor = New Cursor(Me.GetType(), "Rotate.cur")
' altrimenti entro in pan
Else
If m_nStatus = ST.ANALYZE Or m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then
m_nOldStatus = m_nStatus
End If
SaveCurrStatus()
m_nStatus = ST.PAN
Cursor = New Cursor(Me.GetType(), "Pan.cur")
End If
' salvo il punto in coordinate finestra
m_PrevPoint = e.Location
' --- Tutti gli altri casi ---
Else
MyBase.OnMouseDown(e)
End If
@@ -284,33 +295,55 @@ Public Class Scene
If nOldGseCtx <> m_nGseContext Then
EgtSetCurrentContext(m_nGseContext)
End If
' rilascio tasto medio (rotella)
If e.Button = Windows.Forms.MouseButtons.Middle Then
' --- Rilascio tasto sinistro ---
If e.Button = Windows.Forms.MouseButtons.Left Then
If m_nStatus = ST.WINSEL Then
EgtResetWinRect(True)
' determino entità selezionate
Dim Center As Point
Center.X = 0.5 * (e.Location.X + m_PrevPoint.X)
Center.Y = 0.5 * (e.Location.Y + m_PrevPoint.Y)
Dim nH As Integer = Abs(e.Location.X - m_PrevPoint.X)
Dim nW As Integer = Abs(e.Location.Y - m_PrevPoint.Y)
Dim nSel As Integer
EgtSelect(Center, nH, nW, nSel)
' notifico per ogni entità selezionata
Dim nId = EgtGetFirstObjInSelWin()
While nId <> GDB_ID.NULL
Dim nNextId = EgtGetNextObjInSelWin()
RaiseEvent OnMouseSelected(Me, nId, (nNextId = GDB_ID.NULL))
nId = nNextId
End While
' ritorno allo stato NULL
m_nStatus = ST.NULL
Cursor = New Cursor(Me.GetType(), "Select.cur")
End If
' --- Rilascio tasto medio (rotella) ---
ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then
If m_nStatus = ST.ZOOMWIN Then
EgtResetWinRect(False)
EgtZoomWin(m_PrevPoint, e.Location, True)
End If
' eventuale ripristino vecchio stato
If m_nOldStatus = ST.ANALYZE Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
ElseIf m_nOldStatus = ST.GETDIST Or m_nOldStatus = ST.GETDIST2 Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "GetDist.cur")
ElseIf m_nOldStatus = ST.SELPOINT Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "Select.cur")
If RestoreStatus() Then
' non devo fare alcunché
' reset dello stato se non NULL
ElseIf m_nStatus <> ST.NULL Then
m_nStatus = ST.NULL
Cursor = New Cursor(Me.GetType(), "Select.cur")
End If
' rilascio tasto destro
' --- Rilascio tasto destro ---
ElseIf e.Button = Windows.Forms.MouseButtons.Right Then
If m_nStatus = ST.NULL Then
MenuScene.Visible = True
For Each i As ToolStripMenuItem In MenuScene.Items
If i.Name = "cmdDeselectAll" Then
For Each i As ToolStripItem In MenuScene.Items
If i.Name = "cmdSelectAll" Then
i.Visible = True
ElseIf i.Name = "cmdDeselectAll" Then
i.Visible = True
ElseIf i.Name = "sepSel1" Then
i.Visible = True
ElseIf i.Name = "cmdWinSelect" Then
i.Visible = True
Else
i.Visible = False
@@ -318,19 +351,25 @@ Public Class Scene
Next
ElseIf m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or m_nStatus = ST.SELPOINT Then
MenuScene.Visible = True
For Each i As ToolStripMenuItem In MenuScene.Items
If i.Name = "cmdEndPoint" Then
For Each i As ToolStripItem In MenuScene.Items
If i.Name = "cmdSketchPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_END)
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_SKETCH)
ElseIf i.Name = "cmdGridPoint" Then
i.Visible = True
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_GRID)
ElseIf i.Name = "cmdEndPoint" Then
i.Visible = True
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_END)
ElseIf i.Name = "cmdMidPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_MID)
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_MID)
ElseIf i.Name = "cmdCenterPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_CENTER)
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.CENTER)
ElseIf i.Name = "cmdNearPoint" Then
i.Visible = True
i.Checked = (m_nSnapType = SP_NEAR)
DirectCast(i, ToolStripMenuItem).Checked = (m_nSnapType = SP.PT_NEAR)
Else
i.Visible = False
End If
@@ -338,7 +377,7 @@ Public Class Scene
Else
MenuScene.Visible = False
End If
' tutti gli altri casi
' --- Tutti gli altri casi ---
Else
MyBase.OnMouseUp(e)
End If
@@ -356,8 +395,16 @@ Public Class Scene
End If
'Visualizzo le coordinate del mouse
ShowCursorPos(e.Location)
'In base allo stato...
If e.Button = Windows.Forms.MouseButtons.Middle Then
' --- Premuto tasto sinistro ---
If e.Button = Windows.Forms.MouseButtons.Left Then
If m_nStatus = ST.WINSEL Then
Cursor = New Cursor(Me.GetType(), "WinSelect.cur")
EgtSetWinRect(m_PrevPoint, e.Location, True)
'Else
' m_nStatus = ST.NULL
End If
' --- Premuto tasto centrale (rotella) ---
ElseIf e.Button = Windows.Forms.MouseButtons.Middle Then
If m_nStatus = ST.ZOOMWIN Then
Cursor = New Cursor(Me.GetType(), "ZoomWin.cur")
EgtSetWinRect(m_PrevPoint, e.Location, True)
@@ -372,8 +419,10 @@ Public Class Scene
m_PrevPoint = e.Location
Else
m_nStatus = ST.NULL
Cursor = New Cursor(Me.GetType(), "Select.cur")
End If
' --- Altri casi dipendenti dallo stato ---
ElseIf m_nStatus = ST.WINSEL Then
Cursor = New Cursor(Me.GetType(), "WinSelect.cur")
ElseIf m_nStatus = ST.ANALYZE Then
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
ElseIf m_nStatus = ST.GETDIST Then
@@ -386,8 +435,9 @@ Public Class Scene
ElseIf m_nStatus = ST.SELPOINT Then
Cursor = New Cursor(Me.GetType(), "Select.cur")
Dim ptP As Point3d
EgtUnProjectPoint(e.Location, ptP)
RaiseEvent OnMouseMoveSelPoint(Me, ptP)
If EgtGetGraphicSnapPoint(SP.PT_SKETCH, e.Location, DIM_SEL, DIM_SEL, ptP) Then
RaiseEvent OnMouseMoveSelPoint(Me, ptP)
End If
Else
MyBase.OnMouseMove(e)
End If
@@ -439,17 +489,17 @@ Public Class Scene
'costruisco stringa con dati
Dim sCursorPos As New System.Text.StringBuilder
Select Case nDir
Case CT_TOP, CT_BOTTOM
Case VT.TOP, VT.BOTTOM
sCursorPos.Append("X=")
sCursorPos.Append(ptWorld.x.ToString("F4", CultureInfo.InvariantCulture))
sCursorPos.Append(" Y=")
sCursorPos.Append(ptWorld.y.ToString("F4", CultureInfo.InvariantCulture))
Case CT_FRONT, CT_BACK
Case VT.FRONT, VT.BACK
sCursorPos.Append("X=")
sCursorPos.Append(ptWorld.x.ToString("F4", CultureInfo.InvariantCulture))
sCursorPos.Append(" Z=")
sCursorPos.Append(ptWorld.z.ToString("F4", CultureInfo.InvariantCulture))
Case CT_LEFT, CT_RIGHT
Case VT.LEFT, VT.RIGHT
sCursorPos.Append("Y=")
sCursorPos.Append(ptWorld.y.ToString("F4", CultureInfo.InvariantCulture))
sCursorPos.Append(" Z=")
@@ -463,29 +513,112 @@ Public Class Scene
Private Sub MenuScene_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuScene.ItemClicked
If e.ClickedItem.Name = "cmdDeselectAll" Then
If e.ClickedItem.Name = "cmdSelectAll" Then
ElseIf e.ClickedItem.Name = "cmdDeselectAll" Then
EgtDeselectAll()
EgtDraw()
ElseIf e.ClickedItem.Name = "cmdWinSelect" Then
m_nStatus = ST.WINSEL
ElseIf e.ClickedItem.Name = "cmdSketchPoint" Then
m_nSnapType = SP.PT_SKETCH
ElseIf e.ClickedItem.Name = "cmdGridPoint" Then
m_nSnapType = SP.PT_GRID
ElseIf e.ClickedItem.Name = "cmdEndPoint" Then
m_nSnapType = SP_END
m_nSnapType = SP.PT_END
ElseIf e.ClickedItem.Name = "cmdMidPoint" Then
m_nSnapType = SP_MID
m_nSnapType = SP.PT_MID
ElseIf e.ClickedItem.Name = "cmdCenterPoint" Then
m_nSnapType = SP_CENTER
m_nSnapType = SP.CENTER
ElseIf e.ClickedItem.Name = "cmdNearPoint" Then
m_nSnapType = SP_NEAR
m_nSnapType = SP.PT_NEAR
End If
End Sub
'---- Status management -------------
Private Sub SaveCurrStatus()
If m_nStatus = ST.WINSEL Or
m_nStatus = ST.ANALYZE Or
m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Or
m_nStatus = ST.SELPOINT Then
m_nOldStatus = m_nStatus
End If
End Sub
Private Function RestoreStatus() As Boolean
' eventuale ripristino vecchio stato
If m_nOldStatus = ST.WINSEL Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "WinSelect.cur")
Return True
ElseIf m_nOldStatus = ST.ANALYZE Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "Analyze.cur")
Return True
ElseIf m_nOldStatus = ST.GETDIST Or m_nOldStatus = ST.GETDIST2 Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "GetDist.cur")
Return True
ElseIf m_nOldStatus = ST.SELPOINT Then
m_nStatus = m_nOldStatus
Cursor = New Cursor(Me.GetType(), "Select.cur")
Return True
End If
Return False
End Function
Public Sub SetStatusAnalyze()
m_nStatus = ST.ANALYZE
End Sub
Public Sub SetStatusGetDistance()
m_nStatus = ST.GETDIST
End Sub
Public Sub SetStatusSelPoint()
m_nStatus = ST.SELPOINT
End Sub
Public Sub ResetStatus(Optional ByVal bRedraw As Boolean = True)
' pulisco eventuali geometrie temporanee
EraseDragGroup()
EgtResetGeoLine(False)
EgtResetWinRect(False)
' imposto lo stato
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
' aggiorno visualizzazione
If bRedraw Then
EgtDraw()
End If
End Sub
Public Sub ResetStatusAnalyze()
If m_nStatus = ST.ANALYZE Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
End Sub
Public Sub ResetStatusGetDistance()
If m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
EgtResetGeoLine()
RaiseEvent OnCloseGetDist(Me)
End Sub
'---- Drag Group ------
Private m_nDragGroup As Integer = GDB_ID_NULL
Private m_nDragGroup As Integer = GDB_ID.NULL
Public Function CreateDragGroup() As Boolean
m_nDragGroup = EgtCreateGroup(GDB_ID_ROOT)
If m_nDragGroup = GDB_ID_NULL Then
m_nDragGroup = EgtCreateGroup(GDB_ID.ROOT)
If m_nDragGroup = GDB_ID.NULL Then
Return False
End If
EgtSetLevel(m_nDragGroup, GDB_LV_TEMP)
EgtSetLevel(m_nDragGroup, GDB_LV.TEMP)
EgtSetMark(m_nDragGroup)
EgtUnselectableAdd(m_nDragGroup)
Return True
End Function
@@ -493,12 +626,12 @@ Public Class Scene
Public Function EraseDragGroup() As Boolean
EgtErase(m_nDragGroup)
EgtUnselectableRemove(m_nDragGroup)
m_nDragGroup = GDB_ID_NULL
m_nDragGroup = GDB_ID.NULL
Return True
End Function
Public Function AddToDragGroup(ByVal nId As Integer) As Boolean
Return EgtCopyGlob(nId, m_nDragGroup, GDB_SON) <> GDB_ID_NULL
Return EgtCopyGlob(nId, m_nDragGroup, GDB_POS.SON) <> GDB_ID.NULL
End Function
Public Function GetDragGroup() As Integer
@@ -508,7 +641,7 @@ Public Class Scene
'---- Main Buttons ----
Public Function NewProject() As Boolean
Dim bOk As Boolean = EgtNewFile()
EgtZoom(ZM_ALL)
EgtZoom(ZM.ALL)
If bOk Then
RaiseEvent OnNewProject(Me)
Else
@@ -538,7 +671,7 @@ Public Class Scene
'Caricamento del progetto
Cursor = Cursors.WaitCursor
Dim bOk As Boolean = EgtOpenFile(sFile)
EgtZoom(ZM_ALL)
EgtZoom(ZM.ALL)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
@@ -550,14 +683,14 @@ Public Class Scene
End Function
Public Function SaveProject(Optional ByVal sFile As String = "") As Boolean
If String.IsNullOrEmpty(sFile) Or EgtGetFileType(sFile) <> FT_NGE Then
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)
Dim bOk As Boolean = EgtSaveFile(sFile, NGE.CMPTEXT)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
@@ -584,7 +717,7 @@ Public Class Scene
RaiseEvent OnSavingProject(Me, SaveFileDialog.FileName)
'Salvataggio del progetto
Cursor = Cursors.WaitCursor
Dim bOk As Boolean = EgtSaveFile(SaveFileDialog.FileName, NGE_CMPTEXT)
Dim bOk As Boolean = EgtSaveFile(SaveFileDialog.FileName, NGE.CMPTEXT)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
@@ -614,7 +747,7 @@ Public Class Scene
End If
'Riconoscimento tipo file
Dim nFileType As Integer = EgtGetFileType(sFile)
If nFileType <> FT_DXF And nFileType <> FT_STL And nFileType <> FT_CNC Then
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
End If
@@ -624,14 +757,14 @@ Public Class Scene
Cursor = Cursors.WaitCursor
Dim bOk As Boolean = EgtNewFile()
'Importazione
If nFileType = FT_DXF Then
If nFileType = FT.DXF Then
bOk = bOk And EgtImportDxf(sFile)
ElseIf nFileType = FT_STL Then
ElseIf nFileType = FT.STL Then
bOk = bOk And EgtImportStl(sFile)
ElseIf nFileType = FT_CNC Then
ElseIf nFileType = FT.CNC Then
bOk = bOk And EgtImportCnc(sFile)
End If
EgtZoom(ZM_ALL)
EgtZoom(ZM.ALL)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
@@ -656,7 +789,7 @@ Public Class Scene
End If
'Riconoscimento tipo file
Dim nFileType As Integer = EgtGetFileType(SaveFileDialog.FileName)
If nFileType <> FT_DXF And nFileType <> FT_STL Then
If nFileType <> FT.DXF And nFileType <> FT.STL Then
MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End If
@@ -665,10 +798,10 @@ Public Class Scene
'Esportazione del progetto
Cursor = Cursors.WaitCursor
Dim bOk As Boolean = False
If nFileType = FT_DXF Then
bOk = EgtExportDxf(GDB_ID_ROOT, SaveFileDialog.FileName)
ElseIf nFileType = FT_STL Then
bOk = EgtExportStl(GDB_ID_ROOT, SaveFileDialog.FileName)
If nFileType = FT.DXF Then
bOk = EgtExportDxf(GDB_ID.ROOT, SaveFileDialog.FileName)
ElseIf nFileType = FT.STL Then
bOk = EgtExportStl(GDB_ID.ROOT, SaveFileDialog.FileName)
End If
Cursor = Cursors.Default
'Gestione risultato
@@ -712,7 +845,7 @@ Public Class Scene
Else
bOk = EgtTscExecFile(sFile)
End If
EgtZoom(ZM_ALL)
EgtZoom(ZM.ALL)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
@@ -727,105 +860,67 @@ Public Class Scene
Return bOk
End Function
'---- Analyze Operations -------------
Public Sub SetStatusAnalyze()
m_nStatus = ST.ANALYZE
'---- Zoom Buttons ----
Public Sub ZoomAll()
EgtZoom(ZM.ALL)
End Sub
Public Sub ResetStatusAnalyze()
If m_nStatus = ST.ANALYZE Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
Public Sub ZoomIn()
EgtZoom(ZM.IN_)
End Sub
'---- Distance Operations -------------
Public Sub SetStatusGetDistance()
m_nStatus = ST.GETDIST
Public Sub ZoomOut()
EgtZoom(ZM.OUT)
End Sub
Public Sub ResetStatusGetDistance()
If m_nStatus = ST.GETDIST Or m_nStatus = ST.GETDIST2 Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
EgtResetGeoLine()
RaiseEvent OnCloseGetDist(Me)
End Sub
'---- Distance Operations -------------
Public Sub SetStatusSelPoint()
m_nStatus = ST.SELPOINT
End Sub
Public Sub ResetStatusSelPoint()
If m_nStatus = ST.SELPOINT Then
m_nStatus = ST.NULL
m_nOldStatus = ST.NULL
End If
End Sub
'---- Zoom Buttons ----
Public Sub ZoomAll()
EgtZoom(ZM_ALL)
End Sub
Public Sub ZoomIn()
EgtZoom(ZM_IN)
End Sub
Public Sub ZoomOut()
EgtZoom(ZM_OUT)
End Sub
'---- Rendering Buttons ----
Public Sub WireFrame()
EgtSetShowMode(SM_WIREFRAME)
EgtSetShowMode(SM.WIREFRAME)
End Sub
Public Sub HiddenLine()
EgtSetShowMode(SM_HIDDENLINE)
EgtSetShowMode(SM.HIDDENLINE)
End Sub
Public Sub Shading()
EgtSetShowMode(SM_SHADING)
EgtSetShowMode(SM.SHADING)
End Sub
'---- LookFrom Buttons ----
Public Sub TopView()
EgtSetView(CT_TOP)
End Sub
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)
EgtSetView(VT.TOP)
End Sub
Public Sub FrontView()
EgtSetView(CT_FRONT)
EgtSetView(VT.FRONT)
End Sub
Public Sub BackView()
EgtSetView(CT_BACK)
EgtSetView(VT.BACK)
End Sub
Public Sub LeftView()
EgtSetView(CT_LEFT)
EgtSetView(VT.LEFT)
End Sub
Public Sub RightView()
EgtSetView(CT_RIGHT)
EgtSetView(VT.RIGHT)
End Sub
Public Sub IsoViewSW()
EgtSetView(VT.ISO_SW)
End Sub
Public Sub IsoViewSE()
EgtSetView(VT.ISO_SE)
End Sub
Public Sub IsoViewNE()
EgtSetView(VT.ISO_NE)
End Sub
Public Sub IsoViewNW()
EgtSetView(VT.ISO_NW)
End Sub
End Class
+3 -3
View File
@@ -10,7 +10,7 @@ Public Class SelectMulti
ListBox1.BeginUpdate()
'Inserisco le entità nel mirino
Dim nId = EgtGetFirstObjInSelWin()
While nId <> GDB_ID_NULL
While nId <> GDB_ID.NULL
Dim sTitle As String = String.Empty
EgtGetTitle(nId, sTitle)
If EgtIsSelectedObj(nId) Then
@@ -22,10 +22,10 @@ Public Class SelectMulti
nId = EgtGetNextObjInSelWin()
End While
'Inserisco None per non selezionare alcunchè
Dim smNone As New SelMulItem("None", GDB_ID_NULL)
Dim smNone As New SelMulItem("None", GDB_ID.NULL)
ListBox1.Items.Add(smNone)
ListBox1.EndUpdate()
m_nCurrEnt = GDB_ID_NULL
m_nCurrEnt = GDB_ID.NULL
ListBox1.SelectedIndex = 0
End Sub
+6 -6
View File
@@ -7,26 +7,26 @@ Public Class btnLookFrom
End Sub
Private Sub btnTop_Click(sender As System.Object, e As System.EventArgs) Handles btnTop.Click
EgtSetView(CT_TOP)
EgtSetView(VT.TOP)
End Sub
Private Sub btnIso_Click(sender As System.Object, e As System.EventArgs) Handles btnIso.Click
EgtSetView(CT_ISO_SW)
EgtSetView(VT.ISO_SW)
End Sub
Private Sub btnFront_Click(sender As System.Object, e As System.EventArgs) Handles btnFront.Click
EgtSetView(CT_FRONT)
EgtSetView(VT.FRONT)
End Sub
Private Sub btnBack_Click(sender As System.Object, e As System.EventArgs) Handles btnBack.Click
EgtSetView(CT_BACK)
EgtSetView(VT.BACK)
End Sub
Private Sub btnLeft_Click(sender As System.Object, e As System.EventArgs) Handles btnLeft.Click
EgtSetView(CT_LEFT)
EgtSetView(VT.LEFT)
End Sub
Private Sub btnRight_Click(sender As System.Object, e As System.EventArgs) Handles btnRight.Click
EgtSetView(CT_RIGHT)
EgtSetView(VT.RIGHT)
End Sub
End Class
+3 -3
View File
@@ -7,15 +7,15 @@ Public Class btnRendering
End Sub
Private Sub rbtnWireframe_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnWireframe.CheckedChanged
EgtSetShowMode(SM_WIREFRAME)
EgtSetShowMode(SM.WIREFRAME)
End Sub
Private Sub rbtnHiddenLine_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnHiddenLine.CheckedChanged
EgtSetShowMode(SM_HIDDENLINE)
EgtSetShowMode(SM.HIDDENLINE)
End Sub
Private Sub rbtnShading_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnShading.CheckedChanged
EgtSetShowMode(SM_SHADING)
EgtSetShowMode(SM.SHADING)
End Sub
End Class