diff --git a/Controller.vb b/Controller.vb index 0266e8d..181dd08 100644 --- a/Controller.vb +++ b/Controller.vb @@ -190,6 +190,10 @@ Public Class Controller End Enum Private m_nInpType As IBT = IBT.TY_NULL + ' Image export + Private m_nImgWidth As Integer = 400 + Private m_nImgHeight As Integer = 300 + ' Costanti Private LEN_STD As Double = 100 Private EXTEND_ADD As Double = 10 @@ -482,15 +486,16 @@ Public Class Controller SaveFileDialog.Title = "Export" SaveFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" & "|Stereolithography (*.stl)|*.stl" & + "|Images (*.png;*.jpg;*.jpeg;*.bmp)|*.png;*.jpg;*.jpeg;*.bmp" & "|All Files (*.*)|*.*" - SaveFileDialog.FilterIndex = 3 + SaveFileDialog.FilterIndex = 4 SaveFileDialog.FileName = sFile If SaveFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then Return True 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 And nFileType <> FT.IMG Then MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Return False End If @@ -505,6 +510,9 @@ Public Class Controller bOk = EgtExportDxf(GDB_ID.ROOT, sFileName) ElseIf nFileType = FT.STL Then bOk = EgtExportStl(GDB_ID.ROOT, sFileName) + ElseIf nFileType = FT.IMG Then + bOk = EgtGetImage(SM.SHADING, New Color3d(255, 255, 255), New Color3d(255, 255, 255), + m_nImgWidth, m_nImgHeight, sFileName) End If DisableCommandLog() m_Scene.Cursor = Cursors.Default @@ -515,6 +523,11 @@ Public Class Controller Return bOk End Function + Public Sub SetDefaultForImageExport(nWidth As Integer, nHeight As Integer) + m_nImgWidth = nWidth + m_nImgHeight = nHeight + End Sub + Public Function Exec(Optional ByVal sDir As String = "", Optional ByVal bWithDlg As Boolean = True) As Boolean Dim sFile As String = sDir 'Scelta file con dialogo diff --git a/EgtInterface.vb b/EgtInterface.vb index 9e138ad..8eeefd9 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -915,6 +915,20 @@ Public Function EgtSetLuaLibs(sLuaLibsDir As String) As Boolean End If End Function + +Private Function EgtSetIniFile_32(sIniFile As String) As Boolean +End Function + +Private Function EgtSetIniFile_64(sIniFile As String) As Boolean +End Function +Public Function EgtSetIniFile(sIniFile As String) As Boolean + If IntPtr.Size = 4 Then + Return EgtSetIniFile_32(sIniFile) + Else + Return EgtSetIniFile_64(sIniFile) + End If +End Function + Private Function EgtSetCommandLogger_32(sLogFile As String) As Boolean End Function @@ -2883,6 +2897,20 @@ Public Function EgtMirrorText(nId As Integer, bOnL As Boolean) As Boolean End If End Function + +Private Function EgtModifyText_32(nId As Integer, sText As String) As Boolean +End Function + +Private Function EgtModifyText_64(nId As Integer, sText As String) As Boolean +End Function +Public Function EgtModifyText(nId As Integer, sText As String) As Boolean + If IntPtr.Size = 4 Then + Return EgtModifyText_32(nId, sText) + Else + Return EgtModifyText_64(nId, sText) + End If +End Function + Private Function EgtExplodeText_32(nId As Integer, ByRef nCount As Integer) As Integer End Function @@ -5947,6 +5975,29 @@ Public Function EgtTextNormVersor(nId As Integer, ByRef VtNorm As Vector3d) As B Return EgtTextNormVersor(nId, nId, VtNorm) End Function + +Private Function EgtTextGetContent_32(nId As Integer, ByRef psText As IntPtr) As Boolean +End Function + +Private Function EgtTextGetContent_64(nId As Integer, ByRef psText As IntPtr) As Boolean +End Function +Public Function EgtTextGetContent(nId As Integer, ByRef sText As String) As Boolean + Dim psText As IntPtr + Dim bOk As Boolean + If IntPtr.Size = 4 Then + bOk = EgtTextGetContent_32(nId, psText) + Else + bOk = EgtTextGetContent_64(nId, psText) + End If + If bOk Then + sText = Marshal.PtrToStringUni(psText) + EgtFreeMemory(psText) + Else + sText = String.Empty + End If + Return bOk +End Function + Private Function EgtPointToIdGlob_32(ByRef PtP As Point3d, nId As Integer) As Boolean End Function @@ -6524,6 +6575,42 @@ Public Function EgtInitMachMgr(sMachinesDir As String) As Boolean End If End Function +' Errors + +Private Function EgtGetLastMachMgrErrorId_32() As Integer +End Function + +Private Function EgtGetLastMachMgrErrorId_64() As Integer +End Function +Public Function EgtGetLastMachMgrErrorId() As Integer + If IntPtr.Size = 4 Then + Return EgtGetLastMachMgrErrorId_32() + Else + Return EgtGetLastMachMgrErrorId_64() + End If +End Function + + +Private Function EgtGetLastMachMgrErrorString_32() As IntPtr +End Function + +Private Function EgtGetLastMachMgrErrorString_64() As IntPtr +End Function +Public Function EgtGetLastMachMgrErrorString() As String + Dim sErr As String = String.Empty + Dim nTmp As IntPtr + If IntPtr.Size = 4 Then + nTmp = EgtGetLastMachMgrErrorString_32() + Else + nTmp = EgtGetLastMachMgrErrorString_64() + End If + If Not IsNothing(nTmp) Then + sErr = Marshal.PtrToStringUni(nTmp) + EgtFreeMemory(nTmp) + End If + Return sErr +End Function + ' Machines Private Function EgtSetCurrMachine_32(sMachineName As String) As Boolean @@ -6679,6 +6766,29 @@ Public Function EgtGetMachGroupName(nMGroupId As Integer, ByRef sMachGrpName As Return bOk End Function + +Private Function EgtGetMachGroupMachineName_32(nMGroupId As Integer, ByRef psMachineName As IntPtr) As Boolean +End Function + +Private Function EgtGetMachGroupMachineName_64(nMGroupId As Integer, ByRef psMachineName As IntPtr) As Boolean +End Function +Public Function EgtGetMachGroupMachineName(nMGroupId As Integer, ByRef sMachineName As String) As Boolean + Dim psMachineName As IntPtr + Dim bOk As Boolean + If IntPtr.Size = 4 Then + bOk = EgtGetMachGroupMachineName_32(nMGroupId, psMachineName) + Else + bOk = EgtGetMachGroupMachineName_64(nMGroupId, psMachineName) + End If + If bOk Then + sMachineName = Marshal.PtrToStringUni(psMachineName) + EgtFreeMemory(psMachineName) + Else + sMachineName = String.Empty + End If + Return bOk +End Function + Private Function EgtGetMachGroupId_32(sMachGrpName As String) As Integer End Function @@ -8608,6 +8718,20 @@ End Function End If End Function + + Private Function EgtResetCurrMachining_32() As Boolean + End Function + + Private Function EgtResetCurrMachining_64() As Boolean + End Function + Public Function EgtResetCurrMachining() As Boolean + If IntPtr.Size = 4 Then + Return EgtResetCurrMachining_32() + Else + Return EgtResetCurrMachining_64() + End If + End Function + Private Function EgtGetCurrMachining_32() As Integer End Function @@ -9641,16 +9765,16 @@ End Function Private Function EgtSetShowMode_32(nShowMode As SM, bRedraw As Boolean) As Boolean End Function - -Private Function EgtSetShowMode_64(nShowMode As SM, bRedraw As Boolean) As Boolean -End Function -Public Function EgtSetShowMode(nShowMode As SM, Optional bRedraw As Boolean = True) As Boolean - If IntPtr.Size = 4 Then - Return EgtSetShowMode_32(nShowMode, bRedraw) - Else - Return EgtSetShowMode_64(nShowMode, bRedraw) - End If -End Function + + Private Function EgtSetShowMode_64(nShowMode As SM, bRedraw As Boolean) As Boolean + End Function + Public Function EgtSetShowMode(nShowMode As SM, Optional bRedraw As Boolean = True) As Boolean + If IntPtr.Size = 4 Then + Return EgtSetShowMode_32(nShowMode, bRedraw) + Else + Return EgtSetShowMode_64(nShowMode, bRedraw) + End If + End Function Private Function EgtGetShowMode_32() As Integer @@ -10075,6 +10199,23 @@ Public Function EgtChangeTextureDimensions(sName As String, dDimX As Double, dDi End If End Function + +Private Function EgtGetImage_32(nShowMode As SM, ByRef colTop As Color3d, ByRef colBottom As Color3d, + nWidth As Integer, nHeight As Integer, sName As String) As Boolean +End Function + +Private Function EgtGetImage_64(nShowMode As SM, ByRef colTop As Color3d, ByRef colBottom As Color3d, + nWidth As Integer, nHeight As Integer, sName As String) As Boolean +End Function +Public Function EgtGetImage(nShowMode As SM, ByRef colTop As Color3d, ByRef colBottom As Color3d, + nWidth As Integer, nHeight As Integer, sName As String) As Boolean + If IntPtr.Size = 4 Then + Return EgtGetImage_32(nShowMode, colTop, colBottom, nWidth, nHeight, sName) + Else + Return EgtGetImage_64(nShowMode, colTop, colBottom, nWidth, nHeight, sName) + End If +End Function + '---------- Photo -------------------------------------------------------------- @@ -10792,6 +10933,7 @@ Public Enum FT As Integer CNC = 13 CSF = 14 BTL = 15 + IMG = 16 TSC = 101 LUA = 102 End Enum diff --git a/GenInterface.vb b/GenInterface.vb index 4ee6cd5..91f37d7 100644 --- a/GenInterface.vb +++ b/GenInterface.vb @@ -47,7 +47,7 @@ Public Function GetPrivateProfileString( ByVal lpDefault As String, ByRef lpString As String, ByVal lpFileName As String) As Integer - Dim sb As New StringBuilder(512) + Dim sb As New StringBuilder(1024) Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName) lpString = sb.ToString Return nRet diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb index d59ae1e..4a64e28 100644 --- a/My Project/AssemblyInfo.vb +++ b/My Project/AssemblyInfo.vb @@ -46,5 +46,5 @@ Imports System.Runtime.InteropServices ' utilizzando l'asterisco (*) come descritto di seguito: ' - - + +