TestEIn 1.5i1 :

- modifiche con aggiunta di Exec TSC.
This commit is contained in:
Dario Sassi
2014-09-01 17:09:19 +00:00
parent 2b91dc0c7f
commit 960ec01efb
6 changed files with 251 additions and 189 deletions
+120 -38
View File
@@ -51,83 +51,157 @@ End Function
Return bOk
End Function
'API reali
'API
'General
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetLog(ByVal nDebug As Integer, ByVal sLogFile As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetFont(ByVal sNfeFontDir As String, ByVal sDefaultFont As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInit(ByVal hWnd As IntPtr, ByVal nDriver As Integer, ByVal b2Buff As Boolean,
ByVal nColorBits As Integer, ByVal nDepthBits As Integer) As Boolean
Public Shared Function EgtInit(ByVal nDebug As Integer, ByVal sLogFile As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtExit() As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetDefaultMaterial(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean
Public Shared Function EgtSetFont(ByVal sNfeFontDir As String, ByVal sDefaultFont As String) As Boolean
End Function
'GeomDB
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetBackground(ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer,
Public Shared Function EgtInitGeomDB() As Integer
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetDefaultMaterial(ByVal nCtx As Integer, ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtNewFile(ByVal nCtx As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtOpenFile(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSaveFile(ByVal nCtx As Integer, ByVal sFilePath As String, ByVal nFlag As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetFileType(ByVal sFilePath As String) As Integer
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtImportDxf(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtImportStl(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtExportDxf(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtExportStl(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sFilePath As String) As Boolean
End Function
'Scene
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitScene(ByVal nCtx As Integer, ByVal hWnd As IntPtr, ByVal nDriver As Integer,
ByVal b2Buff As Boolean, ByVal nColorBits As Integer, ByVal nDepthBits As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetBackground(ByVal nCtx As Integer, ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer,
ByVal nBottomRed As Integer, ByVal nBottomGreen As Integer, ByVal nBottomBlue As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtNewFile() As Boolean
Public Shared Function EgtDraw(ByVal nCtx As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtOpenFile(ByVal sFilePath As String) As Boolean
Public Shared Function EgtResize(ByVal nCtx As Integer, ByVal nW As Integer, ByVal nH As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtTestImportExt(ByVal sFilePath As String) As Integer
Public Shared Function EgtSetShowMode(ByVal nCtx As Integer, ByVal nShowMode As Integer, ByVal bRedraw As Boolean) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtImportDxf(ByVal sFilePath As String) As Boolean
Public Shared Function EgtSetShowCurveDirection(ByVal nCtx As Integer, ByVal bShow As Boolean, ByVal bRedraw As Boolean) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtImportStl(ByVal sFilePath As String) As Boolean
Public Shared Function EgtZoom(ByVal nCtx As Integer, ByVal nZoom As Integer, ByVal bRedraw As Boolean) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtDraw() As Boolean
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
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtResize(ByVal nW As Integer, ByVal nH As Integer) As Boolean
Public Shared Function EgtZoomOnPoint(ByVal nCtx As Integer, ByVal Curr As Point, ByVal dCoeff As Double, ByVal bRedraw As Boolean) As Boolean
Return EgtZoomOnPoint(nCtx, Curr.X, Curr.Y, dCoeff, bRedraw)
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetShowMode(ByVal nShowMode As Integer) As Boolean
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
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetShowCurveDirection(ByVal bShow As Boolean) As Boolean
Public Shared Function EgtSetWinRect(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, ByVal bRedraw As Boolean) As Boolean
Return EgtSetWinRect(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw)
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtZoom(ByVal nZoom As Integer) As Boolean
Public Shared Function EgtResetWinRect(ByVal nCtx As Integer, ByVal bRedraw As Boolean) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtZoomOnPoint(ByVal nWinX As Integer, ByVal nWinY As Integer, ByVal dCoeff As Double) As Boolean
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
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetWinRect(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer) As Boolean
Public Shared Function EgtZoomWin(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, ByVal bRedraw As Boolean) As Boolean
Return EgtZoomWin(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw)
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtResetWinRect() As Boolean
Public Shared Function EgtSetView(ByVal nCtx As Integer, ByVal nView As Integer, ByVal bRedraw As Boolean) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtZoomWin(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer) As Boolean
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
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtSetView(ByVal nView As Integer) As Boolean
Public Shared Function EgtPanCamera(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, ByVal bRedraw As Boolean) As Boolean
Return EgtPanCamera(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw)
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtPanCamera(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer) As Boolean
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
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtRotateCamera(ByVal nPrevX As Integer, ByVal nPrevY As Integer, ByVal nCurrX As Integer, ByVal nCurrY As Integer) As Boolean
Public Shared Function EgtRotateCamera(ByVal nCtx As Integer, ByVal Prev As Point, ByVal Curr As Point, ByVal bRedraw As Boolean) As Boolean
Return EgtRotateCamera(nCtx, Prev.X, Prev.Y, Curr.X, Curr.Y, bRedraw)
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtGetCameraDir(ByRef nDir As Integer) As Boolean
Public Shared Function EgtGetCameraDir(ByVal nCtx As Integer, ByRef nDir As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtUnProject(ByVal nWinX As Integer, ByVal nWinY As Integer, ByRef ptP As Point3d) As Boolean
Private Shared Function EgtUnProjectPoint(ByVal nCtx As Integer, 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)
End Function
'TscExecutor
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtInitTscExec(ByVal nCtx As Integer) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtTscFileExec(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean
End Function
<DllImport(EgtInterface, CharSet:=CharSet.Unicode)>
Public Shared Function EgtTscLineExec(ByVal nCtx As Integer, ByVal sLine As String) As Boolean
End Function
'Costanti : TIPO VISUALIZZAZIONE
@@ -150,9 +224,17 @@ 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
'Costanti : TIPO FILE DA IMPORTARE
'Costanti : TIPO DI FILE
Public Const FT_NULL As Integer = 0
Public Const FT_DXF As Integer = 1
Public Const FT_STL As Integer = 2
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
'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
'Costanti : ID GRUPPO RADICE
Public Const GDB_ID_ROOT As Integer = 0
End Class
+7 -14
View File
@@ -23,7 +23,6 @@ Partial Class Form1
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.Scene1 = New TestEIn.Scene()
Me.FlowLayoutPanel1 = New System.Windows.Forms.FlowLayoutPanel()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Panel1 = New System.Windows.Forms.Panel()
@@ -52,7 +51,7 @@ Partial Class Form1
Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog()
Me.SaveFileDialog = New System.Windows.Forms.SaveFileDialog()
Me.ImportFileDialog = New System.Windows.Forms.OpenFileDialog()
Me.Scene1 = New TestEIn.Scene()
Me.TableLayoutPanel1.SuspendLayout()
Me.FlowLayoutPanel1.SuspendLayout()
Me.Panel1.SuspendLayout()
@@ -80,14 +79,6 @@ Partial Class Form1
Me.TableLayoutPanel1.Size = New System.Drawing.Size(685, 386)
Me.TableLayoutPanel1.TabIndex = 0
'
'Scene1
'
Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Scene1.Location = New System.Drawing.Point(105, 3)
Me.Scene1.Name = "Scene1"
Me.Scene1.Size = New System.Drawing.Size(376, 358)
Me.Scene1.TabIndex = 1
'
'FlowLayoutPanel1
'
Me.FlowLayoutPanel1.Controls.Add(Me.TextBox1)
@@ -369,10 +360,13 @@ Partial Class Form1
'
Me.SaveFileDialog.Title = "Save"
'
'ImportFileDialog
'Scene1
'
Me.ImportFileDialog.DefaultExt = "DXF"
Me.ImportFileDialog.Title = "Import"
Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Scene1.Location = New System.Drawing.Point(105, 3)
Me.Scene1.Name = "Scene1"
Me.Scene1.Size = New System.Drawing.Size(376, 358)
Me.Scene1.TabIndex = 1
'
'Form1
'
@@ -410,7 +404,6 @@ End Sub
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents btnNew As System.Windows.Forms.Button
Friend WithEvents btnImport As System.Windows.Forms.Button
Friend WithEvents ImportFileDialog As System.Windows.Forms.OpenFileDialog
Friend WithEvents btnIso As System.Windows.Forms.Button
Friend WithEvents btnTop As System.Windows.Forms.Button
Friend WithEvents btnRight As System.Windows.Forms.Button
+2 -5
View File
@@ -118,10 +118,10 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 6</value>
<value>281, 10</value>
</metadata>
<metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>440, 6</value>
<value>281, 10</value>
</metadata>
<metadata name="OpenFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>18, 8</value>
@@ -129,9 +129,6 @@
<metadata name="SaveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>165, 7</value>
</metadata>
<metadata name="ImportFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>298, 6</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>34</value>
</metadata>
+97 -110
View File
@@ -8,7 +8,7 @@ Public Class Form1
'-------------------------------- Form ------------------------------------------------------------
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Text = "EgalTech TestEngine"
Text = "EgalTech TestEIn"
rbtShading.Checked = True
Scene1.Init()
End Sub
@@ -19,189 +19,176 @@ Public Class Form1
'-------------------------------- Buttons --------------------------------------------------------
Private Sub btnNew_Click(sender As System.Object, e As System.EventArgs) Handles btnNew.Click
If EgtNewFile() Then
EgtZoom(ZM_ALL)
Scene1.Invalidate()
If EgtNewFile(Scene1.GetCtx) Then
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End If
End Sub
Private Sub btnOpen_Click(sender As System.Object, e As System.EventArgs) Handles btnOpen.Click
OpenFileDialog.Title = "Open"
OpenFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge|New font EgalTech(*.nfe)|*.nfe|All Files (*.*)|*.*"
OpenFileDialog.FilterIndex = 1
If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Cursor = Cursors.WaitCursor
If EgtOpenFile(OpenFileDialog.FileName) Then
EgtZoom(ZM_ALL)
Scene1.Invalidate()
If EgtOpenFile(Scene1.GetCtx, OpenFileDialog.FileName) Then
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End If
Cursor = Cursors.Default
End If
End Sub
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
SaveFileDialog.Title = "Save"
SaveFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge"
SaveFileDialog.FilterIndex = 1
If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Cursor = Cursors.WaitCursor
EgtSaveFile(Scene1.GetCtx, SaveFileDialog.FileName, NGE_CMPTEXT)
Cursor = Cursors.Default
End If
End Sub
Private Sub btnImport_Click(sender As System.Object, e As System.EventArgs) Handles btnImport.Click
ImportFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf|Stereolithography (*.stl)|*.stl|All Files (*.*)|*.*"
ImportFileDialog.FilterIndex = 1
If ImportFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim nFileType As Integer = EgtTestImportExt(ImportFileDialog.FileName)
OpenFileDialog.Title = "Import"
OpenFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf|Stereolithography (*.stl)|*.stl|All Files (*.*)|*.*"
OpenFileDialog.FilterIndex = 1
If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim nFileType As Integer = EgtGetFileType(OpenFileDialog.FileName)
If nFileType = FT_DXF Then
Cursor = Cursors.WaitCursor
EgtNewFile()
If EgtImportDxf(ImportFileDialog.FileName) Then
EgtZoom(ZM_ALL)
Scene1.Invalidate()
EgtNewFile(Scene1.GetCtx)
If EgtImportDxf(Scene1.GetCtx, OpenFileDialog.FileName) Then
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End If
Cursor = Cursors.Default
ElseIf nFileType = FT_STL Then
Cursor = Cursors.WaitCursor
EgtNewFile()
If EgtImportStl(ImportFileDialog.FileName) Then
EgtZoom(ZM_ALL)
Scene1.Invalidate()
EgtNewFile(Scene1.GetCtx)
If EgtImportStl(Scene1.GetCtx, OpenFileDialog.FileName) Then
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End If
Cursor = Cursors.Default
Else
MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
End Sub
Private Sub btnExport_Click(sender As System.Object, e As System.EventArgs) Handles btnExport.Click
SaveFileDialog.Title = "Export"
SaveFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf|Stereolithography (*.stl)|*.stl|All Files (*.*)|*.*"
SaveFileDialog.FilterIndex = 1
If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim nFileType As Integer = EgtGetFileType(SaveFileDialog.FileName)
If nFileType = FT_DXF Then
Cursor = Cursors.WaitCursor
EgtExportDxf(Scene1.GetCtx, GDB_ID_ROOT, SaveFileDialog.FileName)
Cursor = Cursors.Default
ElseIf nFileType = FT_STL Then
Cursor = Cursors.WaitCursor
EgtExportStl(Scene1.GetCtx, GDB_ID_ROOT, SaveFileDialog.FileName)
Cursor = Cursors.Default
Else
MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
End Sub
Private Sub btnExec_Click(sender As System.Object, e As System.EventArgs) Handles btnExec.Click
Dim bOk As Boolean
Dim hWnd As IntPtr
' emetto testo in editor
hWnd = TextBox1.Handle
bOk = OutText(hWnd, "Testo di prova abbastanza lungo")
' emetto croci in picture
hWnd = Scene1.Handle
bOk = DrawCross(hWnd, 100, 100, 10)
bOk = DrawCross(hWnd, 150, 100, 10)
bOk = DrawCross(hWnd, 150, 150, 10)
bOk = DrawCross(hWnd, 200, 150, 10)
OpenFileDialog.Title = "Exec TSC"
OpenFileDialog.Filter = "Test commands(*.tsc)|*.tsc"
OpenFileDialog.FilterIndex = 1
If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Cursor = Cursors.WaitCursor
If EgtTscFileExec(Scene1.GetCtx, OpenFileDialog.FileName) Then
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End If
Cursor = Cursors.Default
End If
End Sub
Private Sub rbtWireFrame_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtWireFrame.CheckedChanged
EgtSetShowMode(SM_WIREFRAME)
Scene1.Invalidate()
EgtSetShowMode(Scene1.GetCtx, SM_WIREFRAME, True)
End Sub
Private Sub rbtHiddenLine_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtHiddenLine.CheckedChanged
EgtSetShowMode(SM_HIDDENLINE)
Scene1.Invalidate()
EgtSetShowMode(Scene1.GetCtx, SM_HIDDENLINE, True)
End Sub
Private Sub rbtShading_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtShading.CheckedChanged
EgtSetShowMode(SM_SHADING)
Scene1.Invalidate()
EgtSetShowMode(Scene1.GetCtx, SM_SHADING, True)
End Sub
Private Sub chkCurveDir_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkCurveDir.CheckedChanged
EgtSetShowCurveDirection(chkCurveDir.Checked)
Scene1.Invalidate()
EgtSetShowCurveDirection(Scene1.GetCtx, chkCurveDir.Checked, True)
End Sub
Private Sub btnZoomAll_Click(sender As System.Object, e As System.EventArgs) Handles btnZoomAll.Click
EgtZoom(ZM_ALL)
Scene1.Invalidate()
EgtZoom(Scene1.GetCtx, ZM_ALL, True)
End Sub
Private Sub btnZoomIn_Click(sender As System.Object, e As System.EventArgs) Handles btnZoomIn.Click
EgtZoom(ZM_IN)
Scene1.Invalidate()
EgtZoom(Scene1.GetCtx, ZM_IN, True)
End Sub
Private Sub btnZoomOut_Click(sender As System.Object, e As System.EventArgs) Handles btnZoomOut.Click
EgtZoom(ZM_OUT)
Scene1.Invalidate()
EgtZoom(Scene1.GetCtx, ZM_OUT, True)
End Sub
Private Sub btnTop_Click(sender As System.Object, e As System.EventArgs) Handles btnTop.Click
EgtSetView(CT_TOP)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_TOP, True)
End Sub
Private Sub btnFront_Click(sender As System.Object, e As System.EventArgs) Handles btnFront.Click
EgtSetView(CT_FRONT)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_FRONT, True)
End Sub
Private Sub btnLeft_Click(sender As System.Object, e As System.EventArgs) Handles btnLeft.Click
EgtSetView(CT_LEFT)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_LEFT, True)
End Sub
Private Sub btnBack_Click(sender As System.Object, e As System.EventArgs) Handles btnBack.Click
EgtSetView(CT_BACK)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_BACK, True)
End Sub
Private Sub btnRight_Click(sender As System.Object, e As System.EventArgs) Handles btnRight.Click
EgtSetView(CT_RIGHT)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_RIGHT, True)
End Sub
Private Sub btnIso_Click(sender As System.Object, e As System.EventArgs) Handles btnIso.Click
EgtSetView(CT_ISO_SW)
Scene1.Invalidate()
EgtSetView(Scene1.GetCtx, CT_ISO_SW, True)
End Sub
Private Sub btnExport_Click(sender As System.Object, e As System.EventArgs) Handles btnExport.Click
Dim dA As Double
dA = Summ(12.5, 0.5)
MessageBox.Show(dA.ToString, "Summ", MessageBoxButtons.OK, MessageBoxIcon.Information)
'Private Sub btnExport_Click(sender As System.Object, e As System.EventArgs) Handles btnExport.Click
' Dim dA As Double
' dA = Summ(12.5, 0.5)
' MessageBox.Show(dA.ToString, "Summ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Dim bOk As Boolean
Dim sA As String
sA = "PiΣpΣpo"
Dim sB As String = ""
bOk = Append(sA, sB)
If bOk Then
MessageBox.Show(sB, "Append", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Error", "Append", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
' Dim bOk As Boolean
' Dim sA As String
' sA = "PiΣpΣpo"
' Dim sB As String = ""
' bOk = Append(sA, sB)
' If bOk Then
' MessageBox.Show(sB, "Append", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Else
' MessageBox.Show("Error", "Append", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End If
Dim dC As Double
dC = 22.5
bOk = Summ2(dC, 0.5)
If bOk Then
MessageBox.Show(dC.ToString, "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Error", "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
' Dim dC As Double
' dC = 22.5
' bOk = Summ2(dC, 0.5)
' If bOk Then
' MessageBox.Show(dC.ToString, "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Else
' MessageBox.Show("Error", "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Error)
' End If
Dim ptP As Point3d
ptP.x = 1
ptP.y = 2
ptP.z = 3
bOk = SetPoint(ptP)
MessageBox.Show(ptP.x.ToString, "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
' Dim ptP As Point3d
' ptP.x = 1
' ptP.y = 2
' ptP.z = 3
' bOk = SetPoint(ptP)
' MessageBox.Show(ptP.x.ToString, "Summ2", MessageBoxButtons.OK, MessageBoxIcon.Information)
'End Sub
Private Sub PictureBox1_HandleDestroyed(sender As System.Object, e As System.EventArgs)
End Sub
Private Sub PictureBox1_HandleCreated(sender As System.Object, e As System.EventArgs)
End Sub
Private Sub PictureBox1_Resize(sender As System.Object, e As System.EventArgs)
End Sub
Private Sub PictureBox1_MouseWheel(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
End Sub
Private Sub PictureBox1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
End Sub
Private Sub CursorPos(nType As System.Int32, dVal1 As System.Double, dVal2 As System.Double)
End Sub
End Class
+3 -3
View File
@@ -8,7 +8,7 @@ Imports System.Runtime.InteropServices
' Controllare i valori degli attributi dell'assembly
<Assembly: AssemblyTitle("TestEgtInterface")>
<Assembly: AssemblyTitle("TestEIn")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("EgalTech s.r.l.")>
<Assembly: AssemblyProduct("TestEIn")>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' utilizzando l'asterisco (*) come descritto di seguito:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.5.8.1")>
<Assembly: AssemblyFileVersion("1.5.8.1")>
<Assembly: AssemblyVersion("1.5.9.1")>
<Assembly: AssemblyFileVersion("1.5.9.1")>
+22 -19
View File
@@ -11,6 +11,7 @@ Public Class Scene
ROT = 2
ZOOMWIN = 3
End Enum
Private m_nGseContext As Integer
Private m_PrevPoint As Point
Sub New()
@@ -21,25 +22,32 @@ Public Class Scene
SetStyle(ControlStyles.UserPaint, True)
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
m_nStatus = ST.NULL
m_nGseContext = 0
m_PrevPoint = Point.Empty
Cursor = New Cursor(Me.GetType(), "Pointer.cur")
End Sub
Public Sub Init()
EgtSetLog(0, "TestEngine.log")
EgtInit(0, "TestEngine.log")
EgtSetFont("C:\EgtProg\Fonts", "ModernProp.Nfe")
EgtInit(Handle, 3, True, 24, 32)
EgtSetDefaultMaterial(255, 165, 0)
EgtSetBackground(140, 154, 168, 40, 44, 48)
m_nGseContext = EgtInitGeomDB()
EgtSetDefaultMaterial(m_nGseContext, 255, 165, 0)
EgtInitScene(m_nGseContext, Handle, 3, True, 24, 32)
EgtSetBackground(m_nGseContext, 140, 154, 168, 40, 44, 48)
EgtInitTscExec(m_nGseContext)
End Sub
Public Function GetCtx() As Integer
Return m_nGseContext
End Function
Protected Overrides Sub OnHandleDestroyed(e As EventArgs)
EgtExit()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
EgtDraw()
EgtDraw(m_nGseContext)
End Sub
Protected Overrides Sub OnPaintBackground(pevent As PaintEventArgs)
@@ -48,7 +56,7 @@ Public Class Scene
Protected Overrides Sub OnResize(e As System.EventArgs)
MyBase.OnResize(e)
EgtResize(Width, Height)
EgtResize(m_nGseContext, Width, Height)
End Sub
Protected Overrides Sub OnMouseEnter(e As System.EventArgs)
@@ -78,9 +86,8 @@ Public Class Scene
Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Middle Then
If m_nStatus = ST.ZOOMWIN Then
EgtResetWinRect()
EgtZoomWin(m_PrevPoint.X, m_PrevPoint.Y, e.Location.X, e.Location.Y)
Invalidate()
EgtResetWinRect(m_nGseContext, False)
EgtZoomWin(m_nGseContext, m_PrevPoint, e.Location, True)
End If
If m_nStatus <> ST.NULL Then
m_nStatus = ST.NULL
@@ -98,18 +105,15 @@ Public Class Scene
If e.Button = Windows.Forms.MouseButtons.Middle Then
If m_nStatus = ST.ZOOMWIN Then
Cursor = New Cursor(Me.GetType(), "ZoomWin.cur")
EgtSetWinRect(m_PrevPoint.X, m_PrevPoint.Y, e.Location.X, e.Location.Y)
Invalidate()
EgtSetWinRect(m_nGseContext, 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_PrevPoint.X, m_PrevPoint.Y, e.Location.X, e.Location.Y)
Invalidate()
EgtRotateCamera(m_nGseContext, m_PrevPoint, e.Location, True)
m_PrevPoint = e.Location
ElseIf m_nStatus = ST.PAN Then
Cursor = New Cursor(Me.GetType(), "Pan.cur")
EgtPanCamera(m_PrevPoint.X, m_PrevPoint.Y, e.Location.X, e.Location.Y)
Invalidate()
EgtPanCamera(m_nGseContext, m_PrevPoint, e.Location, True)
m_PrevPoint = e.Location
Else
m_nStatus = ST.NULL
@@ -131,17 +135,16 @@ Public Class Scene
dCoeff = 1 / dCoeff
End If
' eseguo zoom
EgtZoomOnPoint(e.X, e.Y, dCoeff)
Invalidate()
EgtZoomOnPoint(m_nGseContext, e.Location, dCoeff, True)
End Sub
Private Sub ShowCursorPos(ByVal WinXY As Point)
'ricavo punto 3d
Dim ptWorld As Point3d
EgtUnProject(WinXY.X, WinXY.Y, ptWorld)
EgtUnProjectPoint(m_nGseContext, WinXY, ptWorld)
'ricavo direzione di vista
Dim nDir As Integer
EgtGetCameraDir(nDir)
EgtGetCameraDir(m_nGseContext, nDir)
'costruisco stringa con dati
Dim sCursorPos As New System.Text.StringBuilder
Select Case nDir