TestEIn 1.5i5 :

- modifiche per eseguire script Lua.
This commit is contained in:
Dario Sassi
2014-10-07 07:10:26 +00:00
parent af0ec05690
commit 786c6dca15
4 changed files with 60 additions and 10 deletions
+36 -3
View File
@@ -6,6 +6,14 @@ Structure Point3d
Dim x, y, z As Double
End Structure
Structure Vector3d
Dim x, y, z As Double
End Structure
Structure Color
Dim R, G, B, A As Integer
End Structure
#If PLATFORM = "x64" Then
#If DEBUG Then
Const EgtIntDll As String = "EgtInterfaceD64.dll"
@@ -351,17 +359,42 @@ Public Shared Function EgtUnProjectPoint(ByVal nCtx As Integer, ByVal Curr As Po
End Function
'TscExecutor
'Tsc Executor
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitTscExec(ByVal nCtx As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtTscFileExec(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
Public Shared Function EgtTscExecFile(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtTscLineExec(ByVal nCtx As Integer, ByVal sLine As String) As Boolean
Public Shared Function EgtTscExecLine(ByVal nCtx As Integer, ByVal sLine As String) As Boolean
End Function
'LUA Executor
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtLuaSetContext(ByVal nCtx As Integer) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtLuaExecFile(ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Public Shared Function EgtLuaExecLine(ByVal sLine As String) As Boolean
End Function
<DllImport(EgtIntDll, CharSet:=CharSet.Unicode)>
Private Shared Function EgtLuaGetLastError(ByRef psError As IntPtr) As Boolean
End Function
Public Shared Function EgtLuaGetLastError(ByRef sError As String) As Boolean
Dim psError As IntPtr
Dim bOk As Boolean = EgtLuaGetLastError(psError)
sError = Marshal.PtrToStringUni(psError)
EgtFreeMemory(psError)
Return bOk
End Function
+1 -1
View File
@@ -228,7 +228,7 @@ Public Class Form1
' ripristino stato oggetto marcato
Dim nIdOld As Integer = RevertOldIdInObjTree()
' eseguo comando
If EgtTscLineExec(Scene1.GetCtx, sCmd) Then
If EgtTscExecLine(Scene1.GetCtx, sCmd) Then
Scene1.Invalidate()
ToolStripStatusLabel3.Text = " "
Else
+2 -2
View File
@@ -43,5 +43,5 @@ Imports System.Runtime.InteropServices
' utilizzando l'asterisco (*) come descritto di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.9.2")>
<Assembly: AssemblyFileVersion("1.5.9.2")>
<Assembly: AssemblyVersion("1.5.9.5")>
<Assembly: AssemblyFileVersion("1.5.9.5")>
+21 -4
View File
@@ -1,4 +1,5 @@
Imports System.Math
Imports System.IO
Imports System.Globalization
Imports TestEIn.EgtInterface
@@ -386,22 +387,38 @@ Public Class Scene
Public Function Exec()
'Scelta file con dialogo
Dim OpenFileDialog As New OpenFileDialog
OpenFileDialog.Title = "Exec TSC"
OpenFileDialog.Filter = "Test commands(*.tsc)|*.tsc"
OpenFileDialog.FilterIndex = 1
OpenFileDialog.Title = "Exec Script"
OpenFileDialog.Filter = "Lua commands(*.lua)|*.lua" &
"|Test commands(*.tsc)|*.tsc" &
"|All Files (*.*)|*.*"
If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then
Return True
End If
'Ne verifico il tipo
Dim sExt As String = UCase(Path.GetExtension(OpenFileDialog.FileName))
If (sExt <> ".LUA" And sExt <> ".TSC") Then
MessageBox.Show("Script type unknow", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End If
'Prima dell'esecuzione
RaiseEvent OnExecutingScript(Me, OpenFileDialog.FileName)
'Esecuzione
Cursor = Cursors.WaitCursor
Dim bOk As Boolean = EgtTscFileExec(m_nGseContext, OpenFileDialog.FileName)
Dim bOk As Boolean = False
If (sExt = ".LUA") Then
bOk = EgtLuaExecFile(OpenFileDialog.FileName)
Else
bOk = EgtTscExecFile(m_nGseContext, OpenFileDialog.FileName)
End If
EgtZoom(m_nGseContext, ZM_ALL)
Cursor = Cursors.Default
'Gestione risultato
If bOk Then
RaiseEvent OnExecutedScript(Me)
ElseIf (sExt = ".LUA") Then
Dim sError As String = String.Empty
EgtLuaGetLastError(sError)
MessageBox.Show(sError, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("Error executing file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If