Fixes for Individual (including simplified model, instructions, etc.)
This commit is contained in:
parent
9c3a40d43b
commit
fd4b903862
Binary file not shown.
|
|
@ -56,6 +56,9 @@ Public Class Individual
|
|||
|
||||
Me.ComboBox_Width.Visible = True
|
||||
Me.TextBox_Width.Visible = False
|
||||
|
||||
'CheckBox_3DModel.Checked = True
|
||||
'CheckBox_3DModel.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Multiple()
|
||||
|
|
@ -321,6 +324,8 @@ Public Class Individual
|
|||
If User_Input.addInstructions = True Then
|
||||
If User_Input.addFrame = True AndAlso simplifiedWithFrameCreated = False Then
|
||||
Multiple_3D_Simplified.Build_Grid(True)
|
||||
ElseIf simplifiedWithFrameCreated = False Then
|
||||
Multiple_3D_Simplified.Build_Grid(False)
|
||||
End If
|
||||
If User_Input.addFrame = True Then
|
||||
Instructions.Generate_Instructions(True)
|
||||
|
|
@ -330,8 +335,45 @@ Public Class Individual
|
|||
End If
|
||||
|
||||
Else
|
||||
Individual_3D.BuildGrating()
|
||||
Individual_Drawing.Create_Model_For_Drawing()
|
||||
Dim frameCreated As Boolean = False
|
||||
If User_Input.add3DGrating = True Then
|
||||
Individual_3D.BuildGrating()
|
||||
frameCreated = True
|
||||
End If
|
||||
|
||||
If User_Input.addGratingDrawing = True Then
|
||||
Individual_Drawing.Generate_Drawing()
|
||||
End If
|
||||
|
||||
Dim simplifiedWithFrameCreated As Boolean = False
|
||||
If User_Input.addFrameDrawing = True Then
|
||||
If frameCreated = False Then
|
||||
Individual_3D_Simplified.Build_Simplified(True)
|
||||
simplifiedWithFrameCreated = True
|
||||
End If
|
||||
For Each DR As DataRow In Frame_3D.frameDT.Rows
|
||||
If DR("TYPE") = "SIDE" Then
|
||||
Frame_3D.Generate_End_Frame_Pieces()
|
||||
Frame_Drawing.Create_Assemblies(simplifiedWithFrameCreated)
|
||||
Frame_Drawing.Generate_Drawings()
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If User_Input.addInstructions = True Then
|
||||
If User_Input.addFrame = True AndAlso simplifiedWithFrameCreated = False Then
|
||||
Individual_3D_Simplified.Build_Simplified(True)
|
||||
ElseIf simplifiedWithFrameCreated = False Then
|
||||
Individual_3D_Simplified.Build_Simplified(False)
|
||||
End If
|
||||
If User_Input.addFrame = True Then
|
||||
Instructions.Generate_Instructions(True)
|
||||
Else
|
||||
Instructions.Generate_Instructions(False)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Public Class Frame_Drawing
|
|||
If User_Input.add3DGrating = True Then
|
||||
frameComponents = Individual_3D.partDT.Select("partType = 'frame_l_straight'")
|
||||
Else
|
||||
'Finns inte -> FIXA, kan funka: frameComponents = Multiple_3D_Simplified.partDT.Select("partType = 'frame_l_straight'")
|
||||
frameComponents = Individual_3D_Simplified.partDT.Select("partType = 'frame_l_straight'")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ Public Class Individual_3D
|
|||
Inst_Recesses(parentID, gratingParameters, recessDR)
|
||||
Next
|
||||
|
||||
Frame_3D.Build_Frame(gratingParameters, parentID)
|
||||
If User_Input.addFrame = True Then
|
||||
Frame_3D.Build_Frame(gratingParameters, parentID)
|
||||
End If
|
||||
|
||||
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
|
||||
Dim grNr = groupClass.NewGroupID
|
||||
|
|
@ -50,16 +52,6 @@ Public Class Individual_3D
|
|||
Recess_Indent()
|
||||
Save_Assembly()
|
||||
|
||||
For Each DR As DataRow In Frame_3D.frameDT.Rows
|
||||
If DR("TYPE") = "SIDE" Then
|
||||
Frame_3D.Generate_End_Frame_Pieces()
|
||||
Frame_Drawing.Create_Assemblies(False) 'Fixa False
|
||||
Frame_Drawing.Generate_Drawings()
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Save_Assembly()
|
||||
|
|
@ -68,45 +60,56 @@ Public Class Individual_3D
|
|||
|
||||
Dim status As Integer
|
||||
|
||||
Dim sourcePath, destPath As String
|
||||
Dim childrenSourcePaths As New List(Of String)
|
||||
Dim childrenDestPaths As New List(Of String)
|
||||
Dim Assembly = swApp.ActiveDoc()
|
||||
Dim newName As String
|
||||
newName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\grating_assembly.SLDASM"
|
||||
|
||||
sourcePath = Settings.filesFolder & "\Files\CADStart\" & designName & ".SLDASM"
|
||||
destPath = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\GRATING_ASSEMBLY.SLDASM"
|
||||
Dim swExtensions As IModelDocExtension
|
||||
swExtensions = Assembly.Extension
|
||||
Dim Errors As Integer
|
||||
Dim Warnings As Integer
|
||||
|
||||
childrenSourcePaths.Add(Settings.HLCtFolder & "\HLCt\Parts\START.SLDPRT")
|
||||
childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\MASTER.SLDPRT")
|
||||
status = swExtensions.SaveAs2(newName, 0, 4, Nothing, "", True, Errors, Warnings)
|
||||
|
||||
Dim instanceCounter As New Dictionary(Of String, Integer)
|
||||
For i = 0 To partDT.Rows.Count - 1
|
||||
childrenSourcePaths.Add(Settings.filesFolder & "\Files\CADStart\" & partDT.Rows(i)("partName") & ".SLDPRT")
|
||||
'Dim sourcePath, destPath As String
|
||||
'Dim childrenSourcePaths As New List(Of String)
|
||||
'Dim childrenDestPaths As New List(Of String)
|
||||
|
||||
Dim partName As String = partDT.Rows(i)("partName")
|
||||
Dim partNameArray As String() = partName.Split("_")
|
||||
'sourcePath = Settings.filesFolder & "\Files\CADStart\" & designName & ".SLDASM"
|
||||
'destPath = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\GRATING_ASSEMBLY.SLDASM"
|
||||
|
||||
Dim newName As String = ""
|
||||
For j = 0 To partNameArray.Length - 4
|
||||
newName += partNameArray(j) & "_"
|
||||
Next
|
||||
'childrenSourcePaths.Add(Settings.HLCtFolder & "\HLCt\Parts\START.SLDPRT")
|
||||
'childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\MASTER.SLDPRT")
|
||||
|
||||
Try
|
||||
instanceCounter(newName.Substring(0, newName.Length - 1)) += 1
|
||||
Catch ex As Exception
|
||||
instanceCounter.Add(newName.Substring(0, newName.Length - 1), 1)
|
||||
End Try
|
||||
'Dim instanceCounter As New Dictionary(Of String, Integer)
|
||||
'For i = 0 To partDT.Rows.Count - 1
|
||||
' childrenSourcePaths.Add(Settings.filesFolder & "\Files\CADStart\" & partDT.Rows(i)("partName") & ".SLDPRT")
|
||||
|
||||
If partNameArray(0) = "FRAME" Then
|
||||
childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw") & "\" & newName &
|
||||
instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
Else
|
||||
childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\" & newName &
|
||||
instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
End If
|
||||
Next
|
||||
' Dim partName As String = partDT.Rows(i)("partName")
|
||||
' Dim partNameArray As String() = partName.Split("_")
|
||||
|
||||
swApp.CloseAllDocuments(True)
|
||||
status = swApp.CopyDocument(sourcePath, destPath, childrenSourcePaths.ToArray(), childrenDestPaths.ToArray(), 2)
|
||||
' Dim newName As String = ""
|
||||
' For j = 0 To partNameArray.Length - 4
|
||||
' newName += partNameArray(j) & "_"
|
||||
' Next
|
||||
|
||||
' Try
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) += 1
|
||||
' Catch ex As Exception
|
||||
' instanceCounter.Add(newName.Substring(0, newName.Length - 1), 1)
|
||||
' End Try
|
||||
|
||||
' If partNameArray(0) = "FRAME" Then
|
||||
' childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw") & "\" & newName &
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
' Else
|
||||
' childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\" & newName &
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
' End If
|
||||
'Next
|
||||
|
||||
'swApp.CloseAllDocuments(True)
|
||||
'status = swApp.CopyDocument(sourcePath, destPath, childrenSourcePaths.ToArray(), childrenDestPaths.ToArray(), 2)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,460 @@
|
|||
Imports XCCLibrary
|
||||
Imports SldWorks
|
||||
Public Class Individual_3D_Simplified
|
||||
Private Shared gratingParameters As DataRow
|
||||
Private Shared designName As String
|
||||
Public Shared partDT As New DataTable
|
||||
Public Shared Sub Build_Simplified(withFrame As Boolean)
|
||||
Dim exportTable As DataTable
|
||||
exportTable = User_Input.Create_ExportTable()
|
||||
|
||||
XCCBaseClass.newDesign()
|
||||
ExternalClass.PopulateTamplateXMLGroup()
|
||||
|
||||
Dim inst_ As Integer
|
||||
Dim parentID As Integer = 0
|
||||
gratingParameters = exportTable.Rows(0)
|
||||
|
||||
inst_ = ExternalClass.instantiate_parts(parentID, "simplified_floor_grating", "")
|
||||
ExternalClass.modify_parameter_value("DP_GRATING_WIDTH", inst_, gratingParameters("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_GRATING_LENGTH", inst_, gratingParameters("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_LOADBAR_HEIGHT", inst_, gratingParameters("LOADBAR_HEIGHT"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_X", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_Y", inst_, 0)
|
||||
|
||||
parentID = inst_
|
||||
For Each recessDR As DataRow In Data.recessData.Rows
|
||||
Inst_Recesses(parentID, gratingParameters, recessDR)
|
||||
Next
|
||||
|
||||
If withFrame = True Then
|
||||
Frame_3D.Build_Frame(gratingParameters, parentID)
|
||||
End If
|
||||
|
||||
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
|
||||
Dim grNr = groupClass.NewGroupID
|
||||
Dim designTable = designModel.selectDesign("*")
|
||||
designName = designTable.rows(0)("designName")
|
||||
groupClass.InstantiateGroup(designName, grNr, "START")
|
||||
|
||||
Recess_Indent()
|
||||
Save_Assembly(withFrame)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Save_Assembly(withFrame As Boolean)
|
||||
Dim swApp As SldWorks.SldWorks
|
||||
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||
|
||||
Dim status As Integer
|
||||
|
||||
Dim Assembly = swApp.ActiveDoc()
|
||||
|
||||
Dim config As Configuration
|
||||
config = Assembly.GetActiveConfiguration
|
||||
Dim swCustPropMgr = config.CustomPropertyManager
|
||||
If withFrame = True Then
|
||||
status = swCustPropMgr.Add3("Benämning", 30, "Placement instructions for assembly", 1)
|
||||
status = swCustPropMgr.Add3("ExtraBenämning1", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("ExtraBenämning2", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("Materialsort", 30, "", 1)
|
||||
Else
|
||||
status = swCustPropMgr.Add3("Benämning", 30, "Floor grating " & User_Input.gratingMesh & " " & User_Input.gratingHeight & "/" & User_Input.loadBarThickness, 1)
|
||||
status = swCustPropMgr.Add3("ExtraBenämning1", 30, "LxW " & Data.gratingL & "x" & Data.gratingW, 1)
|
||||
If User_Input.gratingSerrated Then
|
||||
status = swCustPropMgr.Add3("ExtraBenämning2", 30, "Serrated", 1)
|
||||
Else
|
||||
status = swCustPropMgr.Add3("ExtraBenämning2", 30, "", 1)
|
||||
End If
|
||||
If User_Input.gratingLacquered Then
|
||||
status = swCustPropMgr.Add3("Materialsort", 30, User_Input.gratingMaterial & " (Lacquered)", 1)
|
||||
Else
|
||||
status = swCustPropMgr.Add3("Materialsort", 30, User_Input.gratingMaterial, 1)
|
||||
End If
|
||||
End If
|
||||
|
||||
status = swCustPropMgr.Add3("Art. Nr", 30, "TBD", 1)
|
||||
status = swCustPropMgr.Add3("Material_Art", 30, "TBD", 1)
|
||||
|
||||
status = swCustPropMgr.Add3("Author", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("Ändrad av", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("SkapadDatum", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("RevideradDatum", 30, "", 1)
|
||||
|
||||
status = swCustPropMgr.Add3("epdmid", 30, "", 1)
|
||||
status = swCustPropMgr.Add3("Revision", 30, "", 1)
|
||||
|
||||
|
||||
Dim newName As String
|
||||
If withFrame = True Then
|
||||
newName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\grating_assembly_simplified_with_frame.SLDASM"
|
||||
Else
|
||||
newName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\grating_assembly_simplified.SLDASM"
|
||||
End If
|
||||
Dim swExtensions As IModelDocExtension
|
||||
swExtensions = Assembly.Extension
|
||||
Dim Errors As Integer
|
||||
Dim Warnings As Integer
|
||||
|
||||
status = swExtensions.SaveAs2(newName, 0, 4, Nothing, "", True, Errors, Warnings)
|
||||
|
||||
|
||||
|
||||
'Dim sourcePath, destPath As String
|
||||
'Dim childrenSourcePaths As New List(Of String)
|
||||
'Dim childrenDestPaths As New List(Of String)
|
||||
|
||||
'sourcePath = Settings.filesFolder & "\Files\CADStart\" & designName & ".SLDASM"
|
||||
'destPath = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\GRATING_ASSEMBLY.SLDASM"
|
||||
|
||||
'childrenSourcePaths.Add(Settings.HLCtFolder & "\HLCt\Parts\START.SLDPRT")
|
||||
'childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\MASTER.SLDPRT")
|
||||
|
||||
'Dim instanceCounter As New Dictionary(Of String, Integer)
|
||||
'For i = 0 To partDT.Rows.Count - 1
|
||||
' childrenSourcePaths.Add(Settings.filesFolder & "\Files\CADStart\" & partDT.Rows(i)("partName") & ".SLDPRT")
|
||||
|
||||
' Dim partName As String = partDT.Rows(i)("partName")
|
||||
' Dim partNameArray As String() = partName.Split("_")
|
||||
|
||||
' Dim newName As String = ""
|
||||
' For j = 0 To partNameArray.Length - 4
|
||||
' newName += partNameArray(j) & "_"
|
||||
' Next
|
||||
|
||||
' Try
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) += 1
|
||||
' Catch ex As Exception
|
||||
' instanceCounter.Add(newName.Substring(0, newName.Length - 1), 1)
|
||||
' End Try
|
||||
|
||||
' If partNameArray(0) = "FRAME" Then
|
||||
' childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_frames_sw") & "\" & newName &
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
' Else
|
||||
' childrenDestPaths.Add(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\" & newName &
|
||||
' instanceCounter(newName.Substring(0, newName.Length - 1)) & ".SLDPRT")
|
||||
' End If
|
||||
'Next
|
||||
|
||||
'swApp.CloseAllDocuments(True)
|
||||
'status = swApp.CopyDocument(sourcePath, destPath, childrenSourcePaths.ToArray(), childrenDestPaths.ToArray(), 2)
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
|
||||
Dim inst_ As Integer
|
||||
|
||||
If recessDR("RECESS TYPE") = "SQUARE" Then
|
||||
Dim squareL As Integer = recessDR("LENGTH") + gratingParameters("LOADBAR_THICKNESS")
|
||||
Dim squareW As Integer = recessDR("WIDTH") + gratingParameters("LOADBAR_THICKNESS")
|
||||
|
||||
inst_ = ExternalClass.instantiate_parts(parentID, "recess_rectangle", "")
|
||||
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, squareL)
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, squareW)
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_HEIGHT", inst_, gratingParameters("LOADBAR_HEIGHT"))
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_THICKNESS", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||
|
||||
If recessDR("CORNER") = 1 Then
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - squareW)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
|
||||
|
||||
'Position
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, squareL - 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)
|
||||
|
||||
ElseIf recessDR("CORNER") = 2 Then
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - squareW)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - squareL)
|
||||
|
||||
'Position
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, 0)
|
||||
|
||||
ElseIf recessDR("CORNER") = 3 Then
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - squareL)
|
||||
|
||||
'Position
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, squareW - gratingParameters("LOADBAR_THICKNESS"))
|
||||
Else
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
|
||||
|
||||
'Position
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_POS", inst_, squareL - gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_V_EDGEBAR_BOTTOM", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_H_EDGEBAR_POS", inst_, squareW - gratingParameters("LOADBAR_THICKNESS"))
|
||||
End If
|
||||
|
||||
ElseIf recessDR("RECESS TYPE") = "ANGLE" Then
|
||||
inst_ = ExternalClass.instantiate_parts(parentID, "recess_angle", "")
|
||||
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_HEIGHT", inst_, gratingParameters("LOADBAR_HEIGHT"))
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_THICKNESS", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||
|
||||
If recessDR("CORNER") = 1 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 90)
|
||||
|
||||
ElseIf recessDR("CORNER") = 2 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 180)
|
||||
|
||||
ElseIf recessDR("CORNER") = 3 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 270)
|
||||
|
||||
Else
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 0)
|
||||
|
||||
End If
|
||||
|
||||
ElseIf recessDR("RECESS TYPE") = "SIDE SQUARE" Then
|
||||
inst_ = ExternalClass.instantiate_parts(parentID, "recess_side_square", "")
|
||||
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_HEIGHT", inst_, gratingParameters("LOADBAR_HEIGHT"))
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_THICKNESS", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||
|
||||
If recessDR("SIDE") = 1 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("WIDTH") - 2)
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - 2)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, recessDR("OFFSET") - gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 90)
|
||||
|
||||
ElseIf recessDR("SIDE") = 2 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, gratingParameters("WIDTH") - recessDR("OFFSET") + gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 180)
|
||||
|
||||
ElseIf recessDR("SIDE") = 3 Then
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("WIDTH") - 2)
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0 + 2)
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, gratingParameters("LENGTH") - recessDR("OFFSET") + gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 270)
|
||||
|
||||
Else
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH"))
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, recessDR("OFFSET") - gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
|
||||
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, 0)
|
||||
|
||||
End If
|
||||
|
||||
ElseIf recessDR("RECESS TYPE") = "MIDDLE SQUARE" Then
|
||||
inst_ = ExternalClass.instantiate_parts(parentID, "recess_middle_square", "")
|
||||
|
||||
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, recessDR("LENGTH") + gratingParameters("LOADBAR_THICKNESS") * 2)
|
||||
ExternalClass.modify_parameter_value("DP_WIDTH", inst_, recessDR("WIDTH") + gratingParameters("LOADBAR_THICKNESS") * 2)
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_HEIGHT", inst_, gratingParameters("LOADBAR_HEIGHT"))
|
||||
ExternalClass.modify_parameter_value("DP_EDGEBAR_THICKNESS", inst_, gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, recessDR("OFFSET Y") - gratingParameters("LOADBAR_THICKNESS"))
|
||||
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, recessDR("OFFSET X") - gratingParameters("LOADBAR_THICKNESS"))
|
||||
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 boolstatus As Boolean
|
||||
Dim AssemblyExtension As SldWorks.ModelDocExtension
|
||||
|
||||
Dim Assembly = swApp.ActiveDoc
|
||||
Dim SelMgr = Assembly.SelectionManager()
|
||||
AssemblyExtension = Assembly.Extension
|
||||
Dim sldata = SelMgr.CreateSelectData
|
||||
|
||||
Dim swErrors As Integer
|
||||
Dim swWarnings As Integer
|
||||
Dim components = Assembly.GetComponents(True)
|
||||
|
||||
partDT = partModel.selectPart("*")
|
||||
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
' Grating part
|
||||
Dim gratingPartName As String = partDT.Rows(0)("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
Assembly.EditPart
|
||||
|
||||
Dim modelDoc As IModelDoc2
|
||||
modelDoc = Assembly
|
||||
boolstatus = AssemblyExtension.SelectByID2("HorizontalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditSuppress2()
|
||||
boolstatus = AssemblyExtension.SelectByID2("VerticalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditSuppress2()
|
||||
|
||||
Dim indexGrating As Integer
|
||||
For i = 0 To components.Length - 1
|
||||
If components(i).Name2 = gratingPartName & "-1" Then
|
||||
indexGrating = i
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim gratingComponent As SldWorks.Component2 = components(indexGrating)
|
||||
Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
||||
|
||||
Dim recessParts = partDT.Select("parentName = '" & gratingPartName & "'")
|
||||
'Dim recessParts As DataTable = New DataTable
|
||||
'For Each DR As DataRow In partDT.Rows
|
||||
' Dim partName As String = DR("partName")
|
||||
' If partName.Split("_")(0) = "RECESS" Then
|
||||
' recessParts.Rows.Add(DR)
|
||||
' End If
|
||||
'Next
|
||||
|
||||
|
||||
|
||||
Dim recessPartName As String
|
||||
For i = 0 To recessParts.Count - 1
|
||||
Dim partName As String = recessParts(i)("partName")
|
||||
If partName.Split("_")(0) = "RECESS" Then
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
' Recess part
|
||||
recessPartName = partName
|
||||
boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim recessPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
Dim indexRecess As Integer
|
||||
For j = 0 To components.Length - 1
|
||||
If components(j).Name2 = recessPartName & "-1" Then
|
||||
indexRecess = j
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessBodies = components(indexRecess).GetBodies2(0)
|
||||
Dim recessComponent As SldWorks.Component2 = components(indexRecess)
|
||||
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent)
|
||||
|
||||
For j = 0 To bodiesToCut.Length - 1
|
||||
sldata.Mark = 1
|
||||
|
||||
Dim bodyName As String = bodiesToCut(j).Name & "@" & gratingPartName & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
|
||||
Dim indexBody As Integer
|
||||
For k = 0 To recessBodies.Length - 1
|
||||
If recessBodies(k).Name = "Cut-Body" Then
|
||||
indexBody = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessFace = recessBodies(indexBody).GetFirstFace
|
||||
recessFace.Select4(True, sldata)
|
||||
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If gratingParameters("TYPE") = "pressure_welded_serrated" Then
|
||||
For i = 1 To 5
|
||||
boolstatus = AssemblyExtension.SelectByID2("Serrated-Cut" & i & "@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
Next
|
||||
|
||||
ElseIf gratingParameters("TYPE") = "type_a_serrated" Then
|
||||
For i = 1 To 2
|
||||
boolstatus = AssemblyExtension.SelectByID2("Serrated-Cut" & i & "@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Assembly.EditAssembly
|
||||
|
||||
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
|
||||
|
||||
Private Shared Function Check_Interference(comp1 As SldWorks.Component2, comp2 As SldWorks.Component2) ' Test Albins mocro för interference
|
||||
|
||||
Dim swApp As SldWorks.SldWorks
|
||||
Dim swModel As SldWorks.ModelDoc2
|
||||
Dim swAssy As SldWorks.AssemblyDoc
|
||||
Dim CompArray(1) As SldWorks.Component2
|
||||
Dim vCompArray
|
||||
Dim vIntCompArray
|
||||
Dim vIntFaceArray
|
||||
|
||||
Dim interfering
|
||||
|
||||
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||
swModel = swApp.ActiveDoc
|
||||
swAssy = swModel
|
||||
|
||||
CompArray(0) = comp1
|
||||
CompArray(1) = comp2
|
||||
|
||||
vCompArray = CompArray
|
||||
swAssy.ToolsCheckInterference2(2, (vCompArray), interfering, vIntCompArray, vIntFaceArray)
|
||||
|
||||
Dim Bodies(UBound(vIntFaceArray)) As Object
|
||||
Dim BodyNames(UBound(vIntFaceArray)) As String
|
||||
Dim CompNames(UBound(vIntFaceArray)) As String
|
||||
|
||||
For i = 0 To UBound(vIntFaceArray)
|
||||
|
||||
Bodies(i) = vIntFaceArray(i).GetBody
|
||||
BodyNames(i) = Bodies(i).Name
|
||||
CompNames(i) = vIntCompArray(i).Name2
|
||||
|
||||
Next
|
||||
|
||||
Dim gratingName As String = CompNames(0)
|
||||
Dim bodiesToCutList As New List(Of Object)
|
||||
|
||||
bodiesToCutList.Add(Bodies(0))
|
||||
For i = 1 To CompNames.Length - 1
|
||||
|
||||
If CompNames(i) <> gratingName Then
|
||||
Exit For
|
||||
ElseIf BodyNames(i) <> BodyNames(i - 1) Then
|
||||
bodiesToCutList.Add(Bodies(i))
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim bodiesToCut() As Object
|
||||
bodiesToCut = bodiesToCutList.ToArray()
|
||||
|
||||
Return bodiesToCut
|
||||
End Function
|
||||
End Class
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
Public Class Individual_Drawing
|
||||
Private Shared sideCounter As Integer()
|
||||
|
||||
Public Shared Sub Create_Model_For_Drawing()
|
||||
Public Shared Sub Generate_Drawing()
|
||||
Dim pointTable As DataTable
|
||||
pointTable = Data.gratingPoints
|
||||
|
||||
|
|
@ -149,6 +149,7 @@ Public Class Individual_Drawing
|
|||
longstatus = iPart.SaveAs3(newName, 0, 0)
|
||||
|
||||
Model.ClearSelection2(True)
|
||||
|
||||
Create_Drawing(iPart)
|
||||
End Sub
|
||||
|
||||
|
|
@ -330,16 +331,17 @@ Public Class Individual_Drawing
|
|||
Dim skSegment As Object
|
||||
|
||||
swSkMgr.AddToDB = True
|
||||
|
||||
For i = 0 To Draw_Grating.DirSymbolPoints.Count - 1
|
||||
Dim sheetScale = myView.ScaleDecimal
|
||||
For i = 0 To Draw_Grating.DirSymbolPoints.Count - 2
|
||||
Dim x1, x2, y1, y2 As Double
|
||||
x1 = CDbl(CInt(Draw_Grating.DirSymbolPoints(i)(0) - Data.guiPanelMidX) / (30 * viewScale2))
|
||||
y1 = -CDbl(CInt(Draw_Grating.DirSymbolPoints(i)(1) - Data.guiPanelMidY) / (30 * viewScale2))
|
||||
x2 = CDbl(CInt(Draw_Grating.DirSymbolPoints(i + 1)(0) - Data.guiPanelMidX) / (30 * viewScale2))
|
||||
y2 = -CDbl(CInt(Draw_Grating.DirSymbolPoints(i + 1)(1) - Data.guiPanelMidY) / (30 * viewScale2))
|
||||
x1 = CDbl(CInt(Draw_Grating.DirSymbolPoints(i)(0) - Data.guiPanelMidX) / (3000 * sheetScale))
|
||||
y1 = -CDbl(CInt(Draw_Grating.DirSymbolPoints(i)(1) - Data.guiPanelMidY) / (3000 * sheetScale))
|
||||
x2 = CDbl(CInt(Draw_Grating.DirSymbolPoints(i + 1)(0) - Data.guiPanelMidX) / (3000 * sheetScale))
|
||||
y2 = -CDbl(CInt(Draw_Grating.DirSymbolPoints(i + 1)(1) - Data.guiPanelMidY) / (3000 * sheetScale))
|
||||
|
||||
skSegment = swSkMgr.CreateLine(x1, y1, 0, x2, y2, 0)
|
||||
Next
|
||||
|
||||
swSkMgr.AddToDB = False
|
||||
longstatus = iDrawing.SaveAs3(newName, 0, 0)
|
||||
longstatus = iDrawing.SaveAs3(Settings.folderPaths("object_" & Data.objectNum & "_drawings_gratings_pdf") & "\grating_drawing.pdf", 0, 2)
|
||||
|
|
|
|||
|
|
@ -26,12 +26,21 @@ Public Class Instructions
|
|||
status = layMgr.SetCurrentLayer("Svenska")
|
||||
|
||||
Dim drawName As String
|
||||
If withFrame = True Then
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\gratings_assembly_simplified_with_frame.SLDASM"
|
||||
If AppForm.fillMode = True Then
|
||||
If withFrame = True Then
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\gratings_assembly_simplified_with_frame.SLDASM"
|
||||
Else
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\gratings_assembly_simplified.SLDASM"
|
||||
End If
|
||||
Else
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\gratings_assembly_simplified.SLDASM"
|
||||
If withFrame = True Then
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\grating_assembly_simplified_with_frame.SLDASM"
|
||||
Else
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\grating_assembly_simplified.SLDASM"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim myView As View
|
||||
myView = iDrawing.CreateDrawViewFromModelView3(drawName, "*Front", swSheetWidth / 2, swSheetHeight / 2, 0)
|
||||
myView.UseSheetScale() = True
|
||||
|
|
@ -68,9 +77,14 @@ Public Class Instructions
|
|||
vNotes = iDrawing.AutoBalloon5(autoBalloonParams)
|
||||
iDrawing.ClearSelection2(True)
|
||||
|
||||
Dim gratingCounter As Integer = Grating_Fill.numOfHorizontal * Grating_Fill.numOfVertical - Multiple_3D_Simplified.listOfObsolete.Count
|
||||
Dim numOfGratings = 1
|
||||
If AppForm.fillMode = True Then
|
||||
numOfGratings = Grating_Fill.numOfHorizontal * Grating_Fill.numOfVertical - Multiple_3D_Simplified.listOfObsolete.Count
|
||||
End If
|
||||
|
||||
Dim gratingCounter As Integer = numOfGratings
|
||||
For i = vNotes.Length - 1 To 0 Step -1
|
||||
If i < Grating_Fill.numOfHorizontal * Grating_Fill.numOfVertical - Multiple_3D_Simplified.listOfObsolete.Count Then
|
||||
If i < numOfGratings Then
|
||||
Dim noteInfo = vNotes(i).GetLeaderInfo()
|
||||
|
||||
noteAnnotation = vNotes(i).GetAnnotation()
|
||||
|
|
@ -95,100 +109,133 @@ Public Class Instructions
|
|||
End If
|
||||
Next
|
||||
|
||||
Dim straightFrames = Frame_3D.frameDT.Select("TYPE = 'SIDE'")
|
||||
Dim straightFramesDT As New DataTable
|
||||
straightFramesDT.Columns.Add("LENGTH", GetType(Integer))
|
||||
straightFramesDT.Columns.Add("SIDE", GetType(Integer))
|
||||
For i = 1 To 4
|
||||
Dim sideNum = i + 1
|
||||
If sideNum = 5 Then
|
||||
sideNum = 1
|
||||
End If
|
||||
For j = straightFrames.Length - 1 To 0 Step -1
|
||||
Dim DR As DataRow = straightFrames(j)
|
||||
If DR("SIDE") = sideNum Then
|
||||
Dim newDR As DataRow = straightFramesDT.NewRow
|
||||
newDR("LENGTH") = DR("LENGTH")
|
||||
newDR("SIDE") = i
|
||||
straightFramesDT.Rows.Add(newDR)
|
||||
If withFrame = True Then
|
||||
Dim straightFrames = Frame_3D.frameDT.Select("TYPE = 'SIDE'")
|
||||
Dim straightFramesDT As New DataTable
|
||||
straightFramesDT.Columns.Add("LENGTH", GetType(Integer))
|
||||
straightFramesDT.Columns.Add("SIDE", GetType(Integer))
|
||||
For i = 1 To 4
|
||||
Dim sideNum = i + 1
|
||||
If sideNum = 5 Then
|
||||
sideNum = 1
|
||||
End If
|
||||
For j = straightFrames.Length - 1 To 0 Step -1
|
||||
Dim DR As DataRow = straightFrames(j)
|
||||
If DR("SIDE") = sideNum Then
|
||||
Dim newDR As DataRow = straightFramesDT.NewRow
|
||||
newDR("LENGTH") = DR("LENGTH")
|
||||
newDR("SIDE") = i
|
||||
straightFramesDT.Rows.Add(newDR)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim sideOffsets(3) As Double
|
||||
Dim cornerFrames = Frame_3D.frameDT.Select("TYPE = 'CORNER'")
|
||||
For i = 0 To 3
|
||||
Dim cornerFrameExist As Boolean = False
|
||||
For j = 0 To cornerFrames.Length - 1
|
||||
If cornerFrames(j)("CORNER") = i + 1 Then
|
||||
cornerFrameExist = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If cornerFrameExist = True Then
|
||||
sideOffsets(i) = 0.21
|
||||
Else
|
||||
sideOffsets(i) = 0
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
|
||||
Dim sideOffsets(3) As Double
|
||||
Dim cornerFrames = Frame_3D.frameDT.Select("TYPE = 'CORNER'")
|
||||
For i = 0 To 3
|
||||
Dim cornerFrameExist As Boolean = False
|
||||
For j = 0 To cornerFrames.Length
|
||||
If cornerFrames(j)("CORNER") = i + 1 Then
|
||||
cornerFrameExist = True
|
||||
Exit For
|
||||
Dim worldX, worldY, offsetX, offsetY As Double
|
||||
Dim scale As Double = myView.ScaleDecimal
|
||||
For i = 0 To straightFramesDT.Rows.Count - 1
|
||||
If straightFramesDT.Rows(i)("SIDE") = 1 Then
|
||||
worldX = swSheetWidth / 2 + (-(Data.gratingL / 1000) / 2 + sideOffsets(0) + (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(0) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
worldY = swSheetHeight / 2 + ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX - 0.01 - 0.0045
|
||||
offsetY = worldY + 0.02 + 0.0015
|
||||
ElseIf straightFramesDT.Rows(i)("SIDE") = 2 Then
|
||||
worldX = swSheetWidth / 2 + ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2 + ((Data.gratingW / 1000) / 2 - sideOffsets(1) - (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(1) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
offsetX = worldX + 0.02 - 0.0045
|
||||
offsetY = worldY + 0.01 + 0.0015
|
||||
ElseIf straightFramesDT.Rows(i)("SIDE") = 3 Then
|
||||
worldX = swSheetWidth / 2 + ((Data.gratingL / 1000) / 2 - sideOffsets(2) - (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(2) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
worldY = swSheetHeight / 2 - ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX + 0.01 - 0.0045
|
||||
offsetY = worldY - 0.02 + 0.0015
|
||||
Else
|
||||
worldX = swSheetWidth / 2 - ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2 + (-(Data.gratingW / 1000) / 2 + sideOffsets(3) + (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(3) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
offsetX = worldX - 0.02 - 0.0045
|
||||
offsetY = worldY - 0.01 + 0.0015
|
||||
End If
|
||||
|
||||
status = swExtensions.SelectByRay(worldX, worldY, 0, 0, 0, -1, 0.0005, 2, False, 0, 0)
|
||||
|
||||
Dim BomBalloonParams As Object
|
||||
BomBalloonParams = swExtensions.CreateBalloonOptions()
|
||||
BomBalloonParams.Style = 1
|
||||
BomBalloonParams.Size = 3
|
||||
BomBalloonParams.UpperTextContent = 1
|
||||
BomBalloonParams.UpperText = """"
|
||||
BomBalloonParams.ShowQuantity = False
|
||||
BomBalloonParams.QuantityPlacement = 1
|
||||
BomBalloonParams.QuantityDenotationText = "X"
|
||||
BomBalloonParams.QuantityOverride = False
|
||||
Dim myNote = swExtensions.InsertBOMBalloon2(BomBalloonParams)
|
||||
|
||||
noteAnnotation = myNote.GetAnnotation()
|
||||
|
||||
textFormat = noteAnnotation.GetTextFormat(0)
|
||||
textFormat.CharHeight = 0.0025
|
||||
status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
noteAnnotation.SetPosition2(offsetX, offsetY, 0)
|
||||
|
||||
iDrawing.ClearSelection2(True)
|
||||
balloonName = myNote.GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
editedNote = swExtensions.EditBalloonProperties2(1, 3, 0, "F-" & i + 1, 0, "", 0, False, 1, "X", 0.001)
|
||||
Next
|
||||
If cornerFrameExist = True Then
|
||||
sideOffsets(i) = 0.21
|
||||
Else
|
||||
sideOffsets(i) = 0
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
status = layMgr.AddLayer("Symbol", "", 0, 0, 2)
|
||||
status = layMgr.SetCurrentLayer("Symbol")
|
||||
|
||||
Dim swSkMgr As SketchManager
|
||||
swSkMgr = iDrawing.SketchManager
|
||||
status = iDrawing.ActivateSheet("Sheet1")
|
||||
Dim skSegment As Object
|
||||
|
||||
swSkMgr.AddToDB = True
|
||||
Dim sheetProp = swSheet.GetProperties()
|
||||
Dim sheetScale = myView.ScaleDecimal
|
||||
For i = 0 To Draw_Grating.DirSymbolPoints.Count - 2
|
||||
Dim x1, x2, y1, y2 As Double
|
||||
x1 = CDbl((Draw_Grating.DirSymbolPoints(i)(0) - Data.guiPanelMidX) / (2000 * sheetScale)) + (swSheetWidth - 0.05) / sheetScale
|
||||
y1 = -CDbl((Draw_Grating.DirSymbolPoints(i)(1) - Data.guiPanelMidY) / (2000 * sheetScale)) + (swSheetHeight / 2) / sheetScale
|
||||
x2 = CDbl((Draw_Grating.DirSymbolPoints(i + 1)(0) - Data.guiPanelMidX) / (2000 * sheetScale)) + (swSheetWidth - 0.05) / sheetScale
|
||||
y2 = -CDbl((Draw_Grating.DirSymbolPoints(i + 1)(1) - Data.guiPanelMidY) / (2000 * sheetScale)) + (swSheetHeight / 2) / sheetScale
|
||||
|
||||
skSegment = swSkMgr.CreateLine(x1, y1, 0, x2, y2, 0)
|
||||
Next
|
||||
swSkMgr.AddToDB = False
|
||||
|
||||
Dim worldX, worldY, offsetX, offsetY As Double
|
||||
Dim scale As Double = myView.ScaleDecimal
|
||||
For i = 0 To straightFramesDT.Rows.Count - 1
|
||||
If straightFramesDT.Rows(i)("SIDE") = 1 Then
|
||||
worldX = swSheetWidth / 2 + (-(Data.gratingL / 1000) / 2 + sideOffsets(0) + (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(0) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
worldY = swSheetHeight / 2 + ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX - 0.01 - 0.0045
|
||||
offsetY = worldY + 0.02 + 0.0015
|
||||
ElseIf straightFramesDT.Rows(i)("SIDE") = 2 Then
|
||||
worldX = swSheetWidth / 2 + ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2 + ((Data.gratingW / 1000) / 2 - sideOffsets(1) - (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(1) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
offsetX = worldX + 0.02 - 0.0045
|
||||
offsetY = worldY + 0.01 + 0.0015
|
||||
ElseIf straightFramesDT.Rows(i)("SIDE") = 3 Then
|
||||
worldX = swSheetWidth / 2 + ((Data.gratingL / 1000) / 2 - sideOffsets(2) - (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(2) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
worldY = swSheetHeight / 2 - ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX + 0.01 - 0.0045
|
||||
offsetY = worldY - 0.02 + 0.0015
|
||||
Else
|
||||
worldX = swSheetWidth / 2 - ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2 + (-(Data.gratingW / 1000) / 2 + sideOffsets(3) + (straightFramesDT.Rows(i)("LENGTH") / 1000) / 2) * scale
|
||||
sideOffsets(3) += straightFramesDT.Rows(i)("LENGTH") / 1000
|
||||
offsetX = worldX - 0.02 - 0.0045
|
||||
offsetY = worldY - 0.01 + 0.0015
|
||||
End If
|
||||
Dim note = iDrawing.CreateText2("Load Bearing Direction", (swSheetWidth - 0.072), (swSheetHeight / 2 + 0.012), 0, 0.003, 0)
|
||||
|
||||
status = swExtensions.SelectByRay(worldX, worldY, 0, 0, 0, -1, 0.0005, 2, False, 0, 0)
|
||||
|
||||
Dim BomBalloonParams As Object
|
||||
BomBalloonParams = swExtensions.CreateBalloonOptions()
|
||||
BomBalloonParams.Style = 1
|
||||
BomBalloonParams.Size = 3
|
||||
BomBalloonParams.UpperTextContent = 1
|
||||
BomBalloonParams.UpperText = """"
|
||||
BomBalloonParams.ShowQuantity = False
|
||||
BomBalloonParams.QuantityPlacement = 1
|
||||
BomBalloonParams.QuantityDenotationText = "X"
|
||||
BomBalloonParams.QuantityOverride = False
|
||||
Dim myNote = swExtensions.InsertBOMBalloon2(BomBalloonParams)
|
||||
|
||||
noteAnnotation = myNote.GetAnnotation()
|
||||
|
||||
textFormat = noteAnnotation.GetTextFormat(0)
|
||||
textFormat.CharHeight = 0.0025
|
||||
status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
noteAnnotation.SetPosition2(offsetX, offsetY, 0)
|
||||
|
||||
iDrawing.ClearSelection2(True)
|
||||
balloonName = myNote.GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
editedNote = swExtensions.EditBalloonProperties2(1, 3, 0, "F-" & i + 1, 0, "", 0, False, 1, "X", 0.001)
|
||||
Next
|
||||
Dim newName As String
|
||||
newName = Settings.folderPaths("object_" & Data.objectNum & "_guide") & "\assembly_instructions.SLDDRW"
|
||||
|
||||
status = iDrawing.SaveAs3(newName, 0, 0)
|
||||
status = iDrawing.SaveAs3(newName, 0, 2)
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
|
|
|||
|
|
@ -272,18 +272,6 @@ Public Class Multiple_Drawing
|
|||
End If
|
||||
Next
|
||||
|
||||
'recessData.Columns.Add("RECESS TYPE", GetType(String))
|
||||
'recessData.Columns.Add("NAME", GetType(String))
|
||||
'recessData.Columns.Add("CORNER", GetType(Integer))
|
||||
'recessData.Columns.Add("SIDE", GetType(Integer))
|
||||
'recessData.Columns.Add("WIDTH", GetType(Integer))
|
||||
'recessData.Columns.Add("LENGTH", GetType(Integer))
|
||||
'recessData.Columns.Add("OFFSET", GetType(Integer))
|
||||
'recessData.Columns.Add("OFFSET X", GetType(Integer))
|
||||
'recessData.Columns.Add("OFFSET Y", GetType(Integer))
|
||||
'recessData.Columns.Add("GRATINGS", GetType(List(Of Integer)))
|
||||
|
||||
|
||||
' -- Loop Horizontal --
|
||||
For i = 0 To Grating_Fill.numOfHorizontal - 1
|
||||
status = False
|
||||
|
|
@ -387,19 +375,19 @@ Public Class Multiple_Drawing
|
|||
|
||||
swSkMgr.AddToDB = True
|
||||
Dim sheetProp = swSheet.GetProperties()
|
||||
Dim sheetScale = sheetProp(3)
|
||||
Dim sheetScale = myView.ScaleDecimal
|
||||
For i = 0 To Draw_Grating.DirSymbolPoints.Count - 2
|
||||
Dim x1, x2, y1, y2 As Double
|
||||
x1 = CDbl((Draw_Grating.DirSymbolPoints(i)(0) - Data.guiPanelMidX) / 200) + (swSheetWidth - 0.05) * sheetScale
|
||||
y1 = -CDbl((Draw_Grating.DirSymbolPoints(i)(1) - Data.guiPanelMidY) / 200) + (swSheetHeight / 2) * sheetScale
|
||||
x2 = CDbl((Draw_Grating.DirSymbolPoints(i + 1)(0) - Data.guiPanelMidX) / 200) + (swSheetWidth - 0.05) * sheetScale
|
||||
y2 = -CDbl((Draw_Grating.DirSymbolPoints(i + 1)(1) - Data.guiPanelMidY) / 200) + (swSheetHeight / 2) * sheetScale
|
||||
x1 = CDbl((Draw_Grating.DirSymbolPoints(i)(0) - Data.guiPanelMidX) / (2000 * sheetScale)) + (swSheetWidth - 0.05) / sheetScale
|
||||
y1 = -CDbl((Draw_Grating.DirSymbolPoints(i)(1) - Data.guiPanelMidY) / (2000 * sheetScale)) + (swSheetHeight / 2) / sheetScale
|
||||
x2 = CDbl((Draw_Grating.DirSymbolPoints(i + 1)(0) - Data.guiPanelMidX) / (2000 * sheetScale)) + (swSheetWidth - 0.05) / sheetScale
|
||||
y2 = -CDbl((Draw_Grating.DirSymbolPoints(i + 1)(1) - Data.guiPanelMidY) / (2000 * sheetScale)) + (swSheetHeight / 2) / sheetScale
|
||||
|
||||
skSegment = swSkMgr.CreateLine(x1, y1, 0, x2, y2, 0)
|
||||
Next
|
||||
swSkMgr.AddToDB = False
|
||||
|
||||
Dim note = iDrawing.CreateText2("Load Bearing Direction", (swSheetWidth - 0.075), (swSheetHeight / 2 + 0.012), 0, 0.003, 0)
|
||||
Dim note = iDrawing.CreateText2("Load Bearing Direction", (swSheetWidth - 0.072), (swSheetHeight / 2 + 0.012), 0, 0.003, 0)
|
||||
|
||||
|
||||
status = swExtensions.SelectByID2(myView.GetName2, "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@
|
|||
<Compile Include="Recess Functions\Corner_Rectangle.vb" />
|
||||
<Compile Include="Recess Functions\Middle_Rectangle.vb" />
|
||||
<Compile Include="Recess Functions\Side_Rectangle.vb" />
|
||||
<Compile Include="SolidWorks\Individual_3D_Simplified.vb" />
|
||||
<Compile Include="SolidWorks\Individual_Drawing.vb" />
|
||||
<Compile Include="SolidWorks\Frame_3D.vb" />
|
||||
<Compile Include="SolidWorks\Frame_Drawing.vb" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue