diff --git a/AboutBox1.Designer.vb b/AboutBox1.Designer.vb index e73d47f..bc1ca65 100644 --- a/AboutBox1.Designer.vb +++ b/AboutBox1.Designer.vb @@ -46,7 +46,7 @@ Partial Class AboutBox1 'OKButton ' Me.OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.OKButton.Location = New System.Drawing.Point(105, 114) + Me.OKButton.Location = New System.Drawing.Point(88, 114) Me.OKButton.Name = "OKButton" Me.OKButton.Size = New System.Drawing.Size(75, 19) Me.OKButton.TabIndex = 0 @@ -105,7 +105,7 @@ Partial Class AboutBox1 Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.CancelButton = Me.OKButton - Me.ClientSize = New System.Drawing.Size(284, 148) + Me.ClientSize = New System.Drawing.Size(250, 148) Me.Controls.Add(Me.LogoPictureBox) Me.Controls.Add(Me.OKButton) Me.Controls.Add(Me.LabelCompanyName) diff --git a/AboutBox1.vb b/AboutBox1.vb index 59bc18f..5a16de3 100644 --- a/AboutBox1.vb +++ b/AboutBox1.vb @@ -1,25 +1,23 @@ Public NotInheritable Class AboutBox1 - Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - ' Imposta il titolo del form. - Dim ApplicationTitle As String - If My.Application.Info.Title <> "" Then - ApplicationTitle = My.Application.Info.Title - Else - ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) - End If - Me.Text = String.Format("Informazioni su {0}", ApplicationTitle) - ' Inizializza tutto il testo visualizzato nella finestra di dialogo Informazioni su. - ' TODO: Personalizzare le informazioni sull'assembly dell'applicazione nel riquadro "Applicazione" - ' della finestra delle proprietà del progetto (accessibile dal menu "Progetto"). - Me.LabelProductName.Text = My.Application.Info.ProductName - Me.LabelVersion.Text = String.Format("Versione {0}", My.Application.Info.Version.ToString) - Me.LabelCopyright.Text = My.Application.Info.Copyright - Me.LabelCompanyName.Text = My.Application.Info.CompanyName - End Sub + Private Sub AboutBox1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + ' Imposta il titolo del form. + Dim ApplicationTitle As String + If My.Application.Info.Title <> "" Then + ApplicationTitle = My.Application.Info.Title + Else + ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) + End If + Me.Text = String.Format("Informazioni su {0}", My.Application.Info.ProductName) + ' Inizializza tutto il testo visualizzato nella finestra di dialogo Informazioni su. + Me.LabelProductName.Text = ApplicationTitle + Me.LabelVersion.Text = String.Format("Versione {0}", My.Application.Info.Version.ToString) + Me.LabelCopyright.Text = My.Application.Info.Copyright + Me.LabelCompanyName.Text = My.Application.Info.CompanyName + End Sub - Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click - Me.Close() - End Sub + Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click + Me.Close() + End Sub End Class diff --git a/EgtInterface.vb b/EgtInterface.vb index a3ec5a1..5d9ad62 100644 --- a/EgtInterface.vb +++ b/EgtInterface.vb @@ -8,109 +8,117 @@ End Structure #If PLATFORM = "x64" Then #If DEBUG Then -Const EgtInterface As String = "EgtInterfaceD64.dll" +Const EgtIntDll As String = "EgtInterfaceD64.dll" #Else -Const EgtInterface As String = "EgtInterfaceR64.dll" +Const EgtIntDll As String = "EgtInterfaceR64.dll" #End If #Else #If DEBUG Then -Const EgtInterface As String = "EgtInterfaceD32.dll" +Const EgtIntDll As String = "EgtInterfaceD32.dll" #Else -Const EgtInterface As String = "EgtInterfaceR32.dll" +Const EgtIntDll As String = "EgtInterfaceR32.dll" #End If #End If 'API 'General - + Public Shared Function EgtInit(ByVal nDebug As Integer, ByVal sLogFile As String) As Boolean End Function - + Public Shared Function EgtExit() As Boolean End Function - + Public Shared Function EgtSetKey(ByVal sKey As String) As Boolean End Function - + Public Shared Function EgtSetFont(ByVal sNfeFontDir As String, ByVal sDefaultFont As String) As Boolean End Function - + Public Shared Function EgtFreeMemory(ByVal sB As IntPtr) As Boolean End Function 'GeomDB - + 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 End Function - + Public Shared Function EgtNewFile(ByVal nCtx As Integer) As Boolean End Function - + Public Shared Function EgtOpenFile(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean End Function - + Public Shared Function EgtSaveFile(ByVal nCtx As Integer, ByVal sFilePath As String, ByVal nFlag As Integer) As Boolean End Function - + 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 End Function - + Public Shared Function EgtImportStl(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean End Function - + +Public Shared Function EgtImportCnc(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtExportStl(ByVal nCtx As Integer, ByVal nId As Integer, ByVal sFilePath As String) As Boolean End Function 'GeomDB Objects - + Public Shared Function EgtExistsObj(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Boolean End Function - + +Public Shared Function EgtGetGroupObjs(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer +End Function + + Public Shared Function EgtGetFirstInGroup(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer End Function - + Public Shared Function EgtGetNext(ByVal nCtx As Integer, ByVal nId As Integer) As Integer End Function - + Public Shared Function EgtGetLastInGroup(ByVal nCtx As Integer, ByVal nGroupId As Integer) As Integer End Function - + Public Shared Function EgtGetPrev(ByVal nCtx As Integer, ByVal nId As Integer) As Integer End Function - + Public Shared Function EgtGetType(ByVal nCtx As Integer, 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 End Function Public Shared Function EgtGetTitle(ByVal nCtx As Integer, ByVal nId As Integer, ByRef sTitle As String) As Boolean @@ -121,7 +129,7 @@ Public Shared Function EgtGetTitle(ByVal nCtx As Integer, ByVal nId As Integer, Return bOk End Function - + Private Shared Function EgtGroupDump(ByVal nCtx As Integer, 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 @@ -132,7 +140,7 @@ Public Shared Function EgtGroupDump(ByVal nCtx As Integer, ByVal nId As Integer, Return bOk End Function - + Private Shared Function EgtGeoObjDump(ByVal nCtx As Integer, 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 @@ -145,75 +153,75 @@ End Function 'GeomDB Obj attributes - + Public Shared Function EgtSetLevel(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtGetLevel(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtSetMode(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtGetMode(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtSetStatus(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtGetStatus(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtSetMark(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean End Function - + Public Shared Function EgtResetMark(ByVal nCtx As Integer, 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 End Function - + Public Shared Function EgtGetCalcMark(ByVal nCtx As Integer, 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 End Function - + Private Shared Function EgtGetName(ByVal nCtx As Integer, 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 @@ -224,19 +232,19 @@ Public Shared Function EgtGetName(ByVal nCtx As Integer, ByVal nId As Integer, B Return bOk End Function - + Public Shared Function EgtExistsName(ByVal nCtx As Integer, ByVal nId As Integer) As Boolean End Function - + Public Shared Function EgtRemoveName(ByVal nCtx As Integer, 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 End Function - + Private Shared Function EgtGetInfo(ByVal nCtx As Integer, 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 @@ -247,95 +255,95 @@ Public Shared Function EgtGetInfo(ByVal nCtx As Integer, ByVal nId As Integer, B Return bOk End Function - + Public Shared Function EgtExistsInfo(ByVal nCtx As Integer, 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 End Function 'Scene - + 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 - + 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, Optional ByVal bRedraw As Boolean = True) As Boolean End Function - + Public Shared Function EgtDraw(ByVal nCtx As Integer) As Boolean End Function - + Public Shared Function EgtResize(ByVal nCtx As Integer, ByVal nW As Integer, ByVal nH As Integer) As Boolean End Function - + Public Shared Function EgtSetShowMode(ByVal nCtx As Integer, ByVal nShowMode As Integer, Optional ByVal bRedraw As Boolean = True) As Boolean End Function - + Public Shared Function EgtSetShowCurveDirection(ByVal nCtx As Integer, ByVal bShow As Boolean, Optional ByVal bRedraw As Boolean = True) As Boolean End Function - + Public Shared Function EgtZoom(ByVal nCtx As Integer, 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 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) 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 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) End Function - + Public Shared Function EgtResetWinRect(ByVal nCtx As Integer, 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 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) End Function - + Public Shared Function EgtSetView(ByVal nCtx As Integer, 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 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) 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 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) End Function - + Public Shared Function EgtGetCameraDir(ByVal nCtx As Integer, 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 End Function Public Shared Function EgtUnProjectPoint(ByVal nCtx As Integer, ByVal Curr As Point, ByRef ptP As Point3d) As Boolean @@ -344,15 +352,15 @@ End Function 'TscExecutor - + Public Shared Function EgtInitTscExec(ByVal nCtx As Integer) As Boolean End Function - + Public Shared Function EgtTscFileExec(ByVal nCtx As Integer, ByVal sFilePath As String) As Boolean End Function - + Public Shared Function EgtTscLineExec(ByVal nCtx As Integer, ByVal sLine As String) As Boolean End Function @@ -363,6 +371,7 @@ 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 'Costanti : FORMATO FILE NGE Public Const NGE_TEXT As Integer = 0 Public Const NGE_BIN As Integer = 1 diff --git a/Form1.Designer.vb b/Form1.Designer.vb index 8a52de0..697a006 100644 --- a/Form1.Designer.vb +++ b/Form1.Designer.vb @@ -52,12 +52,12 @@ Partial Class Form1 Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel() Me.ToolStripStatusLabel3 = New System.Windows.Forms.ToolStripStatusLabel() Me.Panel2 = New System.Windows.Forms.Panel() + Me.TableLayoutPanel2 = New System.Windows.Forms.TableLayoutPanel() Me.tBoxInfo = New System.Windows.Forms.TextBox() Me.TreeView1 = New System.Windows.Forms.TreeView() Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) Me.OpenFileDialog = New System.Windows.Forms.OpenFileDialog() Me.SaveFileDialog = New System.Windows.Forms.SaveFileDialog() - Me.TableLayoutPanel2 = New System.Windows.Forms.TableLayoutPanel() Me.Scene1 = New TestEIn.Scene() Me.TableLayoutPanel1.SuspendLayout() Me.Panel1.SuspendLayout() @@ -84,7 +84,7 @@ Partial Class Form1 Me.TableLayoutPanel1.RowCount = 2 Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle()) - Me.TableLayoutPanel1.Size = New System.Drawing.Size(685, 386) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(685, 441) Me.TableLayoutPanel1.TabIndex = 0 ' 'Panel1 @@ -110,14 +110,14 @@ Partial Class Form1 Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill Me.Panel1.Location = New System.Drawing.Point(487, 3) Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(195, 358) + Me.Panel1.Size = New System.Drawing.Size(195, 413) Me.Panel1.TabIndex = 5 ' 'tboxCmd ' Me.tboxCmd.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.tboxCmd.Location = New System.Drawing.Point(0, 302) + Me.tboxCmd.Location = New System.Drawing.Point(0, 357) Me.tboxCmd.Multiline = True Me.tboxCmd.Name = "tboxCmd" Me.tboxCmd.ScrollBars = System.Windows.Forms.ScrollBars.Vertical @@ -325,7 +325,7 @@ Partial Class Form1 Me.TableLayoutPanel1.SetColumnSpan(Me.StatusStrip1, 3) Me.StatusStrip1.Dock = System.Windows.Forms.DockStyle.Fill Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel2, Me.ToolStripStatusLabel1, Me.ToolStripStatusLabel3}) - Me.StatusStrip1.Location = New System.Drawing.Point(0, 364) + Me.StatusStrip1.Location = New System.Drawing.Point(0, 419) Me.StatusStrip1.MaximumSize = New System.Drawing.Size(0, 22) Me.StatusStrip1.MinimumSize = New System.Drawing.Size(0, 22) Me.StatusStrip1.Name = "StatusStrip1" @@ -370,17 +370,32 @@ Partial Class Form1 Me.Panel2.Dock = System.Windows.Forms.DockStyle.Fill Me.Panel2.Location = New System.Drawing.Point(3, 3) Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(200, 358) + Me.Panel2.Size = New System.Drawing.Size(200, 413) Me.Panel2.TabIndex = 7 ' + 'TableLayoutPanel2 + ' + Me.TableLayoutPanel2.ColumnCount = 1 + Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.TableLayoutPanel2.Controls.Add(Me.tBoxInfo, 0, 1) + Me.TableLayoutPanel2.Controls.Add(Me.TreeView1, 0, 0) + Me.TableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill + Me.TableLayoutPanel2.Location = New System.Drawing.Point(0, 0) + Me.TableLayoutPanel2.Name = "TableLayoutPanel2" + Me.TableLayoutPanel2.RowCount = 2 + Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60.0!)) + Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40.0!)) + Me.TableLayoutPanel2.Size = New System.Drawing.Size(200, 413) + Me.TableLayoutPanel2.TabIndex = 0 + ' 'tBoxInfo ' Me.tBoxInfo.Dock = System.Windows.Forms.DockStyle.Fill - Me.tBoxInfo.Location = New System.Drawing.Point(3, 217) + Me.tBoxInfo.Location = New System.Drawing.Point(3, 250) Me.tBoxInfo.Multiline = True Me.tBoxInfo.Name = "tBoxInfo" Me.tBoxInfo.ScrollBars = System.Windows.Forms.ScrollBars.Vertical - Me.tBoxInfo.Size = New System.Drawing.Size(194, 138) + Me.tBoxInfo.Size = New System.Drawing.Size(194, 160) Me.tBoxInfo.TabIndex = 24 ' 'TreeView1 @@ -393,7 +408,7 @@ Partial Class Form1 Me.TreeView1.Location = New System.Drawing.Point(3, 3) Me.TreeView1.Name = "TreeView1" Me.TreeView1.SelectedImageIndex = 0 - Me.TreeView1.Size = New System.Drawing.Size(194, 208) + Me.TreeView1.Size = New System.Drawing.Size(194, 241) Me.TreeView1.TabIndex = 0 ' 'ImageList1 @@ -422,41 +437,30 @@ Partial Class Form1 ' Me.SaveFileDialog.Title = "Save" ' - 'TableLayoutPanel2 - ' - Me.TableLayoutPanel2.ColumnCount = 1 - Me.TableLayoutPanel2.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - Me.TableLayoutPanel2.Controls.Add(Me.tBoxInfo, 0, 1) - Me.TableLayoutPanel2.Controls.Add(Me.TreeView1, 0, 0) - Me.TableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill - Me.TableLayoutPanel2.Location = New System.Drawing.Point(0, 0) - Me.TableLayoutPanel2.Name = "TableLayoutPanel2" - Me.TableLayoutPanel2.RowCount = 2 - Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60.0!)) - Me.TableLayoutPanel2.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40.0!)) - Me.TableLayoutPanel2.Size = New System.Drawing.Size(200, 358) - Me.TableLayoutPanel2.TabIndex = 0 - ' 'Scene1 ' + Me.Scene1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.Scene1.Dock = System.Windows.Forms.DockStyle.Fill Me.Scene1.Location = New System.Drawing.Point(209, 3) Me.Scene1.Name = "Scene1" - Me.Scene1.Size = New System.Drawing.Size(272, 358) + Me.Scene1.Size = New System.Drawing.Size(272, 413) Me.Scene1.TabIndex = 1 ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.AutoSize = True Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None - Me.ClientSize = New System.Drawing.Size(685, 386) + Me.ClientSize = New System.Drawing.Size(685, 441) Me.Controls.Add(Me.TableLayoutPanel1) Me.ForeColor = System.Drawing.SystemColors.ControlText Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Margin = New System.Windows.Forms.Padding(2) + Me.MinimumSize = New System.Drawing.Size(640, 480) Me.Name = "Form1" Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual Me.Text = "Egaltech Interface Prova 1" Me.TableLayoutPanel1.ResumeLayout(False) Me.TableLayoutPanel1.PerformLayout() diff --git a/Form1.resx b/Form1.resx index b0a55bb..5eb16fc 100644 --- a/Form1.resx +++ b/Form1.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADS - DAAAAk1TRnQBSQFMAgEBDAEAAZgBAAGYAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + DAAAAk1TRnQBSQFMAgEBDAEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Form1.vb b/Form1.vb index ab55f05..27f09d2 100644 --- a/Form1.vb +++ b/Form1.vb @@ -1,41 +1,45 @@ Imports System.Runtime.InteropServices Imports System.Text Imports System.Math +Imports System.IO Imports TestEIn.EgtInterface Imports TestEIn.GenInterface Public Class Form1 - '-------------------------------- AboutBox ------------------------------------------------------- - -Private Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr -End Function - -Private Shared Function AppendMenu(ByVal hMenu As IntPtr, ByVal uFlags As Integer, - ByVal uIDNewItem As Integer, ByVal lpNewItem As String) As Boolean -End Function -Private Const MF_STRING As UInt32 = &H0 -Private Const MF_SEPARATOR As UInt32 = &H800 -Private Const WM_SYSCOMMAND As UInt32 = &H112 -Private Const IDM_ABOUTBOX As UInt32 = &H10 + Private m_sIniFile As String = String.Empty + Private m_sCurrFile As String = String.Empty + Private m_nMarkObj As Integer = GDB_ID_NULL '-------------------------------- Form ------------------------------------------------------------ Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load - Text = "EgalTech TestEIn" - Dim sIniFile As String = "C:\EgtProg\TestEIn\TestEIn.ini" + 'Title + Me.Text = "EgalTech TestEIn" + 'Impostazione path Ini file + m_sIniFile = Application.StartupPath & "\TestEIn.ini" 'Inizializzazione generale di EgtInterface - EgtInit(0, "TestEngine.log") + EgtInit(0, Application.StartupPath & "\TestEngine.log") 'imposto chiave di protezione - Dim sbKey As New StringBuilder(128) - GetPrivateProfileString("General", "Key", "", sbKey, sbKey.Capacity, sIniFile) - EgtSetKey(sbKey.ToString) + Dim sKey As String = String.Empty + GetPrivateProfileString("General", "Key", "", sKey, m_sIniFile) + EgtSetKey(sKey) 'imposto dir font Nfe e font default - Dim sbNfeDir As New StringBuilder(128) - GetPrivateProfileString("GeomDB", "NfeFontDir", "", sbNfeDir, sbNfeDir.Capacity, sIniFile) - Dim sbDefFont As New StringBuilder(128) - GetPrivateProfileString("GeomDB", "DefaultFont", "", sbDefFont, sbDefFont.Capacity, sIniFile) - EgtSetFont(sbNfeDir.ToString, sbDefFont.ToString) + Dim sNfeDir As String = String.Empty + GetPrivateProfileString("GeomDB", "NfeFontDir", "", sNfeDir, m_sIniFile) + Dim sDefFont As String = String.Empty + GetPrivateProfileString("GeomDB", "DefaultFont", "", sDefFont, m_sIniFile) + EgtSetFont(sNfeDir, sDefFont) + ' imposto colori sfondo + Dim nTopRed As Integer = 192 + Dim nTopGreen As Integer = 192 + Dim nTopBlue As Integer = 192 + GetPrivateProfileColor("Scene", "BackTop", nTopRed, nTopGreen, nTopBlue, m_sIniFile) + Dim nBotRed As Integer = 192 + Dim nBotGreen As Integer = 192 + Dim nBotBlue As Integer = 192 + GetPrivateProfileColor("Scene", "BackBottom", nBotRed, nBotGreen, nBotBlue, m_sIniFile) + Scene1.SetViewBackground(nTopRed, nTopGreen, nTopBlue, nBotRed, nBotGreen, nBotBlue) ' inizializzo scena Scene1.Init() rbtShading.Checked = True @@ -46,9 +50,25 @@ Private Const IDM_ABOUTBOX As UInt32 = &H10 AppendMenu(hSysMenu, MF_SEPARATOR, 0, "") AppendMenu(hSysMenu, MF_STRING, IDM_ABOUTBOX, "About TestEIn...") End If + 'Posizione e dimensioni del Form + If ModifierKeys <> Keys.Shift Then + Dim nFlag As Integer + Dim nLeft As Integer + Dim nTop As Integer + Dim nWidth As Integer + Dim nHeight As Integer + GetPrivateProfileWinPos("General", "WinPlace", nFlag, nLeft, nTop, nWidth, nHeight, m_sIniFile) + Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual + Me.Location = New Point(nLeft, nTop) + Me.Size = New Size(nWidth, nHeight) + WindowState = IIf(nFlag = 1, FormWindowState.Maximized, FormWindowState.Normal) + End If End Sub Private Sub Form1_FormClosing(sender As System.Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + 'Salvo posizione Form + Dim nFlag As Integer = IIf(Me.WindowState = FormWindowState.Maximized, 1, 0) + WritePrivateProfileWinPos("General", "WinPlace", nFlag, Me.Left, Me.Top, Me.Width, Me.Height, m_sIniFile) 'Terminazione generale di EgtInterface EgtExit() End Sub @@ -57,118 +77,95 @@ Private Const IDM_ABOUTBOX As UInt32 = &H10 MyBase.WndProc(m) If m.Msg = WM_SYSCOMMAND Then If m.WParam.ToInt32 = IDM_ABOUTBOX Then - AboutBox1.Show() + AboutBox1.ShowDialog() End If End If End Sub - Private Sub CursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles Scene1.CursorPos + '-------------------------------- Events management ---------------------------------------------- + Private Sub OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) Handles Scene1.OnCursorPos ToolStripStatusLabel1.Text = sCursorPos End Sub + Private Sub OnNewProject(ByVal sender As Object) Handles Scene1.OnNewProject + m_sCurrFile = String.Empty + Me.Text = "EgalTech TestEIn" + ClearObjTree() + End Sub + + Private Sub OnOpeningProject(ByVal sender As Object) Handles Scene1.OnOpeningProject + ClearObjTree() + End Sub + + Private Sub OnOpenProject(ByVal sender As Object, ByVal sFile As String) Handles Scene1.OnOpenProject + m_sCurrFile = sFile + Me.Text = Path.GetFileName(m_sCurrFile) & " - EgalTech TestEIn" + LoadObjTree() + End Sub + + Private Sub OnSavingProject(ByVal sender As Object, ByVal sFile As String) Handles Scene1.OnSavingProject + m_sCurrFile = sFile + Me.Text = Path.GetFileName(m_sCurrFile) & " - EgalTech TestEIn" + ' ripristino stato eventuale oggetto marcato + m_nMarkObj = RevertOldIdInObjTree() + End Sub + + Private Sub OnSavedProject(ByVal sender As Object) Handles Scene1.OnSavedProject + ' rimarco eventuale oggetto smarcato + SelectIdInObjTree(m_nMarkObj) + End Sub + + Private Sub OnImportingProject(ByVal sender As Object) Handles Scene1.OnImportingProject + ClearObjTree() + End Sub + + Private Sub OnImportedProject(ByVal sender As Object, ByVal sFile As String) Handles Scene1.OnImportedProject + m_sCurrFile = Path.ChangeExtension(sFile, "nge") + Me.Text = Path.GetFileName(m_sCurrFile) & " - EgalTech TestEIn" + LoadObjTree() + End Sub + + Private Sub OnExportingProject(ByVal sender As Object, ByVal sFile As String) Handles Scene1.OnExportingProject + ' ripristino stato eventuale oggetto marcato + m_nMarkObj = RevertOldIdInObjTree() + End Sub + + Private Sub OnExportedProject(ByVal sender As Object) Handles Scene1.OnExportedProject + ' rimarco eventuale oggetto smarcato + SelectIdInObjTree(m_nMarkObj) + End Sub + + Private Sub OnExecutingScript(ByVal sender As Object, ByVal sFile As String) Handles Scene1.OnExecutingScript + ClearObjTree() + End Sub + + Private Sub OnExecutedScript(ByVal sender As Object) Handles Scene1.OnExecutedScript + LoadObjTree() + End Sub + '-------------------------------- Buttons -------------------------------------------------------- - Private Sub btnNew_Click(sender As System.Object, e As System.EventArgs) Handles btnNew.Click - If EgtNewFile(Scene1.GetCtx) Then - ClearObjTree() - EgtZoom(Scene1.GetCtx, ZM_ALL) - End If + Private Sub btnNew_Click(sender As System.Object, e As System.EventArgs) Handles btnNew.Click + Scene1.NewProject() 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(Scene1.GetCtx, OpenFileDialog.FileName) Then - EgtZoom(Scene1.GetCtx, ZM_ALL) - LoadObjTree() - End If - Cursor = Cursors.Default - End If + Scene1.OpenProject() 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 - ' ripristino stato oggetto marcato - Dim nIdOld As Integer = RevertOldIdInObjTree() - ' eseguo salvataggio - EgtSaveFile(Scene1.GetCtx, SaveFileDialog.FileName, NGE_CMPTEXT) - ' rimarco oggetto - SelectIdInObjTree(nIdOld) - Cursor = Cursors.Default - End If + Scene1.SaveProject(m_sCurrFile) End Sub Private Sub btnImport_Click(sender As System.Object, e As System.EventArgs) Handles btnImport.Click - 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(Scene1.GetCtx) - If EgtImportDxf(Scene1.GetCtx, OpenFileDialog.FileName) Then - EgtZoom(Scene1.GetCtx, ZM_ALL) - LoadObjTree() - End If - Cursor = Cursors.Default - ElseIf nFileType = FT_STL Then - Cursor = Cursors.WaitCursor - EgtNewFile(Scene1.GetCtx) - If EgtImportStl(Scene1.GetCtx, OpenFileDialog.FileName) Then - EgtZoom(Scene1.GetCtx, ZM_ALL) - LoadObjTree() - End If - Cursor = Cursors.Default - Else - MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) - End If - End If + Scene1.ImportProject() 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 + Scene1.ExportProject(Path.ChangeExtension(m_sCurrFile, "dxf")) End Sub Private Sub btnExec_Click(sender As System.Object, e As System.EventArgs) Handles btnExec.Click - OpenFileDialog.Title = "Exec TSC" - OpenFileDialog.Filter = "Test commands(*.tsc)|*.tsc" - OpenFileDialog.FilterIndex = 1 - If OpenFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then - Cursor = Cursors.WaitCursor - ' pulisco albero degli oggetti - ClearObjTree() - ' eseguo - If EgtTscFileExec(Scene1.GetCtx, OpenFileDialog.FileName) Then - EgtZoom(Scene1.GetCtx, ZM_ALL) - LoadObjTree() - End If - ' ricarico albero degli oggetti - LoadObjTree() - Cursor = Cursors.Default - End If + Scene1.Exec() End Sub Private Sub rbtWireFrame_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rbtWireFrame.CheckedChanged @@ -278,6 +275,12 @@ Private Const IDM_ABOUTBOX As UInt32 = &H10 CurrNodColl = PrevNodColl.Add(nGroupId.ToString, sText, nImage, nImage).Nodes End If + Dim nObjs As Integer = EgtGetGroupObjs(Scene1.GetCtx(), nGroupId) + If (nObjs > 20000) Then + CurrNodColl.Add("-1", "Too many entities") + Return + End If + Dim nId As Integer = EgtGetFirstInGroup(Scene1.GetCtx, nGroupId) While nId <> GDB_ID_NULL 'recupero il tipo di nodo diff --git a/GenInterface.vb b/GenInterface.vb index 772d738..91e534c 100644 --- a/GenInterface.vb +++ b/GenInterface.vb @@ -3,18 +3,104 @@ Imports System.Text Public Class GenInterface -' Read/Write IniFile +'-------------------------------- IniFile -------------------------------------------------------- +Private Shared Function GetPrivateProfileString( + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByVal lpDefault As String, + ByVal lpReturnedString As StringBuilder, + ByVal nSize As Integer, + ByVal lpFileName As String) As Integer +End Function Public Shared Function GetPrivateProfileString( - ByVal lpAppName As String, - ByVal lpKeyName As String, - ByVal lpDefault As String, - ByVal lpReturnedString As StringBuilder, - ByVal nSize As Integer, - ByVal lpFileName As String) As Integer + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByVal lpDefault As String, + ByRef lpString As String, + ByVal lpFileName As String) As Integer + Dim sb As New StringBuilder(512) + Dim nRet As Integer = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, sb, sb.Capacity, lpFileName) + lpString = sb.ToString + Return nRet +End Function + +Public Shared Function GetPrivateProfileColor( + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByRef nRed As Integer, + ByRef nGreen As Integer, + ByRef nBlue As Integer, + ByVal lpFileName As String) As Boolean + Dim sVal As String = String.Empty + GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName) + Dim sItems() As String = sVal.Split(",".ToCharArray) + If sItems.Count() >= 3 Then + nRed = Int(sItems(0)) + nGreen = Int(sItems(1)) + nBlue = Int(sItems(2)) + Return True + End If + Return False +End Function + +Public Shared Function GetPrivateProfileWinPos( + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByRef nFlag As Integer, + ByRef nLeft As Integer, + ByRef nTop As Integer, + ByRef nWidth As Integer, + ByRef nHeight As Integer, + ByVal lpFileName As String) As Boolean + Dim sVal As String = String.Empty + GetPrivateProfileString(lpAppName, lpKeyName, "", sVal, lpFileName) + Dim sItems() As String = sVal.Split(",".ToCharArray) + If sItems.Count() >= 5 Then + nFlag = Int(sItems(0)) + nLeft = Int(sItems(1)) + nTop = Int(sItems(2)) + nWidth = Int(sItems(3)) + nHeight = Int(sItems(4)) + Return True + End If + Return False +End Function + + +Public Shared Function WritePrivateProfileString( + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByVal lpString As String, + ByVal lpFileName As String) As Boolean +End Function + +Public Shared Function WritePrivateProfileWinPos( + ByVal lpAppName As String, + ByVal lpKeyName As String, + ByVal nFlag As Integer, + ByVal nLeft As Integer, + ByVal nTop As Integer, + ByVal nWidth As Integer, + ByVal nHeight As Integer, + ByVal lpFileName As String) As Boolean + Dim sVal As String + sVal = nFlag.ToString & "," & nLeft.ToString & "," & nTop.ToString & "," & nWidth.ToString & "," & nHeight.ToString + Return WritePrivateProfileString(lpAppName, lpKeyName, sVal, lpFileName) End Function - +'-------------------------------- System Menu ---------------------------------------------------- + +Public Shared Function GetSystemMenu(ByVal hWnd As IntPtr, ByVal bRevert As Boolean) As IntPtr +End Function + +Public Shared Function AppendMenu(ByVal hMenu As IntPtr, ByVal uFlags As Integer, + ByVal uIDNewItem As Integer, ByVal lpNewItem As String) As Boolean +End Function +Public Const MF_STRING As UInt32 = &H0 +Public Const MF_SEPARATOR As UInt32 = &H800 +Public Const WM_SYSCOMMAND As UInt32 = &H112 +Public Const IDM_ABOUTBOX As UInt32 = &H10 End Class diff --git a/Scene.Designer.vb b/Scene.Designer.vb index 4bb8d03..0a0c770 100644 --- a/Scene.Designer.vb +++ b/Scene.Designer.vb @@ -2,7 +2,7 @@ Partial Class Scene Inherits System.Windows.Forms.UserControl - 'Control esegue l'override del metodo Dispose per pulire l'elenco dei componenti. + 'UserControl esegue l'override del metodo Dispose per pulire l'elenco dei componenti. _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try @@ -14,16 +14,16 @@ Partial Class Scene End Try End Sub - 'Richiesto da Progettazione controlli + 'Richiesto da Progettazione Windows Form Private components As System.ComponentModel.IContainer - ' NOTA: la procedura che segue è richiesta da Progettazione componenti - ' Può essere modificata in Progettazione componenti. Non modificarla - ' nell'editor del codice. + 'NOTA: la procedura che segue è richiesta da Progettazione Windows Form + 'Può essere modificata in Progettazione Windows Form. + 'Non modificarla nell'editor del codice. _ Private Sub InitializeComponent() components = New System.ComponentModel.Container() + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font End Sub End Class - diff --git a/Scene.vb b/Scene.vb index c7c16e4..46a3007 100644 --- a/Scene.vb +++ b/Scene.vb @@ -1,10 +1,11 @@ Imports System.Math -Imports System.Text Imports System.Globalization Imports TestEIn.EgtInterface Public Class Scene + '---- Members --------- + Private m_nGseContext As Integer Private m_nStatus As Integer Private Enum ST As Integer NULL = 0 @@ -12,27 +13,82 @@ Public Class Scene ROT = 2 ZOOMWIN = 3 End Enum - Private m_nGseContext As Integer Private m_PrevPoint As Point + Private m_nDefMatRed As Integer + Private m_nDefMatGreen As Integer + Private m_nDefMatBlue As Integer + Private m_nDriver As Integer + Private m_b2Buff As Boolean + Private m_nColorBits As Integer + Private m_nDepthBits As Integer + Private m_nBackTopRed As Integer + Private m_nBackTopGreen As Integer + Private m_nBackTopBlue As Integer + Private m_nBackBotRed As Integer + Private m_nBackBotGreen As Integer + Private m_nBackBotBlue As Integer + '---- Constructor ----- Sub New() ' Chiamata richiesta dalla finestra di progettazione. InitializeComponent() ' Istruzioni di inizializzazione. + Me.BorderStyle = Windows.Forms.BorderStyle.FixedSingle SetStyle(ControlStyles.Opaque, True) SetStyle(ControlStyles.UserPaint, True) SetStyle(ControlStyles.AllPaintingInWmPaint, True) - m_nStatus = ST.NULL m_nGseContext = 0 + m_nStatus = ST.NULL m_PrevPoint = Point.Empty + m_nDefMatRed = 255 + m_nDefMatGreen = 165 + m_nDefMatBlue = 0 + m_nDriver = 3 + m_b2Buff = True + m_nColorBits = 24 + m_nDepthBits = 32 + m_nBackTopRed = 140 + m_nBackTopGreen = 154 + m_nBackTopBlue = 168 + m_nBackBotRed = 40 + m_nBackBotGreen = 44 + m_nBackBotBlue = 48 Cursor = New Cursor(Me.GetType(), "Pointer.cur") End Sub + '---- Initials -------- + Public Sub SetDefaultMaterial(ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) + m_nDefMatRed = nRed + m_nDefMatGreen = nGreen + m_nDefMatBlue = nBlue + End Sub + + Public Sub SetViewAttributes(ByVal nDriver As Integer, ByVal b2Buff As Boolean, ByVal nColorBits As Integer, ByVal nDepthBits As Integer) + m_nDriver = nDriver + m_b2Buff = b2Buff + m_nColorBits = nColorBits + m_nDepthBits = nDepthBits + End Sub + + Public Sub SetViewBackground(ByVal nTopRed As Integer, ByVal nTopGreen As Integer, ByVal nTopBlue As Integer, + ByVal nBottomRed As Integer, ByVal nBottomGreen As Integer, ByVal nBottomBlue As Integer) + m_nBackTopRed = nTopRed + m_nBackTopGreen = nTopGreen + m_nBackTopBlue = nTopBlue + m_nBackBotRed = nBottomRed + m_nBackBotGreen = nBottomGreen + m_nBackBotBlue = nBottomBlue + End Sub + + 'Mettere EgtInit, EgtSetKey e EgtSetFont nell'evento Load del Form, prima di inizializzare la o le Scene + 'Mettere EgtExit nell'evento FormClosing + Public Sub Init() 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, False) + 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, + m_nBackBotRed, m_nBackBotGreen, m_nBackBotBlue) EgtInitTscExec(m_nGseContext) End Sub @@ -40,6 +96,11 @@ Public Class Scene Return m_nGseContext End Function + Protected Overrides Sub OnHandleDestroyed(e As EventArgs) + 'EgtExit va spostata nell'evento FormClosing del Form + 'EgtExit() + End Sub + Protected Overrides Sub OnPaint(e As PaintEventArgs) MyBase.OnPaint(e) EgtDraw(m_nGseContext) @@ -54,6 +115,21 @@ Public Class Scene EgtResize(m_nGseContext, Width, Height) End Sub + '---- Events ---------- + Public Event OnCursorPos(ByVal sender As Object, ByVal sCursorPos As String) + Public Event OnNewProject(ByVal sender As Object) + Public Event OnOpeningProject(ByVal sender As Object) + Public Event OnOpenProject(ByVal sender As Object, ByVal sFile As String) + Public Event OnSavingProject(ByVal sender As Object, ByVal sFile As String) + Public Event OnSavedProject(ByVal sender As Object) + Public Event OnImportingProject(ByVal sender As Object) + Public Event OnImportedProject(ByVal sender As Object, ByVal sFile As String) + Public Event OnExportingProject(ByVal sender As Object, ByVal sFile As String) + Public Event OnExportedProject(ByVal sender As Object) + Public Event OnExecutingScript(ByVal sender As Object, ByVal sFile As String) + Public Event OnExecutedScript(ByVal sender As Object) + + '---- Mouse ----------- Protected Overrides Sub OnMouseEnter(e As System.EventArgs) MyBase.OnMouseEnter(e) Focus() @@ -82,7 +158,7 @@ Public Class Scene 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) + EgtZoomWin(m_nGseContext, m_PrevPoint, e.Location, True) End If If m_nStatus <> ST.NULL Then m_nStatus = ST.NULL @@ -100,15 +176,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_nGseContext, m_PrevPoint, e.Location) - 'Il punto di riferimento deve rimanere quello originale + 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_nGseContext, m_PrevPoint, e.Location) + 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_nGseContext, m_PrevPoint, e.Location) + EgtPanCamera(m_nGseContext, m_PrevPoint, e.Location, True) m_PrevPoint = e.Location Else m_nStatus = ST.NULL @@ -123,14 +199,14 @@ Public Class Scene If Abs(e.Delta) < 30 Then Return End If - ' calcolo coefficiente + ' calcolo coefficiente Const WHEEL_DELTA As Double = 120 Dim dCoeff As Double = 1 - 0.1 * Abs(e.Delta) / WHEEL_DELTA If e.Delta < 0 Then dCoeff = 1 / dCoeff End If - ' eseguo zoom - EgtZoomOnPoint(m_nGseContext, e.Location, dCoeff) + ' eseguo zoom + EgtZoomOnPoint(m_nGseContext, e.Location, dCoeff, True) End Sub Private Sub ShowCursorPos(ByVal WinXY As Point) @@ -162,9 +238,225 @@ Public Class Scene sCursorPos.Append(" ") End Select ' lancio l'evento per visualizzare la stringa - RaiseEvent CursorPos(Me, sCursorPos.ToString) + RaiseEvent OnCursorPos(Me, sCursorPos.ToString) End Sub - Public Event CursorPos(ByVal sender As Object, ByVal sCursorPos As String) + '---- Main Buttons ---- + Public Function NewProject() As Boolean + Dim bOk As Boolean = EgtNewFile(m_nGseContext) + EgtZoom(m_nGseContext, ZM_ALL) + If bOk Then + RaiseEvent OnNewProject(Me) + Else + MessageBox.Show("Error on new file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function -End Class + Public Function OpenProject() + 'Scelta file con dialogo + Dim OpenFileDialog As New OpenFileDialog + 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 + Return True + End If + 'Prima del caricamento + RaiseEvent OnOpeningProject(Me) + 'Caricamento del progetto + Cursor = Cursors.WaitCursor + Dim bOk As Boolean = EgtOpenFile(m_nGseContext, OpenFileDialog.FileName) + EgtZoom(m_nGseContext, ZM_ALL) + Cursor = Cursors.Default + 'Gestione risultato + If bOk Then + RaiseEvent OnOpenProject(Me, OpenFileDialog.FileName) + Else + MessageBox.Show("Error opening file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function + + Public Function SaveProject(Optional ByVal sFile As String = "") + 'Assegnazione nome file con dialogo + Dim SaveFileDialog As New SaveFileDialog + SaveFileDialog.Title = "Save" + SaveFileDialog.Filter = "New geometry EgalTech(*.nge)|*.nge" + SaveFileDialog.FileName = sFile + If SaveFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then + Return True + End If + 'Prima del salvataggio + RaiseEvent OnSavingProject(Me, SaveFileDialog.FileName) + 'Salvataggio del progetto + Cursor = Cursors.WaitCursor + Dim bOk As Boolean = EgtSaveFile(m_nGseContext, SaveFileDialog.FileName, NGE_CMPTEXT) + Cursor = Cursors.Default + 'Gestione risultato + If bOk Then + RaiseEvent OnSavedProject(Me) + Else + MessageBox.Show("Error saving file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function + + Public Function ImportProject() + 'Scelta file con dialogo + Dim OpenFileDialog As New OpenFileDialog + OpenFileDialog.Title = "Import" + OpenFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" & + "|Stereolithography (*.stl)|*.stl" & + "|Part program ISO (*.cnc)|*.cnc" & + "|All Files (*.*)|*.*" + OpenFileDialog.FilterIndex = 1 + If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then + Return True + End If + 'Riconoscimento tipo file + Dim nFileType As Integer = EgtGetFileType(OpenFileDialog.FileName) + 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 + 'Prima del caricamento + RaiseEvent OnImportingProject(Me) + 'Pulizia GeomDB + Cursor = Cursors.WaitCursor + Dim bOk As Boolean = EgtNewFile(m_nGseContext) + 'Importazione + If nFileType = FT_DXF Then + bOk = bOk And EgtImportDxf(m_nGseContext, OpenFileDialog.FileName) + ElseIf nFileType = FT_STL Then + bOk = bOk And EgtImportStl(m_nGseContext, OpenFileDialog.FileName) + ElseIf nFileType = FT_CNC Then + bOk = bOk And EgtImportCnc(m_nGseContext, OpenFileDialog.FileName) + End If + EgtZoom(m_nGseContext, ZM_ALL) + Cursor = Cursors.Default + 'Gestione risultato + If bOk Then + RaiseEvent OnImportedProject(Me, OpenFileDialog.FileName) + Else + MessageBox.Show("Error importing file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function + + Public Function ExportProject(Optional ByVal sFile As String = "") + 'Assegnazione nome file con dialogo + Dim SaveFileDialog As New SaveFileDialog + SaveFileDialog.Title = "Export" + SaveFileDialog.Filter = "Drawing Exchange Fmt(*.dxf)|*.dxf" & + "|Stereolithography (*.stl)|*.stl" & + "|All Files (*.*)|*.*" + 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 + MessageBox.Show("File type unknown", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + Return False + End If + 'Prima dell'esportazione + RaiseEvent OnExportingProject(Me, SaveFileDialog.FileName) + 'Esportazione del progetto + Cursor = Cursors.WaitCursor + Dim bOk As Boolean = False + If nFileType = FT_DXF Then + bOk = EgtExportDxf(m_nGseContext, GDB_ID_ROOT, SaveFileDialog.FileName) + ElseIf nFileType = FT_STL Then + bOk = EgtExportStl(m_nGseContext, GDB_ID_ROOT, SaveFileDialog.FileName) + End If + Cursor = Cursors.Default + 'Gestione risultato + If bOk Then + RaiseEvent OnExportedProject(Me) + Else + MessageBox.Show("Error exporting file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function + + 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 + If OpenFileDialog.ShowDialog <> Windows.Forms.DialogResult.OK Then + Return True + End If + 'Prima dell'esecuzione + RaiseEvent OnExecutingScript(Me, OpenFileDialog.FileName) + 'Esecuzione + Cursor = Cursors.WaitCursor + Dim bOk As Boolean = EgtTscFileExec(m_nGseContext, OpenFileDialog.FileName) + EgtZoom(m_nGseContext, ZM_ALL) + Cursor = Cursors.Default + 'Gestione risultato + If bOk Then + RaiseEvent OnExecutedScript(Me) + Else + MessageBox.Show("Error executing file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End If + Return bOk + End Function + + '---- Zoom Buttons ---- + Public Sub ZoomAll() + EgtZoom(m_nGseContext, ZM_ALL) + End Sub + + Public Sub ZoomIn() + EgtZoom(m_nGseContext, ZM_IN) + End Sub + + Public Sub ZoomOut() + EgtZoom(m_nGseContext, ZM_OUT) + End Sub + + '---- Rendering Buttons ---- + Public Sub WireFrame() + EgtSetShowMode(m_nGseContext, SM_WIREFRAME) + End Sub + + Public Sub HiddenLine() + EgtSetShowMode(m_nGseContext, SM_HIDDENLINE) + End Sub + + Public Sub Shading() + EgtSetShowMode(m_nGseContext, SM_SHADING) + End Sub + + '---- LookFrom Buttons ---- + Public Sub TopView() + EgtSetView(m_nGseContext, CT_TOP) + End Sub + + Public Sub IsoView() + EgtSetView(m_nGseContext, CT_ISO_SW) + End Sub + + Public Sub FrontView() + EgtSetView(m_nGseContext, CT_FRONT) + End Sub + + Public Sub BackView() + EgtSetView(m_nGseContext, CT_BACK) + End Sub + + Public Sub LeftView() + EgtSetView(m_nGseContext, CT_LEFT) + End Sub + + Public Sub RightView() + EgtSetView(m_nGseContext, CT_RIGHT) + End Sub + +End Class \ No newline at end of file diff --git a/TestEIn.vbproj b/TestEIn.vbproj index d9fc65c..adf3d2e 100644 --- a/TestEIn.vbproj +++ b/TestEIn.vbproj @@ -52,6 +52,7 @@ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + true On @@ -89,6 +90,7 @@ x64 false false + true My Project\app.manifest @@ -243,10 +245,10 @@ - copy c:\EgtDev\TestEIn\bin\Release32\TestEIn.exe c:\EgtProg\TestEIn\TestEInR32.exe -copy c:\EgtDev\TestEIn\bin\Debug32\TestEIn.exe c:\EgtProg\TestEIn\TestEInD32.exe -copy c:\EgtDev\TestEIn\bin\Release64\TestEIn.exe c:\EgtProg\TestEIn\TestEInR64.exe -copy c:\EgtDev\TestEIn\bin\Debug64\TestEIn.exe c:\EgtProg\TestEIn\TestEInD64.exe + IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\TestEIn\TestEInR32.exe +IF "$(PlatformName)"=="x86" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\TestEIn\TestEInD32.exe +IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Release" copy $(TargetPath) c:\EgtProg\TestEIn\TestEInR64.exe +IF "$(PlatformName)"=="x64" IF "$(ConfigurationName)" == "Debug" copy $(TargetPath) c:\EgtProg\TestEIn\TestEInD64.exe