Start Indent
This commit is contained in:
parent
34c6205a75
commit
a66edd0ceb
|
|
@ -1,7 +1,7 @@
|
||||||
Imports XCCLibrary
|
Imports XCCLibrary
|
||||||
Public Class GUI
|
Public Class GUI
|
||||||
Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
|
'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
|
||||||
'Public Shared filepath As String = "C:\Users\xperd\Documents"
|
Public Shared filepath As String = "C:\Users\xperd\Documents"
|
||||||
|
|
||||||
' --- Start method (main) for GUI ---
|
' --- Start method (main) for GUI ---
|
||||||
Sub GUI_load() Handles MyBase.Load
|
Sub GUI_load() Handles MyBase.Load
|
||||||
|
|
@ -138,7 +138,7 @@ Public Class GUI
|
||||||
' --- When export to SW button is pressed ---
|
' --- When export to SW button is pressed ---
|
||||||
Private Sub ExportSWButton_Click(sender As Object, e As EventArgs) Handles ExportSWButton.Click
|
Private Sub ExportSWButton_Click(sender As Object, e As EventArgs) Handles ExportSWButton.Click
|
||||||
Model_3D.BuildGrating()
|
Model_3D.BuildGrating()
|
||||||
Drawing.CreateDrawing()
|
'Drawing.CreateDrawing()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
Imports XCCLibrary
|
Imports XCCLibrary
|
||||||
|
Imports SldWorks
|
||||||
Public Class Model_3D
|
Public Class Model_3D
|
||||||
|
Private Shared designName As String
|
||||||
Public Shared Sub BuildGrating()
|
Public Shared Sub BuildGrating()
|
||||||
Dim exportTable As DataTable
|
Dim exportTable As DataTable
|
||||||
exportTable = User_Input.Create_ExportTable()
|
exportTable = User_Input.Create_ExportTable()
|
||||||
|
|
@ -37,11 +39,11 @@ Public Class Model_3D
|
||||||
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
|
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
|
||||||
Dim grNr = groupClass.NewGroupID
|
Dim grNr = groupClass.NewGroupID
|
||||||
Dim designTable = designModel.selectDesign("*")
|
Dim designTable = designModel.selectDesign("*")
|
||||||
Dim designName = designTable.rows(0)("designName")
|
designName = designTable.rows(0)("designName")
|
||||||
groupClass.InstantiateGroup(designName, grNr, "START")
|
groupClass.InstantiateGroup(designName, grNr, "START")
|
||||||
|
|
||||||
|
|
||||||
|
Recess_Indent()
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
@ -70,6 +72,7 @@ Public Class Model_3D
|
||||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||||
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, 0)
|
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, 0)
|
||||||
|
|
||||||
|
|
||||||
ElseIf recessDR("CORNER") = 2 Then
|
ElseIf recessDR("CORNER") = 2 Then
|
||||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - squareW)
|
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - squareW)
|
||||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - squareL - gratingParameters("LOADBAR_THICKNESS"))
|
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - squareL - gratingParameters("LOADBAR_THICKNESS"))
|
||||||
|
|
@ -100,6 +103,123 @@ Public Class Model_3D
|
||||||
ElseIf recessDR("RECESS TYPE") = "SIDE SQUARE" Then
|
ElseIf recessDR("RECESS TYPE") = "SIDE SQUARE" Then
|
||||||
'???
|
'???
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Shared Sub Recess_Indent()
|
||||||
|
Dim swApp As SldWorks.SldWorks
|
||||||
|
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||||
|
|
||||||
|
Dim Assembly = swApp.ActiveDoc
|
||||||
|
|
||||||
|
Dim boolstatus As Boolean
|
||||||
|
|
||||||
|
|
||||||
|
'' Get all the parts in the model
|
||||||
|
'Dim dt As New DataTable
|
||||||
|
'dt = partModel.selectPart("*")
|
||||||
|
|
||||||
|
'Dim Design_table = designModel.selectDesign("*")
|
||||||
|
'Dim Design_name = Design_table.rows(0)("designName")
|
||||||
|
|
||||||
|
'' Get the quantity of each type
|
||||||
|
'Dim Nr_of_Rail = dt.Select("partType = 'RAIL'")
|
||||||
|
|
||||||
|
Dim partDT As New DataTable
|
||||||
|
partDT = partModel.selectPart("*")
|
||||||
|
|
||||||
|
Dim rectangleParts = partDT.Select("partType = 'recess_rectangle'")
|
||||||
|
|
||||||
|
'Gå in i durk part
|
||||||
|
Dim gratingPartName As String = "PRESSURE_WELDED_" & designName & "_092158497" & "-1@" & designName
|
||||||
|
|
||||||
|
boolstatus = Assembly.SelectByID2(gratingPartName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
|
|
||||||
|
Dim SelMgr = Assembly.SelectionManager()
|
||||||
|
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||||
|
Assembly.EditPart
|
||||||
|
|
||||||
|
|
||||||
|
Dim recessPartName As String = "RECESS_RECTANGLE_" & designName & "_8457575" & "-1@" & designName
|
||||||
|
|
||||||
|
boolstatus = Assembly.SelectByID2(recessPartName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
|
|
||||||
|
Dim recessPart = SelMgr.GetSelectedObject6(1, -1)
|
||||||
|
|
||||||
|
boolstatus = gratingPart.Extension.SelectByID2("Solid Bodies", "BDYFOLDER", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
|
Dim swFeat = SelMgr.GetSelectedObject6(1, -1)
|
||||||
|
|
||||||
|
Dim swBodyFolder = swFeat.GetSpecificFeature2
|
||||||
|
Dim Bodies = swBodyFolder.GetBodies()
|
||||||
|
|
||||||
|
Dim cutBodyName As String = "Boss-Extrude1"
|
||||||
|
|
||||||
|
Dim myFeature As Object
|
||||||
|
|
||||||
|
For i = 0 To (swBodyFolder.GetBodyCount() - 1)
|
||||||
|
Dim swBody = Bodies(i)
|
||||||
|
Dim bodyName As String = swBody.Name
|
||||||
|
boolstatus = gratingPart.Extension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, False, 1, Nothing, 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
boolstatus = recessPart.Extension.SelectByID2(cutBodyName, "SOLIDBODY", 0, 0, 0, False, 1, Nothing, 0)
|
||||||
|
|
||||||
|
|
||||||
|
myFeature = gratingPart.FeatureManager.InsertIndent(0, 0, False, True, True, False) 'Första var 0.01
|
||||||
|
Next
|
||||||
|
|
||||||
|
'Loop
|
||||||
|
'Välj body
|
||||||
|
'Välj face (recess box)
|
||||||
|
'Indent
|
||||||
|
|
||||||
|
|
||||||
|
'Dim point2NameSW As String = "Point" & points(1) & "@Sketch1@" & CompName & "@" & myView.GetName2
|
||||||
|
|
||||||
|
'iDrawing.ClearSelection2(True)
|
||||||
|
|
||||||
|
'swExtensions.SelectByID2(point1NameSW, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
|
||||||
|
'swExtensions.SelectByID2(point2NameSW, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'Dim Part As Object
|
||||||
|
'Dim boolstatus As Boolean
|
||||||
|
'Dim longstatus As Long, longwarnings As Long
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'swApp = Application.SldWorks
|
||||||
|
|
||||||
|
'Part = swApp.ActiveDoc
|
||||||
|
'Set AssyDoc = swApp.ActiveDoc
|
||||||
|
'Set SelMgr = AssyDoc.SelectionManager()
|
||||||
|
|
||||||
|
'boolstatus = Part.Extension.SelectByID2("PRESSURE_WELDED_406_0922295_092158479-1@406_0922295", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0) 'Alltid pressure_welded eller type A
|
||||||
|
''boolstatus = Part.Extension.SelectByID2("PRESSURE_WELDED_" & designName _092158479 & "-1@" & designName", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
|
'Set Comp1 = SelMgr.GetSelectedObject6(1, -1)
|
||||||
|
'Part.EditPart
|
||||||
|
''Part.ClearSelection2 True
|
||||||
|
|
||||||
|
|
||||||
|
'For i = 0 To Part.getbodies().count 'Loopa igenom för så många bodies som finns i pressure_welded
|
||||||
|
' 'Select first body
|
||||||
|
|
||||||
|
' boolstatus = Part.Extension.SelectByID2("LPattern2[1]@PRESSURE_WELDED_406_0922295_092158479-1@406_0922295", "SOLIDBODY", 0.360768757122841, -0.410499999999985, -0.0160176749000129, False, 1, Nothing, 0) 'Loopa igenom all bodies
|
||||||
|
' 'boolstatus = Part.Extension.SelectByID2("first body", "SOLIDBODY", 0, 0, 0, False, 1, Nothing, 0)
|
||||||
|
|
||||||
|
' 'Select first face of recess box
|
||||||
|
' boolstatus = Part.Extension.SelectByRay(0.396886158235986, -0.412499999999909, -0.0485030769993955, 0.290449608622063, 0.476797615277708, -0.829640319003833, 0.00232083601043029, 2, True, 4, 0) ' Alltid recess boxen
|
||||||
|
' 'boolstatus = Part.Extension.SelectByID2("first face of recess box", "SOLIDBODY", 0, 0, 0, False, 1, Nothing, 0)
|
||||||
|
|
||||||
|
|
||||||
|
' Dim myFeature As Object
|
||||||
|
' Set myFeature = Part.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||||
|
|
||||||
|
'Next
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue