diff --git a/Wardrobe/GUI.Designer.vb b/Wardrobe/GUI.Designer.vb index 27cd3be..5ffd0d0 100644 --- a/Wardrobe/GUI.Designer.vb +++ b/Wardrobe/GUI.Designer.vb @@ -31,31 +31,32 @@ Partial Class GUI Me.UpdateButton = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() + Me.ExportSW = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'DrawingPanel ' Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window - Me.DrawingPanel.Location = New System.Drawing.Point(239, 95) - Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2) + Me.DrawingPanel.Location = New System.Drawing.Point(319, 117) + Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) Me.DrawingPanel.Name = "DrawingPanel" - Me.DrawingPanel.Size = New System.Drawing.Size(649, 393) + Me.DrawingPanel.Size = New System.Drawing.Size(865, 484) Me.DrawingPanel.TabIndex = 0 ' 'HeightBox ' - Me.HeightBox.Location = New System.Drawing.Point(503, 51) - Me.HeightBox.Margin = New System.Windows.Forms.Padding(2) + Me.HeightBox.Location = New System.Drawing.Point(671, 63) + Me.HeightBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) Me.HeightBox.Name = "HeightBox" - Me.HeightBox.Size = New System.Drawing.Size(76, 20) + Me.HeightBox.Size = New System.Drawing.Size(100, 22) Me.HeightBox.TabIndex = 1 ' 'WidthBox ' - Me.WidthBox.Location = New System.Drawing.Point(343, 51) - Me.WidthBox.Margin = New System.Windows.Forms.Padding(2) + Me.WidthBox.Location = New System.Drawing.Point(457, 63) + Me.WidthBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) Me.WidthBox.Name = "WidthBox" - Me.WidthBox.Size = New System.Drawing.Size(76, 20) + Me.WidthBox.Size = New System.Drawing.Size(100, 22) Me.WidthBox.TabIndex = 2 ' 'ContextMenuStrip1 @@ -66,10 +67,10 @@ Partial Class GUI ' 'UpdateButton ' - Me.UpdateButton.Location = New System.Drawing.Point(669, 51) - Me.UpdateButton.Margin = New System.Windows.Forms.Padding(2) + Me.UpdateButton.Location = New System.Drawing.Point(892, 63) + Me.UpdateButton.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2) Me.UpdateButton.Name = "UpdateButton" - Me.UpdateButton.Size = New System.Drawing.Size(56, 19) + Me.UpdateButton.Size = New System.Drawing.Size(75, 30) Me.UpdateButton.TabIndex = 3 Me.UpdateButton.Text = "Update" Me.UpdateButton.UseVisualStyleBackColor = True @@ -77,26 +78,38 @@ Partial Class GUI 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(303, 54) + Me.Label1.Location = New System.Drawing.Point(404, 66) + Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(35, 13) + Me.Label1.Size = New System.Drawing.Size(44, 17) Me.Label1.TabIndex = 4 Me.Label1.Text = "Width" ' 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(460, 54) + Me.Label2.Location = New System.Drawing.Point(613, 66) + Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(38, 13) + Me.Label2.Size = New System.Drawing.Size(49, 17) Me.Label2.TabIndex = 5 Me.Label2.Text = "Height" ' + 'ExportSW + ' + Me.ExportSW.Location = New System.Drawing.Point(1025, 62) + Me.ExportSW.Name = "ExportSW" + Me.ExportSW.Size = New System.Drawing.Size(75, 31) + Me.ExportSW.TabIndex = 6 + Me.ExportSW.Text = "Export" + Me.ExportSW.UseVisualStyleBackColor = True + ' 'GUI ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(899, 499) + Me.ClientSize = New System.Drawing.Size(1199, 614) + Me.Controls.Add(Me.ExportSW) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.UpdateButton) @@ -104,6 +117,7 @@ Partial Class GUI Me.Controls.Add(Me.HeightBox) Me.Controls.Add(Me.DrawingPanel) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) + Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "GUI" Me.Text = "Floor Gratings" Me.ResumeLayout(False) @@ -118,4 +132,5 @@ Partial Class GUI Friend WithEvents UpdateButton As Button Friend WithEvents Label1 As Label Friend WithEvents Label2 As Label + Friend WithEvents ExportSW As Button End Class diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb index 554d8c3..5bb3844 100644 --- a/Wardrobe/GUI.vb +++ b/Wardrobe/GUI.vb @@ -6,6 +6,7 @@ Public Class GUI Dim GratingW, GratingH As Double Dim DrawW, DrawH As Integer Dim Aspect1, Aspect2 As Double + Dim p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y As Integer @@ -89,4 +90,9 @@ Public Class GUI Me.Refresh() End Sub + + Private Sub ExportSW_Click(sender As Object, e As EventArgs) Handles ExportSW.Click + Program.Export_SW() + End Sub + End Class diff --git a/Wardrobe/Program.vb b/Wardrobe/Program.vb index 1419243..2489dba 100644 --- a/Wardrobe/Program.vb +++ b/Wardrobe/Program.vb @@ -1,7 +1,23 @@ Imports XCCLibrary - +'Imports SolidWorks.Interop.sldworks +'Imports SolidWorks.Interop.swconst +Imports System.Runtime.InteropServices +Imports System +Imports SldWorks Public Class Program - - + Public Shared Sub Export_SW() + Dim swApp As SldWorks.SldWorks + swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks) + Dim Model As ModelDoc2 + Dim Part As PartDoc + Dim RootPoint(2) As Double + Dim Normal(2) As Double + 'Dim TempBody As Body2 + 'Dim isGood As Boolean + swApp.UserControl = True + 'Create a new blank document + Model = swApp.NewDocument("C:\ProgramData\SOLIDWORKS\SOLIDWORKS 2020\templates\part.prtdot", 0, 0, 0) + Part = Model + End Sub End Class diff --git a/Wardrobe/Wardrobe.vbproj b/Wardrobe/Wardrobe.vbproj index e415141..5923387 100644 --- a/Wardrobe/Wardrobe.vbproj +++ b/Wardrobe/Wardrobe.vbproj @@ -135,5 +135,16 @@ + + + {83A33D31-27C5-11CE-BFD4-00400513BB57} + 28 + 0 + 0 + tlbimp + False + True + + \ No newline at end of file