diff --git a/Wardrobe/SolidWorks/Individual_Drawing.vb b/Wardrobe/SolidWorks/Individual_Drawing.vb index 2b79ff8..a55bcd9 100644 --- a/Wardrobe/SolidWorks/Individual_Drawing.vb +++ b/Wardrobe/SolidWorks/Individual_Drawing.vb @@ -361,7 +361,6 @@ Public Class Individual_Drawing point2NameSW = "Point" & points(1) & "@Sketch1@" & CompName & "@" & myView.GetName2 End If - iDrawing.ClearSelection2(True) swExtensions.SelectByID2(point1NameSW, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0) @@ -379,8 +378,8 @@ Public Class Individual_Drawing Else point1 = Data.gratingPoints.Rows(points(0) - 1)("X") point2 = Data.gratingPoints.Rows(points(1) - 1)("X") - End If + Dim xPos As Double If Math.Abs(point1) > Math.Abs(point2) Then xPos = point2 + (point1 - point2) / 2 @@ -404,7 +403,6 @@ Public Class Individual_Drawing Else point1 = Data.gratingPoints.Rows(points(0) - 1)("Y") point2 = Data.gratingPoints.Rows(points(1) - 1)("Y") - End If Dim yPos As Double @@ -423,7 +421,6 @@ Public Class Individual_Drawing sideCounter(points(2) - 1) = sideCounter(points(2) - 1) + 1 iDrawing.ClearSelection2(True) - 'measurement.SetWitnessLineGap(1, True, 0.001) ' For break dimension line measurement.SetUnits2(False, 0, 1, 0, True, 12) measurement.CenterText = True measurement.SetPrecision3(0, 0, 0, 0) diff --git a/Wardrobe/SolidWorks/Multiple_Drawing.vb b/Wardrobe/SolidWorks/Multiple_Drawing.vb index 65be093..0ac89af 100644 --- a/Wardrobe/SolidWorks/Multiple_Drawing.vb +++ b/Wardrobe/SolidWorks/Multiple_Drawing.vb @@ -42,6 +42,63 @@ Public Class Multiple_Drawing 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(Grating_Fill.numOfHorizontal * (Grating_Fill.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("A", False, mesOffsets(0), CompName, myView, recessName, swExtensions, iDrawing) + mesOffsets(0) += 0.01 + Create_Measurement("B", True, mesOffsets(3), CompName, myView, recessName, swExtensions, iDrawing) + mesOffsets(3) -= 0.01 + + 'FORSÄTT HÄR!!! + + ElseIf DR("CORNER") = 2 Then + 'A = Veritcal höger, B = horizontal uppåt + ElseIf DR("CORNER") = 3 Then + 'A = horizontal nedåt, B = Veritcal höger + Else + 'A = Veritcal vänster, B = horizontal nedåt + End If + + + + + + ElseIf DR("RECESS TYPE") = "SQUARE" Then + + ElseIf DR("RECESS TYPE") = "SIDE SQUARE" Then + + ElseIf DR("RECESS TYPE") = "MIDDLE SQUARE" Then + + 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 @@ -56,15 +113,12 @@ Public Class Multiple_Drawing counter += 1 End While - measurement = iDrawing.AddHorizontalDimension2(0, OutLine(3) + 0.005, 0) - + measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0) iDrawing.ClearSelection2(True) - 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 + + Set_MeasurementProperties(measurement) Next + mesOffsets(0) += 0.01 status = False counter = 0 @@ -85,14 +139,10 @@ Public Class Multiple_Drawing counter += 1 End While - measurement = iDrawing.AddHorizontalDimension2(0, OutLine(3) + 0.005 + 0.01, 0) + measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0) + iDrawing.ClearSelection2(True) - measurement.SetUnits2(False, 0, 1, 0, True, 12) - measurement.CenterText = True - measurement.SetPrecision3(0, 0, 0, 0) - measurement.ShowParenthesis = True - measurement.OffsetText = True - measurement.OffsetText = False + Set_MeasurementProperties(measurement) ' -- Loop Vertical -- For i = 0 To Grating_Fill.numOfVertical - 1 @@ -108,15 +158,12 @@ Public Class Multiple_Drawing counter += 1 End While - measurement = iDrawing.AddVerticalDimension2(OutLine(0) - 0.005, 0, 0) - + measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0) iDrawing.ClearSelection2(True) - 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 + + Set_MeasurementProperties(measurement) Next + mesOffsets(3) -= 0.01 status = False counter = 0 @@ -137,22 +184,40 @@ Public Class Multiple_Drawing counter += 1 End While - measurement = iDrawing.AddVerticalDimension2(OutLine(0) - 0.005 - 0.01, 0, 0) + measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0) + iDrawing.ClearSelection2(True) - measurement.SetUnits2(False, 0, 1, 0, True, 12) - measurement.CenterText = True - measurement.SetPrecision3(0, 0, 0, 0) - measurement.ShowParenthesis = True - measurement.OffsetText = True - measurement.OffsetText = False + Set_MeasurementProperties(measurement) Dim a = 1 + 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, "PLANE", 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, "PLANE", 0, 0, 0, True, 0, Nothing, 0) + Dim measurement As IDisplayDimension + If verticalDim = True Then + measurement = iDrawing.AddVerticalDimension2(0, mesOffset, 0) + Else + measurement = iDrawing.AddHorizontalDimension2(mesOffset, 0, 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