467 lines
24 KiB
VB.net
467 lines
24 KiB
VB.net
Imports SldWorks
|
|
Public Class Multiple_Drawing
|
|
Public Shared Sub Generate_Drawing()
|
|
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)
|
|
swSheet.SetName("Assembly")
|
|
|
|
Dim layMgr As LayerMgr
|
|
layMgr = iDrawing.GetLayerManager()
|
|
status = layMgr.SetCurrentLayer("Svenska")
|
|
|
|
Dim adjustedHeightPosInSheet As Double = swSheetHeight / 2 + 0.02
|
|
|
|
Dim myView As View
|
|
myView = iDrawing.CreateDrawViewFromModelView3(Settings.folderPaths("object_" & Data.objectNum & "_models3D_gratings_sw_support") & "\GRATINGS_ASSEMBLY_SIMPLIFIED.SLDASM",
|
|
"*Front", swSheetWidth / 2, adjustedHeightPosInSheet, 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 modelsDT As DataTable = Multiple_3D_Simplified.partDT
|
|
Dim gratingName, plane1Name, plane2Name As String
|
|
Dim counter As Integer
|
|
Dim measurement As IDisplayDimension
|
|
|
|
Dim mesOffsets(3) As Double
|
|
mesOffsets(0) = OutLine(3) + 0.005
|
|
mesOffsets(1) = OutLine(2) + 0.005
|
|
mesOffsets(2) = OutLine(1) - 0.005
|
|
mesOffsets(3) = OutLine(0) - 0.005
|
|
|
|
' -- Recess measurements --
|
|
Dim recessDT = modelsDT.Select("parentName = '" & modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1))("partName") & "'")
|
|
For i = 0 To Data.recessData.Rows.Count - 1
|
|
Dim DR As DataRow = Data.recessData.Rows(i)
|
|
Dim recessName As String = recessDT(i)("partName")
|
|
|
|
If DR("RECESS TYPE") = "ANGLE" Then
|
|
If DR("CORNER") = 1 Then
|
|
'A = horizontal uppåt, B = Veritcal vänster
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(0) += 0.01
|
|
Create_Measurement("Point1@SB", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(3) -= 0.01
|
|
|
|
ElseIf DR("CORNER") = 2 Then
|
|
'A = Veritcal höger, B = horizontal uppåt
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
Create_Measurement("Point1@SB", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(0) += 0.01
|
|
|
|
ElseIf DR("CORNER") = 3 Then
|
|
'A = horizontal nedåt, B = Veritcal höger
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
Create_Measurement("Point1@SB", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
Else
|
|
'A = Veritcal vänster, B = horizontal nedåt
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(3) -= 0.01
|
|
Create_Measurement("Point1@SB", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
End If
|
|
|
|
ElseIf DR("RECESS TYPE") = "SQUARE" Then
|
|
If DR("CORNER") = 1 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@S2A", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(3) -= 0.01
|
|
Create_Measurement("Point1@S2B", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(0) += 0.01
|
|
|
|
ElseIf DR("CORNER") = 2 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@S1A", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
Create_Measurement("Point1@S2B", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(0) += 0.01
|
|
|
|
ElseIf DR("CORNER") = 3 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@S1A", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
Create_Measurement("Point1@S1B", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
Else
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@S2A", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(3) -= 0.01
|
|
Create_Measurement("Point1@S1B", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
End If
|
|
|
|
ElseIf DR("RECESS TYPE") = "SIDE SQUARE" Then
|
|
If DR("SIDE") = 1 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing) '
|
|
Create_Measurement("Point1@SB", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal - 1 + counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SA2@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0)
|
|
mesOffsets(0) += 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
|
|
ElseIf DR("SIDE") = 2 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
Create_Measurement("Point1@SB", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * Calculate_Fill_Grid.numOfVertical - 1 - counter)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SA2@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffsets(1), 0, 0)
|
|
mesOffsets(1) += 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
|
|
ElseIf DR("SIDE") = 3 Then
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
Create_Measurement("Point1@SB", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(1) += 0.01
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * Calculate_Fill_Grid.numOfVertical - 1 - counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SA1@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(2), 0)
|
|
mesOffsets(2) -= 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
Else
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing)
|
|
Create_Measurement("Point1@SB", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
mesOffsets(2) -= 0.01
|
|
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1) + counter)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SA1@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0)
|
|
mesOffsets(3) -= 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
End If
|
|
|
|
|
|
ElseIf DR("RECESS TYPE") = "MIDDLE SQUARE" Then
|
|
|
|
iDrawing.ClearSelection2(True)
|
|
Create_Measurement("Point1@SA", True, mesOffsets(1), CompName, myView, recessName, swExtensions, iDrawing)
|
|
Create_Measurement("Point1@SB", False, mesOffsets(2), CompName, myView, recessName, swExtensions, iDrawing)
|
|
|
|
|
|
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * Calculate_Fill_Grid.numOfVertical - 1 - counter)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SA1@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffsets(1), 0, 0)
|
|
mesOffsets(1) += 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * Calculate_Fill_Grid.numOfVertical - 1 - counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
plane1Name = "Point1@SB2@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(2), 0)
|
|
mesOffsets(2) -= 0.01
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
|
|
|
|
End If
|
|
Next
|
|
|
|
' -- Loop Horizontal --
|
|
For i = 1 To Calculate_Fill_Grid.numOfHorizontal
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & i + counter * Calculate_Fill_Grid.numOfHorizontal
|
|
iDrawing.ClearSelection2(True)
|
|
plane1Name = "Point1@SL1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0)
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
Next
|
|
mesOffsets(0) += 0.01
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter * Calculate_Fill_Grid.numOfHorizontal + 1
|
|
iDrawing.ClearSelection2(True)
|
|
plane1Name = "Point1@SL1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
status = False
|
|
counter = 0
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal + counter * Calculate_Fill_Grid.numOfHorizontal
|
|
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0)
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
measurement.ShowParenthesis = True
|
|
|
|
' -- Loop Vertical --
|
|
For i = 0 To Calculate_Fill_Grid.numOfVertical - 1
|
|
status = False
|
|
counter = 1
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & i * Calculate_Fill_Grid.numOfHorizontal + counter
|
|
iDrawing.ClearSelection2(True)
|
|
plane1Name = "Point1@SW1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0)
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
Next
|
|
mesOffsets(3) -= 0.01
|
|
|
|
status = False
|
|
counter = 1
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter
|
|
iDrawing.ClearSelection2(True)
|
|
plane1Name = "Point1@SW1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
status = False
|
|
counter = 1
|
|
While status = False
|
|
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1) + counter
|
|
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
counter += 1
|
|
End While
|
|
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0)
|
|
iDrawing.ClearSelection2(True)
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
measurement.ShowParenthesis = True
|
|
|
|
|
|
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 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)
|
|
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 = 1
|
|
For i = 0 To vNotes.Length - 1
|
|
Dim noteInfo = vNotes(i).GetLeaderInfo()
|
|
Dim noteAnnotation As IAnnotation
|
|
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, 3, 0, "G-" & gratingCounter, 0, "", 0, False, 1, "X", 0.001)
|
|
gratingCounter += 1
|
|
Next
|
|
|
|
Dim newName As String
|
|
newName = Settings.folderPaths("object_" & Data.objectNum & "_drawings_gratings_sw") & "\grating_drawing.SLDDRW"
|
|
|
|
status = iDrawing.SaveAs3(newName, 0, 0)
|
|
status = iDrawing.SaveAs3(Settings.folderPaths("object_" & Data.objectNum & "_drawings_gratings_pdf") & "\grating_drawing.pdf", 0, 2)
|
|
|
|
End Sub
|
|
|
|
Private Shared Sub Create_Measurement(mesName As String, verticalDim As Boolean, mesOffset As Double, CompName As String, myView As View,
|
|
recessName As String, swExtensions As SldWorks.ModelDocExtension, iDrawing As DrawingDoc)
|
|
Dim status As Boolean
|
|
Dim plane1Name As String = mesName & "1@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
|
|
Dim plane2Name As String = mesName & "2@" & CompName & "@" & myView.GetName2 & "/" & recessName & "-1@" & CompName.Split("-")(0)
|
|
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
|
|
|
|
Dim measurement As IDisplayDimension
|
|
If verticalDim = True Then
|
|
measurement = iDrawing.AddVerticalDimension2(mesOffset, 0, 0)
|
|
Else
|
|
measurement = iDrawing.AddHorizontalDimension2(0, mesOffset, 0)
|
|
End If
|
|
|
|
Set_MeasurementProperties(measurement)
|
|
End Sub
|
|
Private Shared Sub Set_MeasurementProperties(measurement As IDisplayDimension)
|
|
measurement.SetUnits2(False, 0, 1, 0, True, 12)
|
|
measurement.CenterText = True
|
|
measurement.SetPrecision3(0, 0, 0, 0)
|
|
measurement.OffsetText = True
|
|
measurement.OffsetText = False ' Helps center the text
|
|
End Sub
|
|
|
|
End Class
|