Solidwork start new part

This commit is contained in:
Mans 2021-01-25 14:32:27 +01:00
parent 2405176d74
commit 5c201a5b73
4 changed files with 69 additions and 21 deletions

View File

@ -31,31 +31,32 @@ Partial Class GUI
Me.UpdateButton = New System.Windows.Forms.Button() Me.UpdateButton = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label() Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label()
Me.ExportSW = New System.Windows.Forms.Button()
Me.SuspendLayout() Me.SuspendLayout()
' '
'DrawingPanel 'DrawingPanel
' '
Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window Me.DrawingPanel.BackColor = System.Drawing.SystemColors.Window
Me.DrawingPanel.Location = New System.Drawing.Point(239, 95) Me.DrawingPanel.Location = New System.Drawing.Point(319, 117)
Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(2) Me.DrawingPanel.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.DrawingPanel.Name = "DrawingPanel" 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 Me.DrawingPanel.TabIndex = 0
' '
'HeightBox 'HeightBox
' '
Me.HeightBox.Location = New System.Drawing.Point(503, 51) Me.HeightBox.Location = New System.Drawing.Point(671, 63)
Me.HeightBox.Margin = New System.Windows.Forms.Padding(2) Me.HeightBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.HeightBox.Name = "HeightBox" 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 Me.HeightBox.TabIndex = 1
' '
'WidthBox 'WidthBox
' '
Me.WidthBox.Location = New System.Drawing.Point(343, 51) Me.WidthBox.Location = New System.Drawing.Point(457, 63)
Me.WidthBox.Margin = New System.Windows.Forms.Padding(2) Me.WidthBox.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.WidthBox.Name = "WidthBox" 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 Me.WidthBox.TabIndex = 2
' '
'ContextMenuStrip1 'ContextMenuStrip1
@ -66,10 +67,10 @@ Partial Class GUI
' '
'UpdateButton 'UpdateButton
' '
Me.UpdateButton.Location = New System.Drawing.Point(669, 51) Me.UpdateButton.Location = New System.Drawing.Point(892, 63)
Me.UpdateButton.Margin = New System.Windows.Forms.Padding(2) Me.UpdateButton.Margin = New System.Windows.Forms.Padding(3, 2, 3, 2)
Me.UpdateButton.Name = "UpdateButton" 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.TabIndex = 3
Me.UpdateButton.Text = "Update" Me.UpdateButton.Text = "Update"
Me.UpdateButton.UseVisualStyleBackColor = True Me.UpdateButton.UseVisualStyleBackColor = True
@ -77,26 +78,38 @@ Partial Class GUI
'Label1 'Label1
' '
Me.Label1.AutoSize = True 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.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.TabIndex = 4
Me.Label1.Text = "Width" Me.Label1.Text = "Width"
' '
'Label2 'Label2
' '
Me.Label2.AutoSize = True 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.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.TabIndex = 5
Me.Label2.Text = "Height" 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 '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.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.Label2)
Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.UpdateButton) Me.Controls.Add(Me.UpdateButton)
@ -104,6 +117,7 @@ Partial Class GUI
Me.Controls.Add(Me.HeightBox) Me.Controls.Add(Me.HeightBox)
Me.Controls.Add(Me.DrawingPanel) Me.Controls.Add(Me.DrawingPanel)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Margin = New System.Windows.Forms.Padding(4)
Me.Name = "GUI" Me.Name = "GUI"
Me.Text = "Floor Gratings" Me.Text = "Floor Gratings"
Me.ResumeLayout(False) Me.ResumeLayout(False)
@ -118,4 +132,5 @@ Partial Class GUI
Friend WithEvents UpdateButton As Button Friend WithEvents UpdateButton As Button
Friend WithEvents Label1 As Label Friend WithEvents Label1 As Label
Friend WithEvents Label2 As Label Friend WithEvents Label2 As Label
Friend WithEvents ExportSW As Button
End Class End Class

View File

@ -6,6 +6,7 @@ Public Class GUI
Dim GratingW, GratingH As Double Dim GratingW, GratingH As Double
Dim DrawW, DrawH As Integer Dim DrawW, DrawH As Integer
Dim Aspect1, Aspect2 As Double Dim Aspect1, Aspect2 As Double
Dim p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y As Integer Dim p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y As Integer
@ -89,4 +90,9 @@ Public Class GUI
Me.Refresh() Me.Refresh()
End Sub End Sub
Private Sub ExportSW_Click(sender As Object, e As EventArgs) Handles ExportSW.Click
Program.Export_SW()
End Sub
End Class End Class

View File

@ -1,7 +1,23 @@
Imports XCCLibrary Imports XCCLibrary
'Imports SolidWorks.Interop.sldworks
'Imports SolidWorks.Interop.swconst
Imports System.Runtime.InteropServices
Imports System
Imports SldWorks
Public Class Program 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 End Class

View File

@ -135,5 +135,16 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\remove-b.png" /> <None Include="Resources\remove-b.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<COMReference Include="SldWorks">
<Guid>{83A33D31-27C5-11CE-BFD4-00400513BB57}</Guid>
<VersionMajor>28</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project> </Project>