Instructions for assembly
This commit is contained in:
parent
ef31a0ea5d
commit
33249bc55c
|
|
@ -322,7 +322,11 @@ Public Class Individual
|
|||
If User_Input.addFrame = True AndAlso simplifiedWithFrameCreated = False Then
|
||||
Multiple_3D_Simplified.Build_Grid(True)
|
||||
End If
|
||||
'Skapa drawing filen här
|
||||
If User_Input.addFrame = True Then
|
||||
Instructions.Generate_Instructions(True)
|
||||
Else
|
||||
Instructions.Generate_Instructions(False)
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ Public Class Frame_Drawing
|
|||
If j < Frame_3D.cuttingList.ElementAt(i).Value.Count Then
|
||||
balloonStyle = 1
|
||||
balloonOffset = 0.01
|
||||
balloonText = Frame_3D.cuttingList.ElementAt(i).Value(j)
|
||||
balloonText = "F-" & Frame_3D.cuttingList.ElementAt(i).Value(j)
|
||||
Else
|
||||
balloonStyle = 0
|
||||
balloonOffset = -0.03
|
||||
|
|
@ -188,7 +188,7 @@ Public Class Frame_Drawing
|
|||
Dim BomBalloonParams As Object
|
||||
BomBalloonParams = swExtensions.CreateBalloonOptions()
|
||||
BomBalloonParams.Style = balloonStyle
|
||||
BomBalloonParams.Size = 2
|
||||
BomBalloonParams.Size = 3
|
||||
BomBalloonParams.UpperTextContent = 1
|
||||
BomBalloonParams.UpperText = """"
|
||||
BomBalloonParams.ShowQuantity = False
|
||||
|
|
@ -201,10 +201,14 @@ Public Class Frame_Drawing
|
|||
noteAnnotation = myNote.GetAnnotation()
|
||||
noteAnnotation.SetPosition2(worldX + balloonOffset, 0.13, 0)
|
||||
|
||||
Dim textFormat = noteAnnotation.GetTextFormat(0)
|
||||
textFormat.CharHeight = 0.0025
|
||||
status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
iDrawing.ClearSelection2(True)
|
||||
Dim balloonName As String = myNote.GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@Drawing View" & i + 1, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim editedNote = swExtensions.EditBalloonProperties2(balloonStyle, 2, 0, balloonText, 0, "", 0, False, 1, "X", 0.001)
|
||||
Dim editedNote = swExtensions.EditBalloonProperties2(balloonStyle, 3, 0, balloonText, 0, "", 0, False, 1, "X", 0.001)
|
||||
Next
|
||||
Next
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,178 @@
|
|||
Imports SldWorks
|
||||
Public Class Instructions
|
||||
Public Shared Sub Generate_Instructions(withFrame As Boolean)
|
||||
Dim swApp As SldWorks.SldWorks
|
||||
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||
|
||||
Dim status As Boolean
|
||||
|
||||
Dim iDrawing As DrawingDoc
|
||||
Dim swSheetWidth As Double
|
||||
swSheetWidth = 0.42
|
||||
Dim swSheetHeight As Double
|
||||
swSheetHeight = 0.297
|
||||
iDrawing = swApp.NewDocument("C:\ProgramData\SolidWorks\SOLIDWORKS 2020\templates\Drawing.drwdot", 12, swSheetWidth, swSheetHeight)
|
||||
|
||||
Dim swSheet As Sheet
|
||||
swSheet = iDrawing.GetCurrentSheet()
|
||||
swSheet.SetProperties2(12, 12, 1, 1, False, swSheetWidth, swSheetHeight, True)
|
||||
swSheet.SetTemplateName(Settings.HLCtFolder & "\Files Needed\A3 Part.slddrt")
|
||||
swSheet.ReloadTemplate(True)
|
||||
swSheet.SetScale(1, 10, False, False) ' FIXA
|
||||
swSheet.SetName("Instructions")
|
||||
|
||||
Dim layMgr As LayerMgr
|
||||
layMgr = iDrawing.GetLayerManager()
|
||||
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"
|
||||
Else
|
||||
drawName = Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\gratings_assembly_simplified.SLDASM"
|
||||
End If
|
||||
|
||||
Dim myView As View
|
||||
myView = iDrawing.CreateDrawViewFromModelView3(drawName, "*Front", swSheetWidth / 2, swSheetHeight / 2, 0)
|
||||
myView.UseSheetScale() = True
|
||||
myView.SetDisplayTangentEdges2(2)
|
||||
|
||||
Dim swExtensions As SldWorks.ModelDocExtension
|
||||
swExtensions = iDrawing.Extension
|
||||
Dim RootComp = myView.RootDrawingComponent
|
||||
Dim CompName = RootComp.Name
|
||||
|
||||
Dim OutLine = myView.GetOutline
|
||||
Dim noteAnnotation As IAnnotation
|
||||
Dim textFormat As Object
|
||||
Dim balloonName As String
|
||||
Dim editedNote As Object
|
||||
|
||||
'Gratings
|
||||
status = swExtensions.SelectByID2(myView.GetName2, "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim vNotes As Object
|
||||
Dim autoBalloonParams As Object
|
||||
autoBalloonParams = iDrawing.CreateAutoBalloonOptions()
|
||||
autoBalloonParams.Layout = 1
|
||||
autoBalloonParams.ReverseDirection = False
|
||||
autoBalloonParams.IgnoreMultiple = True
|
||||
autoBalloonParams.InsertMagneticLine = False
|
||||
autoBalloonParams.LeaderAttachmentToFaces = True
|
||||
autoBalloonParams.Style = 1
|
||||
autoBalloonParams.Size = 3
|
||||
autoBalloonParams.EditBalloonOption = 1
|
||||
autoBalloonParams.EditBalloons = 1
|
||||
autoBalloonParams.UpperTextContent = 1
|
||||
autoBalloonParams.UpperText = """"
|
||||
autoBalloonParams.Layername = "Symbol"
|
||||
vNotes = iDrawing.AutoBalloon5(autoBalloonParams)
|
||||
iDrawing.ClearSelection2(True)
|
||||
|
||||
Dim gratingCounter As Integer = Grating_Fill.numOfHorizontal * Grating_Fill.numOfVertical - Multiple_3D_Simplified.listOfObsolete.Count
|
||||
For i = vNotes.Length - 1 To 0 Step -1
|
||||
If i < Grating_Fill.numOfHorizontal * Grating_Fill.numOfVertical - Multiple_3D_Simplified.listOfObsolete.Count Then
|
||||
Dim noteInfo = vNotes(i).GetLeaderInfo()
|
||||
|
||||
noteAnnotation = vNotes(i).GetAnnotation()
|
||||
noteAnnotation.SetPosition2(noteInfo(3), noteInfo(4), 0)
|
||||
noteAnnotation.SetLeader3(0, 1, False, False, False, False)
|
||||
textFormat = noteAnnotation.GetTextFormat(0)
|
||||
textFormat.CharHeight = 0.0025
|
||||
status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
|
||||
iDrawing.ClearSelection2(True)
|
||||
balloonName = vNotes(i).GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
editedNote = swExtensions.EditBalloonProperties2(1, 3, 0, "G-" & gratingCounter, 0, "", 0, False, 1, "X", 0.001)
|
||||
gratingCounter -= 1
|
||||
|
||||
Else
|
||||
iDrawing.ClearSelection2(True)
|
||||
balloonName = vNotes(i).GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
iDrawing.EditDelete
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim straightFrames = Frame_3D.frameDT.Select("TYPE = 'SIDE'")
|
||||
Dim worldX As Double
|
||||
Dim worldY As Double
|
||||
Dim offsetX As Double
|
||||
Dim offsetY As Double
|
||||
Dim scale As Double = myView.ScaleDecimal
|
||||
For i = 0 To straightFrames.Length - 1
|
||||
If straightFrames(i)("SIDE") = 1 Then
|
||||
worldX = swSheetWidth / 2
|
||||
worldY = swSheetHeight / 2 + ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX - 0.01 - 0.0045
|
||||
offsetY = worldY + 0.015 + 0.0015
|
||||
ElseIf straightFrames(i)("SIDE") = 2 Then
|
||||
worldX = swSheetWidth / 2 + ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2
|
||||
offsetX = worldX + 0.015 - 0.0045
|
||||
offsetY = worldY + 0.01 + 0.0015
|
||||
ElseIf straightFrames(i)("SIDE") = 3 Then
|
||||
worldX = swSheetWidth / 2
|
||||
worldY = swSheetHeight / 2 - ((Data.gratingW / 1000) / 2 + 0.001) * scale
|
||||
offsetX = worldX + 0.01 - 0.0045
|
||||
offsetY = worldY - 0.015 + 0.0015
|
||||
Else
|
||||
worldX = swSheetWidth / 2 - ((Data.gratingL / 1000) / 2 + 0.001) * scale
|
||||
worldY = swSheetHeight / 2
|
||||
offsetX = worldX - 0.015 - 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
|
||||
|
||||
'Frame_3D.frameDT()
|
||||
'DT.Columns.Add("TYPE", GetType(String))
|
||||
'DT.Columns.Add("LENGTH", GetType(Integer))
|
||||
'DT.Columns.Add("SIDE", GetType(Integer))
|
||||
'DT.Columns.Add("CORNER", GetType(Integer))
|
||||
'DT.Columns.Add("ROTATION", GetType(Integer))
|
||||
'DT.Columns.Add("OFFSET_W", GetType(Integer))
|
||||
'DT.Columns.Add("OFFSET_L", GetType(Integer))
|
||||
|
||||
'noteAnnotation = myNote.GetAnnotation()
|
||||
'noteAnnotation.SetPosition2(worldX + 0.01, 0.13, 0)
|
||||
|
||||
'textFormat = noteAnnotation.GetTextFormat(0)
|
||||
'textFormat.CharHeight = 0.0025
|
||||
'status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
'iDrawing.ClearSelection2(True)
|
||||
'balloonName = myNote.GetName()
|
||||
'status = swExtensions.SelectByID2(balloonName & "@Drawing View" & i + 1, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
'editedNote = swExtensions.EditBalloonProperties2(1, 3, 0, "F-" & Frame_3D.cuttingList.ElementAt(i).Value(j), 0, "", 0, False, 1, "X", 0.001)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Public Class Multiple_3D
|
|||
Dim Errors As Integer
|
||||
Dim Warnings As Integer
|
||||
status = swExtensions.SaveAs2(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw") & "\gratings_assembly.SLDASM",
|
||||
0, 4, Nothing, "", True, Errors, Warnings)
|
||||
0, 4, Nothing, "", True, Errors, Warnings) 'FIXA
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
|
||||
|
|
@ -464,6 +464,7 @@ Public Class Multiple_3D
|
|||
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Assembly.EditDelete
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Function Find_Obsolete()
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ Public Class Multiple_Drawing
|
|||
autoBalloonParams.InsertMagneticLine = False
|
||||
autoBalloonParams.LeaderAttachmentToFaces = True
|
||||
autoBalloonParams.Style = 1
|
||||
autoBalloonParams.Size = 2
|
||||
autoBalloonParams.Size = 3
|
||||
autoBalloonParams.EditBalloonOption = 1
|
||||
autoBalloonParams.EditBalloons = 1
|
||||
autoBalloonParams.UpperTextContent = 1
|
||||
|
|
@ -428,11 +428,15 @@ Public Class Multiple_Drawing
|
|||
noteAnnotation = vNotes(i).GetAnnotation()
|
||||
noteAnnotation.SetPosition2(noteInfo(3), noteInfo(4), 0)
|
||||
noteAnnotation.SetLeader3(0, 1, False, False, False, False)
|
||||
Dim textFormat = noteAnnotation.GetTextFormat(0)
|
||||
textFormat.CharHeight = 0.0025
|
||||
status = noteAnnotation.SetTextFormat(0, False, textFormat)
|
||||
|
||||
|
||||
iDrawing.ClearSelection2(True)
|
||||
Dim balloonName As String = vNotes(i).GetName()
|
||||
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim editedNote = swExtensions.EditBalloonProperties2(1, 2, 0, gratingCounter, 0, "", 0, False, 1, "X", 0.001)
|
||||
Dim editedNote = swExtensions.EditBalloonProperties2(1, 3, 0, "G-" & gratingCounter, 0, "", 0, False, 1, "X", 0.001)
|
||||
gratingCounter += 1
|
||||
Next
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue