diff --git a/EgtInterface.vb b/EgtInterface.vb index 50cbcda..6496b60 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -96,19 +96,31 @@ Public Shared Function EgtInitGeomDB() As Integer End Function -Public Shared Function EgtSetDefaultMaterial(ByVal nCtx As Integer, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean +Public Shared Function EgtSetCurrentContext(ByVal nCtx As Integer) As Boolean End Function -Public Shared Function EgtNewFile(ByVal nCtx As Integer) As Boolean +Public Shared Function EgtResetCurrentContext() As Boolean End Function -Public Shared Function EgtOpenFile(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtGetCurrentContext() As Integer End Function -Public Shared Function EgtSaveFile(ByVal nCtx As Integer, ByVal sFilePath As String, ByVal nFlag As Integer) As Boolean +Public Shared Function EgtSetDefaultMaterial(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean +End Function + + +Public Shared Function EgtNewFile() As Boolean +End Function + + +Public Shared Function EgtOpenFile(ByVal sFilePath As String) As Boolean +End Function + + +Public Shared Function EgtSaveFile(ByVal sFilePath As String, ByVal nFlag As Integer) As Boolean End Function @@ -116,23 +128,23 @@ Public Shared Function EgtGetFileType(ByVal sFilePath As String) As Integer End Function -Public Shared Function EgtImportDxf(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtImportDxf(ByVal sFilePath As String) As Boolean End Function -Public Shared Function EgtImportStl(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtImportStl(ByVal sFilePath As String) As Boolean End Function -Public Shared Function EgtImportCnc(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtImportCnc(ByVal sFilePath As String) As Boolean End Function -Public Shared Function EgtExportDxf(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtExportDxf(ByVal nId As Integer, ByVal sFilePath As String) As Boolean End Function -Public Shared Function EgtExportStl(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtExportStl(ByVal nId As Integer, ByVal sFilePath As String) As Boolean End Function @@ -141,81 +153,81 @@ End Function '---------- GeomDb Objects Modify ---------------------------------------------- -Public Shared Function EgtFlipText(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtFlipText(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtMirrorText(ByVal nCtx As Integer, ByVal nId As Integer, ByVal bOnL As Boolean) As Boolean +Public Shared Function EgtMirrorText(ByVal nId As Integer, ByVal bOnL As Boolean) As Boolean End Function '---------- GeomDb Objects ----------------------------------------------------- -Public Shared Function EgtExistsObj(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Boolean +Public Shared Function EgtExistsObj(ByVal nGroupId As Integer) As Boolean End Function -Public Shared Function EgtGetGroupObjs(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer +Public Shared Function EgtGetGroupObjs(ByVal nGroupId As Integer) As Integer End Function -Public Shared Function EgtGetFirstInGroup(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer +Public Shared Function EgtGetFirstInGroup(ByVal nGroupId As Integer) As Integer End Function -Public Shared Function EgtGetNext(ByVal nCtx As Integer, ByVal nId As Integer) As Integer +Public Shared Function EgtGetNext(ByVal nId As Integer) As Integer End Function -Public Shared Function EgtGetLastInGroup(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer +Public Shared Function EgtGetLastInGroup(ByVal nGroupId As Integer) As Integer End Function -Public Shared Function EgtGetPrev(ByVal nCtx As Integer, ByVal nId As Integer) As Integer +Public Shared Function EgtGetPrev(ByVal nId As Integer) As Integer End Function -Public Shared Function EgtGetBBox(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nFlag As Integer, +Public Shared Function EgtGetBBox(ByVal nId As Integer, ByVal nFlag As Integer, ByRef PtMin As Point3d, ByRef PtMax As Point3d) As Boolean End Function -Public Shared Function EgtGetBBoxGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nFlag As Integer, +Public Shared Function EgtGetBBoxGlob(ByVal nId As Integer, ByVal nFlag As Integer, ByRef PtMin As Point3d, ByRef PtMax As Point3d) As Boolean End Function -Public Shared Function EgtGetType(ByVal nCtx As Integer, ByVal nId As Integer) As Integer +Public Shared Function EgtGetType(ByVal nId As Integer) As Integer End Function -Private Shared Function EgtGetTitle(ByVal nCtx As Integer, ByVal nId As Integer, ByRef psTitle As IntPtr) As Boolean +Private Shared Function EgtGetTitle(ByVal nId As Integer, ByRef psTitle As IntPtr) As Boolean End Function -Public Shared Function EgtGetTitle(ByVal nCtx As Integer, ByVal nId As Integer, ByRef sTitle As String) As Boolean +Public Shared Function EgtGetTitle(ByVal nId As Integer, ByRef sTitle As String) As Boolean Dim psTitle As IntPtr - Dim bOk As Boolean = EgtGetTitle(nCtx, nId, psTitle) + Dim bOk As Boolean = EgtGetTitle(nId, psTitle) sTitle = Marshal.PtrToStringUni(psTitle) EgtFreeMemory(psTitle) Return bOk End Function -Private Shared Function EgtGroupDump(ByVal nCtx As Integer, ByVal nId As Integer, ByRef psDump As IntPtr) As Boolean +Private Shared Function EgtGroupDump(ByVal nId As Integer, ByRef psDump As IntPtr) As Boolean End Function -Public Shared Function EgtGroupDump(ByVal nCtx As Integer, ByVal nId As Integer, ByRef sDump As String) As Boolean +Public Shared Function EgtGroupDump(ByVal nId As Integer, ByRef sDump As String) As Boolean Dim psDump As IntPtr - Dim bOk As Boolean = EgtGroupDump(nCtx, nId, psDump) + Dim bOk As Boolean = EgtGroupDump(nId, psDump) sDump = Marshal.PtrToStringUni(psDump) EgtFreeMemory(psDump) Return bOk End Function -Private Shared Function EgtGeoObjDump(ByVal nCtx As Integer, ByVal nId As Integer, ByRef psDump As IntPtr) As Boolean +Private Shared Function EgtGeoObjDump(ByVal nId As Integer, ByRef psDump As IntPtr) As Boolean End Function -Public Shared Function EgtGeoObjDump(ByVal nCtx As Integer, ByVal nId As Integer, ByRef sDump As String) As Boolean +Public Shared Function EgtGeoObjDump(ByVal nId As Integer, ByRef sDump As String) As Boolean Dim psDump As IntPtr - Dim bOk As Boolean = EgtGeoObjDump(nCtx, nId, psDump) + Dim bOk As Boolean = EgtGeoObjDump(nId, psDump) sDump = Marshal.PtrToStringUni(psDump) EgtFreeMemory(psDump) Return bOk @@ -224,366 +236,362 @@ End Function '---------- GeomDb Obj Attributes ---------------------------------------------- -Public Shared Function EgtSetLevel(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nLevel As Integer) As Boolean +Public Shared Function EgtSetLevel(ByVal nId As Integer, ByVal nLevel As Integer) As Boolean End Function -Public Shared Function EgtRevertLevel(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtRevertLevel(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtGetLevel(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nLevel As Integer) As Boolean +Public Shared Function EgtGetLevel(ByVal nId As Integer, ByRef nLevel As Integer) As Boolean End Function -Public Shared Function EgtGetCalcLevel(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nLevel As Integer) As Boolean +Public Shared Function EgtGetCalcLevel(ByVal nId As Integer, ByRef nLevel As Integer) As Boolean End Function -Public Shared Function EgtSetMode(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nMode As Integer) As Boolean +Public Shared Function EgtSetMode(ByVal nId As Integer, ByVal nMode As Integer) As Boolean End Function -Public Shared Function EgtRevertMode(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtRevertMode(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtGetMode(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nMode As Integer) As Boolean +Public Shared Function EgtGetMode(ByVal nId As Integer, ByRef nMode As Integer) As Boolean End Function -Public Shared Function EgtGetCalcMode(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nMode As Integer) As Boolean +Public Shared Function EgtGetCalcMode(ByVal nId As Integer, ByRef nMode As Integer) As Boolean End Function -Public Shared Function EgtSetStatus(ByVal nCtx As Integer, ByVal nId As Integer, ByVal nStat As Integer) As Boolean +Public Shared Function EgtSetStatus(ByVal nId As Integer, ByVal nStat As Integer) As Boolean End Function -Public Shared Function EgtRevertStatus(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtRevertStatus(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtGetStatus(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nStat As Integer) As Boolean +Public Shared Function EgtGetStatus(ByVal nId As Integer, ByRef nStat As Integer) As Boolean End Function -Public Shared Function EgtGetCalcStatus(ByVal nCtx As Integer, ByVal nId As Integer, ByRef nStat As Integer) As Boolean +Public Shared Function EgtGetCalcStatus(ByVal nId As Integer, ByRef nStat As Integer) As Boolean End Function -Public Shared Function EgtSetMark(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtSetMark(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtResetMark(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtResetMark(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtGetMark(ByVal nCtx As Integer, ByVal nId As Integer, ByRef bMark As Boolean) As Boolean +Public Shared Function EgtGetMark(ByVal nId As Integer, ByRef bMark As Boolean) As Boolean End Function -Public Shared Function EgtGetCalcMark(ByVal nCtx As Integer, ByVal nId As Integer, ByRef bMark As Boolean) As Boolean +Public Shared Function EgtGetCalcMark(ByVal nId As Integer, ByRef bMark As Boolean) As Boolean End Function -Public Shared Function EgtSetName(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sName As String) As Boolean +Public Shared Function EgtSetName(ByVal nId As Integer, ByVal sName As String) As Boolean End Function -Private Shared Function EgtGetName(ByVal nCtx As Integer, ByVal nId As Integer, ByRef psName As IntPtr) As Boolean +Private Shared Function EgtGetName(ByVal nId As Integer, ByRef psName As IntPtr) As Boolean End Function -Public Shared Function EgtGetName(ByVal nCtx As Integer, ByVal nId As Integer, ByRef sName As String) As Boolean +Public Shared Function EgtGetName(ByVal nId As Integer, ByRef sName As String) As Boolean Dim psName As IntPtr - Dim bOk As Boolean = EgtGetName(nCtx, nId, psName) + Dim bOk As Boolean = EgtGetName(nId, psName) sName = Marshal.PtrToStringUni(psName) EgtFreeMemory(psName) Return bOk End Function -Public Shared Function EgtExistsName(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtExistsName(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtRemoveName(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtRemoveName(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtSetInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String, ByVal sInfo As String) As Boolean +Public Shared Function EgtSetInfo(ByVal nId As Integer, ByVal sKey As String, ByVal sInfo As String) As Boolean End Function -Private Shared Function EgtGetInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String, ByRef psInfo As IntPtr) As Boolean +Private Shared Function EgtGetInfo(ByVal nId As Integer, ByVal sKey As String, ByRef psInfo As IntPtr) As Boolean End Function -Public Shared Function EgtGetInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String, ByRef sInfo As String) As Boolean +Public Shared Function EgtGetInfo(ByVal nId As Integer, ByVal sKey As String, ByRef sInfo As String) As Boolean Dim psInfo As IntPtr - Dim bOk As Boolean = EgtGetInfo(nCtx, nId, sKey, psInfo) + Dim bOk As Boolean = EgtGetInfo(nId, sKey, psInfo) sInfo = Marshal.PtrToStringUni(psInfo) EgtFreeMemory(psInfo) Return bOk End Function -Public Shared Function EgtExistsInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String) As Boolean +Public Shared Function EgtExistsInfo(ByVal nId As Integer, ByVal sKey As String) As Boolean End Function -Public Shared Function EgtRemoveInfo(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sKey As String) As Boolean +Public Shared Function EgtRemoveInfo(ByVal nId As Integer, ByVal sKey As String) As Boolean End Function '---------- GeomDb Obj Selection ----------------------------------------------- -Public Shared Function EgtIsSelectedObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtIsSelectedObj(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtSelectObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtSelectObj(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtDeselectObj(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean +Public Shared Function EgtDeselectObj(ByVal nId As Integer) As Boolean End Function -Public Shared Function EgtDeselectAll(ByVal nCtx As Integer) As Boolean +Public Shared Function EgtDeselectAll() As Boolean End Function '---------- GeomDb Obj Transform ----------------------------------------------- -Public Shared Function EgtMove(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean +Public Shared Function EgtMove(ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean End Function -Public Shared Function EgtMoveGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean +Public Shared Function EgtMoveGlob(ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean End Function -Public Shared Function EgtMoveGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean +Public Shared Function EgtMoveGroup(ByVal nId As Integer, ByRef VtMove As Vector3d) As Boolean End Function -Public Shared Function EgtRotate(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean +Public Shared Function EgtRotate(ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean End Function -Public Shared Function EgtRotateGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean +Public Shared Function EgtRotateGlob(ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean End Function -Public Shared Function EgtRotateGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean +Public Shared Function EgtRotateGroup(ByVal nId As Integer, ByRef PtAx As Point3d, ByRef VtAx As Vector3d, ByVal dAngRotDeg As Double) As Boolean End Function -Public Shared Function EgtScale(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d, +Public 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 EgtScaleGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d, +Public 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 EgtScaleGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOrig As Point3d, +Public Shared Function EgtScaleGroup(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 EgtMirror(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean +Public Shared Function EgtMirror(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean End Function -Public Shared Function EgtMirrorGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean +Public Shared Function EgtMirrorGlob(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean End Function -Public Shared Function EgtMirrorGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean +Public Shared Function EgtMirrorGroup(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d) As Boolean End Function -Public Shared Function EgtShear(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, +Public Shared Function EgtShear(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean End Function -Public Shared Function EgtShearGlob(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, +Public Shared Function EgtShearGlob(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean End Function -Public Shared Function EgtShearGroup(ByVal nCtx As Integer, ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, +Public Shared Function EgtShearGroup(ByVal nId As Integer, ByRef PtOn As Point3d, ByRef VtNorm As Vector3d, ByRef VtDir As Vector3d, ByVal dCoeff As Double) As Boolean End Function '---------- Scene -------------------------------------------------------------- -Public Shared Function EgtInitScene(ByVal nCtx As Integer, ByVal hWnd As IntPtr, ByVal nDriver As Integer, +Public Shared Function EgtInitScene(ByVal hWnd As IntPtr, ByVal nDriver As Integer, ByVal b2Buff As Boolean, ByVal nColorBits As Integer, ByVal nDepthBits As Integer) As Boolean End Function -Public Shared Function EgtSetBackground(ByVal nCtx As Integer, ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer, +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 End Function -Public Shared Function EgtSetMarkAttribs(ByVal nCtx As Integer, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean +Public Shared Function EgtSetMarkAttribs(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean End Function -Public Shared Function EgtSetGeoLineAttribs(ByVal nCtx As Integer, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean +Public Shared Function EgtSetGeoLineAttribs(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean End Function -Public Shared Function EgtSetWinRectAttribs(ByVal nCtx As Integer, 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, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer, ByVal nAlpha As Integer) As Boolean End Function -Public Shared Function EgtResize(ByVal nCtx As Integer, ByVal nW As Integer, ByVal nH As Integer) As Boolean +Public Shared Function EgtResize(ByVal nW As Integer, ByVal nH As Integer) As Boolean End Function -Public Shared Function EgtDraw(ByVal nCtx As Integer) As Boolean +Public Shared Function EgtDraw() As Boolean End Function -Private Shared Function EgtSelect(ByVal nCtx As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, +Private Shared Function EgtSelect(ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal nSelW As Integer, ByVal nSelH As Integer, ByRef nSel As Integer) As Boolean End Function -Public Shared Function EgtSelect(ByVal nCtx As Integer, ByVal Curr As Point, ByVal nSelW As Integer, ByVal nSelH As Integer, +Public Shared Function EgtSelect(ByVal Curr As Point, ByVal nSelW As Integer, ByVal nSelH As Integer, ByRef nSel As Integer) As Boolean - Return EgtSelect(nCtx, Curr.X, Curr.Y, nSelW, nSelH, nSel) + Return EgtSelect(Curr.X, Curr.Y, nSelW, nSelH, nSel) End Function -Public Shared Function EgtGetFirstSelectedObj(ByVal nGseCtx As Integer) As Integer +Public Shared Function EgtGetFirstSelectedObj() As Integer End Function -Public Shared Function EgtGetNextSelectedObj(ByVal nGseCtx As Integer) As Integer +Public Shared Function EgtGetNextSelectedObj() As Integer End Function -Public Shared Function EgtGetSelectedSnapPoint(ByVal nGseCtx As Integer, ByVal nSnap As Integer, +Public Shared Function EgtGetSelectedSnapPoint(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 EgtSetShowMode(ByVal nCtx As Integer, ByVal nShowMode As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtSetShowMode(ByVal nShowMode As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Public Shared Function EgtGetShowMode(ByVal nCtx As Integer) As Integer +Public Shared Function EgtGetShowMode() As Integer End Function -Public Shared Function EgtSetShowCurveDirection(ByVal nCtx As Integer, ByVal bShow As Boolean, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtSetShowCurveDirection(ByVal bShow As Boolean, Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Public Shared Function EgtGetShowCurveDirection(ByVal nCtx As Integer) As Boolean +Public Shared Function EgtGetShowCurveDirection() As Boolean End Function -Public Shared Function EgtZoom(ByVal nCtx As Integer, ByVal nZoom As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtZoom(ByVal nZoom As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Private Shared Function EgtZoomOnPoint(ByVal nCtx As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal dCoeff As Double, ByVal bRedraw As Boolean) As Boolean +Private Shared Function EgtZoomOnPoint(ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal dCoeff As Double, ByVal bRedraw As Boolean) As Boolean End Function -Public Shared Function EgtZoomOnPoint(ByVal nCtx As Integer, ByVal Curr As Point, ByVal dCoeff As Double, Optional ByVal bRedraw As Boolean = True) As Boolean - Return EgtZoomOnPoint(nCtx, Curr.X, Curr.Y, dCoeff, bRedraw) +Public Shared Function EgtZoomOnPoint(ByVal Curr As Point, ByVal dCoeff As Double, Optional ByVal bRedraw As Boolean = True) As Boolean + Return EgtZoomOnPoint(Curr.X, Curr.Y, dCoeff, bRedraw) End Function -Public Shared Function EgtSetGeoLine(ByVal nCtx As Integer, ByRef ptP1 As Point3d, ByRef ptP2 As Point3d, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtSetGeoLine(ByRef ptP1 As Point3d, ByRef ptP2 As Point3d, Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Public Shared Function EgtResetGeoLine(ByVal nCtx As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtResetGeoLine(Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Private Shared Function EgtSetWinRect(ByVal nCtx As Integer, ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean +Private Shared Function EgtSetWinRect(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean End Function -Public Shared Function EgtSetWinRect(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean - Return EgtSetWinRect(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) +Public Shared Function EgtSetWinRect(ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean + Return EgtSetWinRect(Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) End Function -Public Shared Function EgtResetWinRect(ByVal nCtx As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtResetWinRect(Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Private Shared Function EgtZoomWin(ByVal nCtx As Integer, ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean +Private Shared Function EgtZoomWin(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean End Function -Public Shared Function EgtZoomWin(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean - Return EgtZoomWin(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) +Public Shared Function EgtZoomWin(ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean + Return EgtZoomWin(Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) End Function -Public Shared Function EgtSetView(ByVal nCtx As Integer, ByVal nView As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean +Public Shared Function EgtSetView(ByVal nView As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean End Function -Private Shared Function EgtPanCamera(ByVal nCtx As Integer, ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean +Private Shared Function EgtPanCamera(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean End Function -Public Shared Function EgtPanCamera(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean - Return EgtPanCamera(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) +Public Shared Function EgtPanCamera(ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean + Return EgtPanCamera(Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) End Function -Private Shared Function EgtRotateCamera(ByVal nCtx As Integer, ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean +Private Shared Function EgtRotateCamera(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer, ByVal bRedraw As Boolean) As Boolean End Function -Public Shared Function EgtRotateCamera(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean - Return EgtRotateCamera(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) +Public Shared Function EgtRotateCamera(ByVal Prev As Point, ByVal Curr As Point, Optional ByVal bRedraw As Boolean = True) As Boolean + Return EgtRotateCamera(Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw) End Function -Public Shared Function EgtGetCameraDir(ByVal nCtx As Integer, ByRef nDir As Integer) As Boolean +Public Shared Function EgtGetCameraDir(ByRef nDir As Integer) As Boolean End Function -Private Shared Function EgtUnProjectPoint(ByVal nCtx As Integer, ByVal nWinX As Integer, ByVal nWinY As Integer, ByRef ptP As Point3d) As Boolean +Private Shared Function EgtUnProjectPoint(ByVal nWinX As Integer, ByVal nWinY As Integer, ByRef ptP As Point3d) As Boolean End Function -Public Shared Function EgtUnProjectPoint(ByVal nCtx As Integer, ByVal Curr As Point, ByRef ptP As Point3d) As Boolean - Return EgtUnProjectPoint(nCtx, Curr.X, Curr.Y, ptP) +Public Shared Function EgtUnProjectPoint(ByVal Curr As Point, ByRef ptP As Point3d) As Boolean + Return EgtUnProjectPoint(Curr.X, Curr.Y, ptP) End Function -Public Shared Function EgtProjectPoint(ByVal nCtx As Integer, ByRef ptP As Point3d, ByRef ptWin As Point3d) As Boolean +Public Shared Function EgtProjectPoint(ByRef ptP As Point3d, ByRef ptWin As Point3d) As Boolean End Function '---------- Tsc Executor ------------------------------------------------------- -Public Shared Function EgtInitTscExec(ByVal nCtx As Integer) As Boolean +Public Shared Function EgtInitTscExec() As Boolean End Function -Public Shared Function EgtTscExecFile(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean +Public Shared Function EgtTscExecFile(ByVal sFilePath As String) As Boolean End Function -Public Shared Function EgtTscExecLine(ByVal nCtx As Integer, ByVal sLine As String) As Boolean +Public Shared Function EgtTscExecLine(ByVal sLine As String) As Boolean End Function '---------- LUA Executor ------------------------------------------------------- - -Public Shared Function EgtLuaSetContext(ByVal nCtx As Integer) As Boolean -End Function - Public Shared Function EgtLuaExecFile(ByVal sFilePath As String) As Boolean End Function @@ -668,7 +676,7 @@ 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 -Public Const BBF_NONE As Integer = 0 +Public Const BBF_STANDARD As Integer = 0 Public Const BBF_ONLY_VISIBLE As Integer = 1 Public Const BBF_IGNORE_TEXT As Integer = 2 diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index 99fe9cf..3f70476 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -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: - - + + diff --git a/Scene.vb b/Scene.vb index d1bf4cc..7d58668 100644 --- a/Scene.vb +++ b/Scene.vb @@ -97,11 +97,11 @@ Public Class Scene Public Sub Init() m_nGseContext = EgtInitGeomDB() - EgtSetDefaultMaterial(m_nGseContext, m_nDefMatRed, m_nDefMatGreen, m_nDefMatBlue) - EgtInitScene(m_nGseContext, Handle, m_nDriver, m_b2Buff, m_nColorBits, m_nDepthBits) - EgtSetBackground(m_nGseContext, m_nBackTopRed, m_nBackTopGreen, m_nBackTopBlue, + EgtSetDefaultMaterial(m_nDefMatRed, m_nDefMatGreen, m_nDefMatBlue) + EgtInitScene(Handle, m_nDriver, m_b2Buff, m_nColorBits, m_nDepthBits) + EgtSetBackground(m_nBackTopRed, m_nBackTopGreen, m_nBackTopBlue, m_nBackBotRed, m_nBackBotGreen, m_nBackBotBlue) - EgtInitTscExec(m_nGseContext) + EgtInitTscExec() End Sub Public Function GetCtx() As Integer @@ -115,7 +115,17 @@ Public Class Scene Protected Overrides Sub OnPaint(e As PaintEventArgs) MyBase.OnPaint(e) - EgtDraw(m_nGseContext) + ' Salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(m_nGseContext) + End If + ' Eseguo il disegno + EgtDraw() + ' Ripristino il contesto originale + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(nOldGseCtx) + End If End Sub Protected Overrides Sub OnPaintBackground(pevent As PaintEventArgs) @@ -124,7 +134,17 @@ Public Class Scene Protected Overrides Sub OnResize(e As System.EventArgs) MyBase.OnResize(e) - EgtResize(m_nGseContext, Width, Height) + ' Salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(m_nGseContext) + End If + ' Eseguo ridimensionamento vista + EgtResize(Width, Height) + ' Ripristino il contesto originale + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(nOldGseCtx) + End If End Sub '---- Events ---------- @@ -153,6 +173,8 @@ Public Class Scene End Sub Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs) + ' Imposto il contesto della scena come corrente + EgtSetCurrentContext(m_nGseContext) If e.Button = Windows.Forms.MouseButtons.Left Then If m_nStatus = ST.NULL Or m_nStatus = ST.ANALYZE Then If m_nStatus = ST.NULL Then @@ -162,12 +184,11 @@ Public Class Scene End If Dim nId As Integer = GDB_ID_NULL Dim nSel As Integer - EgtSelect(m_nGseContext, e.Location, DIM_SEL, DIM_SEL, nSel) + EgtSelect(e.Location, DIM_SEL, DIM_SEL, nSel) If nSel = 1 Then - nId = EgtGetFirstSelectedObj(m_nGseContext) + nId = EgtGetFirstSelectedObj() ElseIf nSel > 1 Then Dim MselDlg As New SelectMulti - MselDlg.SetContext(m_nGseContext) MselDlg.StartPosition = System.Windows.Forms.FormStartPosition.Manual Dim ptScreen As Point = PointToScreen(e.Location) ptScreen.Offset(10, 0) @@ -184,18 +205,18 @@ Public Class Scene End If End If ElseIf m_nStatus = ST.GETDIST Then - If EgtGetSelectedSnapPoint(m_nGseContext, m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, m_ptPrev) Then + If EgtGetSelectedSnapPoint(m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, m_ptPrev) Then ' salvo il punto di riferimento Dim ptWin As Point3d - EgtProjectPoint(m_nGseContext, m_ptPrev, ptWin) + EgtProjectPoint(m_ptPrev, ptWin) m_PrevPoint = New Point(ptWin.x, ptWin.y) m_nStatus = ST.GETDIST2 End If ElseIf m_nStatus = ST.GETDIST2 Then Dim ptSel As Point3d - If EgtGetSelectedSnapPoint(m_nGseContext, m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, ptSel) Then + If EgtGetSelectedSnapPoint(m_nSnapType, e.Location.X, e.Location.Y, DIM_SEL, DIM_SEL, ptSel) Then ' disegno la linea (coordinate geo globali) - EgtSetGeoLine(m_nGseContext, m_ptPrev, ptSel) + EgtSetGeoLine(m_ptPrev, ptSel) ' calcolo la distanza e il delta e li visualizzo Dim dX As Double = ptSel.x - m_ptPrev.x Dim dY As Double = ptSel.y - m_ptPrev.y @@ -245,11 +266,16 @@ Public Class Scene End Sub Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs) + ' salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(m_nGseContext) + End If ' rilascio tasto medio (rotella) If e.Button = Windows.Forms.MouseButtons.Middle Then If m_nStatus = ST.ZOOMWIN Then - EgtResetWinRect(m_nGseContext, False) - EgtZoomWin(m_nGseContext, m_PrevPoint, e.Location, True) + EgtResetWinRect(False) + EgtZoomWin(m_PrevPoint, e.Location, True) End If ' eventuale ripristino vecchio stato If m_nOldStatus = ST.ANALYZE Then @@ -300,24 +326,33 @@ Public Class Scene Else MyBase.OnMouseUp(e) End If + ' Ripristino il contesto originale + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(nOldGseCtx) + End If End Sub Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs) + ' salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(m_nGseContext) + End If 'Visualizzo le coordinate del mouse ShowCursorPos(e.Location) 'In base allo stato... If e.Button = Windows.Forms.MouseButtons.Middle Then If m_nStatus = ST.ZOOMWIN Then Cursor = New Cursor(Me.GetType(), "ZoomWin.cur") - EgtSetWinRect(m_nGseContext, m_PrevPoint, e.Location, True) + EgtSetWinRect(m_PrevPoint, e.Location, True) 'Il punto di riferimento deve rimanere quello originale ElseIf m_nStatus = ST.ROT Then Cursor = New Cursor(Me.GetType(), "Rotate.cur") - EgtRotateCamera(m_nGseContext, m_PrevPoint, e.Location, True) + EgtRotateCamera(m_PrevPoint, e.Location, True) m_PrevPoint = e.Location ElseIf m_nStatus = ST.PAN Then Cursor = New Cursor(Me.GetType(), "Pan.cur") - EgtPanCamera(m_nGseContext, m_PrevPoint, e.Location, True) + EgtPanCamera(m_PrevPoint, e.Location, True) m_PrevPoint = e.Location Else m_nStatus = ST.NULL @@ -328,8 +363,8 @@ Public Class Scene ElseIf m_nStatus = ST.GETDIST2 Then Cursor = New Cursor(Me.GetType(), "GetDist.cur") Dim ptP As Point3d - EgtUnProjectPoint(m_nGseContext, e.Location, ptP) - EgtSetGeoLine(m_nGseContext, m_ptPrev, ptP) + EgtUnProjectPoint(e.Location, ptP) + EgtSetGeoLine(m_ptPrev, ptP) ElseIf m_nStatus = ST.ANALYZE Then Cursor = New Cursor(Me.GetType(), "Analyze.cur") Else @@ -338,6 +373,10 @@ Public Class Scene If m_nStatus = ST.NULL Then Cursor = New Cursor(Me.GetType(), "Select.cur") End If + ' Ripristino il contesto originale + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(nOldGseCtx) + End If End Sub Protected Overrides Sub OnMouseWheel(e As System.Windows.Forms.MouseEventArgs) @@ -355,17 +394,26 @@ Public Class Scene If e.Delta < 0 Then dCoeff = 1 / dCoeff End If + ' salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(m_nGseContext) + End If ' eseguo zoom - EgtZoomOnPoint(m_nGseContext, e.Location, dCoeff, True) + EgtZoomOnPoint(e.Location, dCoeff, True) + ' Ripristino il contesto originale + If nOldGseCtx <> m_nGseContext Then + EgtSetCurrentContext(nOldGseCtx) + End If End Sub Private Sub ShowCursorPos(ByVal WinXY As Point) 'ricavo punto 3d Dim ptWorld As Point3d - EgtUnProjectPoint(m_nGseContext, WinXY, ptWorld) + EgtUnProjectPoint(WinXY, ptWorld) 'ricavo direzione di vista Dim nDir As Integer - EgtGetCameraDir(m_nGseContext, nDir) + EgtGetCameraDir(nDir) 'costruisco stringa con dati Dim sCursorPos As New System.Text.StringBuilder Select Case nDir @@ -394,8 +442,8 @@ Public Class Scene Private Sub MenuScene_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles MenuScene.ItemClicked If e.ClickedItem.Name = "cmdDeselectAll" Then - EgtDeselectAll(GetCtx()) - EgtDraw(GetCtx()) + EgtDeselectAll() + EgtDraw() ElseIf e.ClickedItem.Name = "cmdEndPoint" Then m_nSnapType = SP_END ElseIf e.ClickedItem.Name = "cmdMidPoint" Then @@ -409,8 +457,8 @@ Public Class Scene '---- Main Buttons ---- Public Function NewProject() As Boolean - Dim bOk As Boolean = EgtNewFile(m_nGseContext) - EgtZoom(m_nGseContext, ZM_ALL) + Dim bOk As Boolean = EgtNewFile() + EgtZoom(ZM_ALL) If bOk Then RaiseEvent OnNewProject(Me) Else @@ -434,7 +482,7 @@ Public Class Scene RaiseEvent OnOpeningProject(Me) 'Caricamento del progetto Cursor = Cursors.WaitCursor - Dim bOk As Boolean = EgtOpenFile(m_nGseContext, OpenFileDialog.FileName) + Dim bOk As Boolean = EgtOpenFile(OpenFileDialog.FileName) EgtZoom(m_nGseContext, ZM_ALL) Cursor = Cursors.Default 'Gestione risultato @@ -459,7 +507,7 @@ Public Class Scene RaiseEvent OnSavingProject(Me, SaveFileDialog.FileName) 'Salvataggio del progetto Cursor = Cursors.WaitCursor - Dim bOk As Boolean = EgtSaveFile(m_nGseContext, SaveFileDialog.FileName, NGE_CMPTEXT) + Dim bOk As Boolean = EgtSaveFile(SaveFileDialog.FileName, NGE_CMPTEXT) Cursor = Cursors.Default 'Gestione risultato If bOk Then @@ -492,14 +540,14 @@ Public Class Scene RaiseEvent OnImportingProject(Me) 'Pulizia GeomDB Cursor = Cursors.WaitCursor - Dim bOk As Boolean = EgtNewFile(m_nGseContext) + Dim bOk As Boolean = EgtNewFile() 'Importazione If nFileType = FT_DXF Then - bOk = bOk And EgtImportDxf(m_nGseContext, OpenFileDialog.FileName) + bOk = bOk And EgtImportDxf(OpenFileDialog.FileName) ElseIf nFileType = FT_STL Then - bOk = bOk And EgtImportStl(m_nGseContext, OpenFileDialog.FileName) + bOk = bOk And EgtImportStl(OpenFileDialog.FileName) ElseIf nFileType = FT_CNC Then - bOk = bOk And EgtImportCnc(m_nGseContext, OpenFileDialog.FileName) + bOk = bOk And EgtImportCnc(OpenFileDialog.FileName) End If EgtZoom(m_nGseContext, ZM_ALL) Cursor = Cursors.Default @@ -535,9 +583,9 @@ Public Class Scene Cursor = Cursors.WaitCursor Dim bOk As Boolean = False If nFileType = FT_DXF Then - bOk = EgtExportDxf(m_nGseContext, GDB_ID_ROOT, SaveFileDialog.FileName) + bOk = EgtExportDxf(GDB_ID_ROOT, SaveFileDialog.FileName) ElseIf nFileType = FT_STL Then - bOk = EgtExportStl(m_nGseContext, GDB_ID_ROOT, SaveFileDialog.FileName) + bOk = EgtExportStl(GDB_ID_ROOT, SaveFileDialog.FileName) End If Cursor = Cursors.Default 'Gestione risultato @@ -574,7 +622,7 @@ Public Class Scene If (sExt = ".LUA") Then bOk = EgtLuaExecFile(OpenFileDialog.FileName) Else - bOk = EgtTscExecFile(m_nGseContext, OpenFileDialog.FileName) + bOk = EgtTscExecFile(OpenFileDialog.FileName) End If EgtZoom(m_nGseContext, ZM_ALL) Cursor = Cursors.Default @@ -601,7 +649,7 @@ Public Class Scene m_nStatus = ST.NULL m_nOldStatus = ST.NULL End If - EgtResetGeoLine(GetCtx()) + EgtResetGeoLine() RaiseEvent OnCloseGetDist(Me) End Sub @@ -619,53 +667,53 @@ Public Class Scene '---- Zoom Buttons ---- Public Sub ZoomAll() - EgtZoom(m_nGseContext, ZM_ALL) + EgtZoom(ZM_ALL) End Sub Public Sub ZoomIn() - EgtZoom(m_nGseContext, ZM_IN) + EgtZoom(ZM_IN) End Sub Public Sub ZoomOut() - EgtZoom(m_nGseContext, ZM_OUT) + EgtZoom(ZM_OUT) End Sub '---- Rendering Buttons ---- Public Sub WireFrame() - EgtSetShowMode(m_nGseContext, SM_WIREFRAME) + EgtSetShowMode(SM_WIREFRAME) End Sub Public Sub HiddenLine() - EgtSetShowMode(m_nGseContext, SM_HIDDENLINE) + EgtSetShowMode(SM_HIDDENLINE) End Sub Public Sub Shading() - EgtSetShowMode(m_nGseContext, SM_SHADING) + EgtSetShowMode(SM_SHADING) End Sub '---- LookFrom Buttons ---- Public Sub TopView() - EgtSetView(m_nGseContext, CT_TOP) + EgtSetView(CT_TOP) End Sub Public Sub IsoView() - EgtSetView(m_nGseContext, CT_ISO_SW) + EgtSetView(CT_ISO_SW) End Sub Public Sub FrontView() - EgtSetView(m_nGseContext, CT_FRONT) + EgtSetView(CT_FRONT) End Sub Public Sub BackView() - EgtSetView(m_nGseContext, CT_BACK) + EgtSetView(CT_BACK) End Sub Public Sub LeftView() - EgtSetView(m_nGseContext, CT_LEFT) + EgtSetView(CT_LEFT) End Sub Public Sub RightView() - EgtSetView(m_nGseContext, CT_RIGHT) + EgtSetView(CT_RIGHT) End Sub End Class \ No newline at end of file diff --git a/SelectMulti.vb b/SelectMulti.vb index 59eed71..d9363a2 100644 --- a/SelectMulti.vb +++ b/SelectMulti.vb @@ -4,23 +4,22 @@ Imports EgtUILib.EgtInterface Public Class SelectMulti - Dim m_nGseContext As Integer Dim m_nCurrEnt As Integer Private Sub SelectMulti_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load ListBox1.BeginUpdate() 'Inserisco le entità nel mirino - Dim nId = EgtGetFirstSelectedObj(m_nGseContext) + Dim nId = EgtGetFirstSelectedObj() While nId <> GDB_ID_NULL Dim sTitle As String = String.Empty - EgtGetTitle(m_nGseContext, nId, sTitle) - If EgtIsSelectedObj(m_nGseContext, nId) Then + EgtGetTitle(nId, sTitle) + If EgtIsSelectedObj(nId) Then sTitle += "*" End If sTitle += " (" & nId & ")" Dim smItem As New SelMulItem(sTitle, nId) ListBox1.Items.Add(smItem) - nId = EgtGetNextSelectedObj(m_nGseContext) + nId = EgtGetNextSelectedObj() End While 'Inserisco None per non selezionare alcunchè Dim smNone As New SelMulItem("None", GDB_ID_NULL) @@ -31,12 +30,8 @@ Public Class SelectMulti End Sub Private Sub SelectMulti_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed - EgtResetMark(m_nGseContext, m_nCurrEnt) - EgtDraw(m_nGseContext) - End Sub - - Public Sub SetContext(ByVal nGseContext As Integer) - m_nGseContext = nGseContext + EgtResetMark(m_nCurrEnt) + EgtDraw() End Sub Public Function GetId() As Integer @@ -61,10 +56,10 @@ Public Class SelectMulti End Sub Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged - EgtResetMark(m_nGseContext, m_nCurrEnt) + EgtResetMark(m_nCurrEnt) m_nCurrEnt = ListBox1.SelectedItem.m_nId - EgtSetMark(m_nGseContext, m_nCurrEnt) - EgtDraw(m_nGseContext) + EgtSetMark(m_nCurrEnt) + EgtDraw() End Sub End Class diff --git a/btnExec.vb b/btnExec.vb index 5afce26..f4929b0 100644 --- a/btnExec.vb +++ b/btnExec.vb @@ -3,13 +3,10 @@ Private m_scene As Scene Sub New() - ' Chiamata richiesta dalla finestra di progettazione. InitializeComponent() - - ' Aggiungere le eventuali istruzioni di inizializzazione dopo la chiamata a InitializeComponent(). + ' Inizializzazione Me.Text = "Exec" - End Sub Public Sub SetScene(ByRef scene As Scene) diff --git a/btnLookFrom.vb b/btnLookFrom.vb index ea8ec49..2e06ea9 100644 --- a/btnLookFrom.vb +++ b/btnLookFrom.vb @@ -2,38 +2,31 @@ Public Class btnLookFrom - Private m_nContext As Integer - Sub New() InitializeComponent() - m_nContext = 1 - End Sub - - Public Sub SetCtx(ByVal nCtx As Integer) - m_nContext = nCtx End Sub Private Sub btnTop_Click(sender As System.Object, e As System.EventArgs) Handles btnTop.Click - EgtSetView(m_nContext, CT_TOP, True) + EgtSetView(CT_TOP) End Sub Private Sub btnIso_Click(sender As System.Object, e As System.EventArgs) Handles btnIso.Click - EgtSetView(m_nContext, CT_ISO_SW, True) + EgtSetView(CT_ISO_SW) End Sub Private Sub btnFront_Click(sender As System.Object, e As System.EventArgs) Handles btnFront.Click - EgtSetView(m_nContext, CT_FRONT, True) + EgtSetView(CT_FRONT) End Sub Private Sub btnBack_Click(sender As System.Object, e As System.EventArgs) Handles btnBack.Click - EgtSetView(m_nContext, CT_BACK, True) + EgtSetView(CT_BACK) End Sub Private Sub btnLeft_Click(sender As System.Object, e As System.EventArgs) Handles btnLeft.Click - EgtSetView(m_nContext, CT_LEFT, True) + EgtSetView(CT_LEFT) End Sub Private Sub btnRight_Click(sender As System.Object, e As System.EventArgs) Handles btnRight.Click - EgtSetView(m_nContext, CT_RIGHT, True) + EgtSetView(CT_RIGHT) End Sub End Class diff --git a/btnRendering.vb b/btnRendering.vb index b105f0d..5786fdc 100644 --- a/btnRendering.vb +++ b/btnRendering.vb @@ -2,27 +2,20 @@ Public Class btnRendering - Private m_nContext As Integer - Sub New() InitializeComponent() - m_nContext = 1 - End Sub - - Public Sub SetCtx(ByVal nCtx As Integer) - m_nContext = nCtx End Sub Private Sub rbtnWireframe_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnWireframe.CheckedChanged - EgtSetShowMode(m_nContext, SM_WIREFRAME, True) + EgtSetShowMode(SM_WIREFRAME) End Sub Private Sub rbtnHiddenLine_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnHiddenLine.CheckedChanged - EgtSetShowMode(m_nContext, SM_HIDDENLINE, True) + EgtSetShowMode(SM_HIDDENLINE) End Sub Private Sub rbtnShading_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtnShading.CheckedChanged - EgtSetShowMode(m_nContext, SM_SHADING, True) + EgtSetShowMode(SM_SHADING) End Sub End Class diff --git a/tsInfo.vb b/tsInfo.vb index b983b73..9104bdf 100644 --- a/tsInfo.vb +++ b/tsInfo.vb @@ -70,14 +70,24 @@ Public Class tsInfo End If End Sub - Private Sub btnGetDist_CheckedChanged(sender As Object, e As System.EventArgs) - If btnGetDist.Checked Then - btnAnalyze.Checked = False ' l'altro bottone va deselezionato - m_scene.SetStatusGetDistance() - Else - m_scene.ResetStatusGetDistance() - End If - End Sub + Private Sub btnGetDist_CheckedChanged(sender As Object, e As System.EventArgs) + If btnGetDist.Checked Then + btnAnalyze.Checked = False ' l'altro bottone va deselezionato + m_scene.SetStatusGetDistance() + Else + ' Salvo il contesto corrente e imposto quello della scena + Dim nOldGseCtx = EgtGetCurrentContext() + If nOldGseCtx <> m_scene.GetCtx() Then + EgtSetCurrentContext(m_scene.GetCtx()) + End If + ' Reset nel contesto corretto della scena + m_scene.ResetStatusGetDistance() + ' Ripristino il contesto originale + If nOldGseCtx <> m_scene.GetCtx() Then + EgtSetCurrentContext(nOldGseCtx) + End If + End If + End Sub Private Sub btnAnalyze_Click(sender As Object, e As System.EventArgs) ' era selezionato -> va deselezionato