End pieces for frames

This commit is contained in:
Mans 2021-03-25 13:41:23 +01:00
parent d438a6b994
commit 61de434ebc
7 changed files with 83 additions and 6 deletions

Binary file not shown.

BIN
HLCt/Parts/~$START.SLDPRT Normal file

Binary file not shown.

View File

@ -250,7 +250,7 @@ Public Class Individual
Model_3D_Fill.BuildGrid()
Else
Model_3D.BuildGrating()
Drawing.Create_Model_For_Drawing()
'Drawing.Create_Model_For_Drawing()
End If
End Sub

View File

@ -1,17 +1,20 @@
Imports XCCLibrary
Imports SldWorks
Public Class Individual_Frame_3D
Private Shared cuttingList As New Dictionary(Of Integer, Integer())
Private Shared designName As String
Private Shared sideFrameLengths As New Dictionary(Of String, Integer)
Public Shared Sub Build_Frame(gratingParameters As DataRow, parentID As Integer)
Dim frameDT As New DataTable
frameDT = Generate_FrameData(gratingParameters)
Dim sideFrameLengths As New Dictionary(Of String, Integer)
For i = 0 To frameDT.Rows.Count - 1
If frameDT.Rows(i)("TYPE") = "SIDE" Then
sideFrameLengths.Add("Frame " & sideFrameLengths.Count + 1, frameDT.Rows(i)("LENGTH"))
End If
Next
Dim cuttingList As New Dictionary(Of Integer, Integer())
cuttingList = Generate_CuttingList(frameDT, sideFrameLengths)
Dim inst_ As Integer
@ -25,8 +28,8 @@ Public Class Individual_Frame_3D
HLCtName = "frame_l_straight"
End If
inst_ = ExternalClass.instantiate_parts(parentID, HLCtName, "")
ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, 30)
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, 40)
ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, 30) 'FIXA
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, 40) 'FIXA
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, frameDT.Rows(i)("ROTATION"))
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, frameDT.Rows(i)("OFFSET_W"))
@ -283,4 +286,55 @@ Public Class Individual_Frame_3D
Return cuttingList
End Function
Public Shared Sub Generate_End_Frame_Piece()
Dim swApp As SldWorks.SldWorks
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
Dim boolstatus As Boolean
Dim longstatus As Integer, longwarnings As Integer
For j = 0 To cuttingList.Count - 1
Dim Part = swApp.OpenDoc6(Settings.HLCtFolder & "\HLCt\frame_l_straight.SLDPRT", 1, 0, "", longstatus, longwarnings)
longstatus = Part.SaveAs3(Individual.filepath & "\Temp\frame_l_end_piece" & j + 1 & ".SLDPRT", 0, 0) 'FIXA ettan
Dim swEquationMgr As EquationMgr
swEquationMgr = Part.GetEquationMgr()
Dim counter As String = 0
For i = 0 To swEquationMgr.GetCount() - 1
Dim equationName = swEquationMgr.Equation(i)
Dim tempName = equationName.Substring(1, equationName.Length - 2)
tempName = tempName.Split("""")(0)
equationName = equationName.Split("=")(0) & "= "
If tempName = "DP_HEIGHT" Then
swEquationMgr.Equation(i) = equationName & 30 'FIXA
counter += 1
ElseIf tempName = "DP_WIDTH" Then
swEquationMgr.Equation(i) = equationName & 40 'FIXA
counter += 1
ElseIf tempName = "DP_CUTOFFSET1" Then
Dim cutLength As Integer = 0
For k = 0 To cuttingList.ElementAt(j).Value.Count - 1
cutLength += sideFrameLengths("Frame " & cuttingList.ElementAt(j).Value(k))
Next
swEquationMgr.Equation(i) = equationName & cutLength
counter += 1
ElseIf tempName.Split("_")(0) = "DP" Then
swEquationMgr.Equation(i) = equationName & 0
counter += 1
End If
If counter = 7 Then
Exit For
End If
Next
boolstatus = Part.EditRebuild3()
Dim swErrors As Integer
Dim swWarnings As Integer
boolstatus = Part.Save3(1, swErrors, swWarnings)
Next
End Sub
End Class

View File

@ -0,0 +1,11 @@
Imports SldWorks
Public Class Individual_Frame_Drawing
Public Shared Sub Create_Assemblies()
End Sub
End Class

View File

@ -45,6 +45,7 @@ Public Class Model_3D
groupClass.InstantiateGroup(designName, grNr, "START")
Recess_Indent()
Individual_Frame_3D.Generate_End_Frame_Piece()
End Sub
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
@ -221,7 +222,7 @@ Public Class Model_3D
Dim recessParts = partDT.Select("parentName = '" & gratingPartName & "'")
Dim recessPartName As String
For i = 0 To recessParts.Count - 1
For i = 0 To recessParts.Count - 100 'FIXA (Ska vara "-1")
Assembly.ClearSelection2(True)
' Recess part
@ -262,6 +263,16 @@ Public Class Model_3D
Assembly.ClearSelection2(True)
Next
Next
Assembly.EditAssembly
Dim swErrors As Integer
Dim swWarnings As Integer
components = Assembly.GetComponents(True)
For i = 0 To UBound(components)
Dim partDoc = components(i).GetModelDoc2()
boolstatus = partDoc.Save3(1, swErrors, swWarnings)
Next
boolstatus = Assembly.Save3(1, swErrors, swWarnings)
End Sub
End Class

View File

@ -121,6 +121,7 @@
<Compile Include="Recess Functions\Side_Rectangle.vb" />
<Compile Include="SolidWorks\Drawing.vb" />
<Compile Include="SolidWorks\Individual_Frame_3D.vb" />
<Compile Include="SolidWorks\Individual_Frame_Drawing.vb" />
<Compile Include="SolidWorks\Model_3D.vb" />
<Compile Include="SolidWorks\Model_3D_Fill.vb" />
</ItemGroup>