Continue work for support beams and other small fixes

This commit is contained in:
Anton 2021-04-28 16:01:56 +02:00
parent 6ebfdf707b
commit 8f1aa2a5c5
9 changed files with 343 additions and 84 deletions

Binary file not shown.

Binary file not shown.

View File

@ -299,13 +299,14 @@
'Support beams
Dim supportPen As Pen = New Pen(Color.LightPink, 4)
For i = 0 To Calculate_Fill_Grid.supportBeamsDT.Rows.Count - 1
Dim x As Integer = Data.grossAreaPoints.Rows(0)("GUI X") + Calculate_Fill_Grid.supportBeamsDT.Rows(i)("GLOBAL_OFFSET") / Data.scaleDiff
Dim y1 As Integer = Data.grossAreaPoints.Rows(0)("GUI Y")
Dim y2 As Integer = Data.grossAreaPoints.Rows(3)("GUI Y")
g.DrawLine(supportPen, x, y1, x, y2)
If Calculate_Fill_Grid.supportBeamsDT.Rows(i)("TYPE") = "Extra" Then
Dim x As Integer = Data.grossAreaPoints.Rows(0)("GUI X") + Calculate_Fill_Grid.supportBeamsDT.Rows(i)("GLOBAL_OFFSET") / Data.scaleDiff
Dim y1 As Integer = Data.grossAreaPoints.Rows(0)("GUI Y")
Dim y2 As Integer = Data.grossAreaPoints.Rows(3)("GUI Y")
g.DrawLine(supportPen, x, y1, x, y2)
End If
Next
End If
End Sub
End Class

View File

@ -304,8 +304,10 @@ Public Class Individual
frameCreated = True
End If
Dim simplifiedCreated As Boolean = False
If User_Input.addGratingDrawing = True Then
Multiple_3D_Simplified.Build_Grid(False)
simplifiedCreated = True
Multiple_Drawing.Generate_Drawing()
End If
@ -330,15 +332,15 @@ Public Class Individual
Multiple_3D_Simplified.Build_Grid(True)
ElseIf simplifiedWithFrameCreated = False Then
Multiple_3D_Simplified.Build_Grid(False)
simplifiedCreated = True
End If
If User_Input.addFrame = True Then
Instructions.Generate_Instructions(True)
Else
Instructions.Generate_Instructions(False)
If simplifiedCreated = False Then
Multiple_3D_Simplified.Build_Grid(False)
End If
Instructions.Generate_Instructions(User_Input.addFrame)
End If
Else
Dim frameCreated As Boolean = False
If User_Input.add3DGrating = True Then
Individual_3D.BuildGrating()
@ -365,19 +367,19 @@ Public Class Individual
Next
End If
Dim simplifiedCreated As Boolean = False
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)
simplifiedCreated = True
End If
If User_Input.addFrame = True Then
Instructions.Generate_Instructions(True)
Else
Instructions.Generate_Instructions(False)
If simplifiedCreated = False Then
Multiple_3D_Simplified.Build_Grid(False)
End If
Instructions.Generate_Instructions(User_Input.addFrame)
End If
End If
End Sub

View File

@ -16,6 +16,7 @@
Fill_Dimension_DT()
Get_Grid_Beams()
Calculate_Support_Beams()
Individual.Panel_Grating.Refresh()
@ -183,20 +184,10 @@
' Jämför med längd
If Math.Floor((gratingLength + 1) / maxUnsupportedLenght) < 1 Then '+1 för att floor inte kan hantera jämna tal
withSupportBeam = False
Return
End If
withSupportBeam = True
' Definera support beams
supportBeamsDT.Clear()
supportBeamsDT.Columns.Clear()
supportBeamsDT.Columns.Add("COLUMN", GetType(Integer))
supportBeamsDT.Columns.Add("COLUMN_OFFSET", GetType(Integer))
supportBeamsDT.Columns.Add("GLOBAL_OFFSET", GetType(Integer))
supportBeamsDT.Columns.Add("LENGTH", GetType(Integer))
supportBeamsDT.Columns.Add("OFFSET_TOP", GetType(Integer))
supportBeamsDT.Columns.Add("OFFSET_BOTTOM", GetType(Integer))
For i = 0 To numOfHorizontal - 1
Dim gratingL As Integer = gratingDimensionsDT.Rows(i)("LENGTH")
Dim numOfBeamsNeeded As Integer = Math.Floor((gratingL + 1) / maxUnsupportedLenght)
@ -205,22 +196,73 @@
For j = 1 To numOfBeamsNeeded
Dim tempDR As DataRow = supportBeamsDT.NewRow
tempDR("INDEX") = supportBeamsDT.Rows.Count + 1
tempDR("TYPE") = "Extra"
tempDR("COLUMN") = i
tempDR("COLUMN_OFFSET") = j * beamSpacing
tempDR("GLOBAL_OFFSET") = gratingLength * i + tempDR("COLUMN_OFFSET")
tempDR("LENGTH") = Data.gratingW
tempDR("OFFSET_TOP") = 0
tempDR("OFFSET_BOTTOM") = 0
tempDR("ROTATION") = 0
supportBeamsDT.Rows.Add(tempDR)
Next
End If
Next
End Sub
Private Shared Sub Get_Grid_Beams()
withSupportBeam = False
supportBeamsDT.Clear()
supportBeamsDT.Columns.Clear()
supportBeamsDT.Columns.Add("INDEX", GetType(Integer))
supportBeamsDT.Columns.Add("TYPE", GetType(String))
supportBeamsDT.Columns.Add("COLUMN", GetType(Integer))
supportBeamsDT.Columns.Add("COLUMN_OFFSET", GetType(Integer))
supportBeamsDT.Columns.Add("GLOBAL_OFFSET", GetType(Integer))
supportBeamsDT.Columns.Add("LENGTH", GetType(Integer))
supportBeamsDT.Columns.Add("OFFSET_TOP", GetType(Integer))
supportBeamsDT.Columns.Add("OFFSET_BOTTOM", GetType(Integer))
supportBeamsDT.Columns.Add("ROTATION", GetType(Integer))
'Horizontal Beams
For i = 0 To numOfVertical - 2
withSupportBeam = True
Dim tempDR As DataRow = supportBeamsDT.NewRow
tempDR("INDEX") = supportBeamsDT.Rows.Count + 1
tempDR("TYPE") = "Grid"
tempDR("GLOBAL_OFFSET") = gratingDimensionsDT.Rows(numOfHorizontal * (numOfVertical - 1))("WIDTH")
For j = 1 To i
tempDR("GLOBAL_OFFSET") += gratingDimensionsDT.Rows(numOfHorizontal * (numOfVertical - 1) - j * numOfHorizontal)("WIDTH")
Next
tempDR("LENGTH") = Data.gratingL
tempDR("OFFSET_TOP") = 0
tempDR("OFFSET_BOTTOM") = 0
tempDR("ROTATION") = 90
supportBeamsDT.Rows.Add(tempDR)
Next
'Vertical Beams
For i = 0 To numOfHorizontal - 2
withSupportBeam = True
Dim tempDR As DataRow = supportBeamsDT.NewRow
tempDR("INDEX") = supportBeamsDT.Rows.Count + 1
tempDR("TYPE") = "Grid"
tempDR("GLOBAL_OFFSET") = gratingDimensionsDT.Rows(0)("LENGTH")
For j = 1 To i
tempDR("GLOBAL_OFFSET") += gratingDimensionsDT.Rows(j)("LENGTH")
Next
tempDR("LENGTH") = Data.gratingW
tempDR("OFFSET_TOP") = 0
tempDR("OFFSET_BOTTOM") = 0
tempDR("ROTATION") = 0
supportBeamsDT.Rows.Add(tempDR)
Next
End Sub
End Class

View File

@ -365,8 +365,8 @@ Public Class Individual_Drawing
iDrawing.ClearSelection2(True)
swExtensions.SelectByID2(point1NameSW, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
swExtensions.SelectByID2(point2NameSW, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
swExtensions.SelectByID2(point1NameSW, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
swExtensions.SelectByID2(point2NameSW, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
Dim mesOffset = 0.01
If points(2) = 1 OrElse points(2) = 3 Then

View File

@ -242,11 +242,8 @@ Public Class Instructions
status = swExtensions.SelectByID2(balloonName & "@" & myView.GetName2, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
editedNote = swExtensions.EditBalloonProperties2(0, 3, 0, "Frame Corner", 0, "", 0, False, 1, "X", 0.001)
Next
End If
status = layMgr.AddLayer("Symbol", "", 0, 0, 2)
status = layMgr.SetCurrentLayer("Symbol")
@ -271,7 +268,7 @@ Public Class Instructions
Dim note = iDrawing.CreateText2("Load Bearing Direction", (swSheetWidth - 0.072), (swSheetHeight / 2 + 0.012), 0, 0.003, 0)
' --- instruction for support beams ---
If Calculate_Fill_Grid.withSupportBeam = True Then
status = iDrawing.NewSheet3("Support Beams", 12, 12, 1, 10, False, Settings.HLCtFolder & "\Files Needed\A3 Part.slddrt",
swSheetWidth, swSheetHeight, "Same as sheet specified in Document Properties")
@ -285,46 +282,148 @@ Public Class Instructions
status = myView.SetDisplayMode3(False, 1, False, False)
RootComp = myView.RootDrawingComponent
CompName = RootComp.Name
Dim gratingName, plane1Name, plane2Name As String
Dim viewName As String = myView.GetName2
status = False
Dim counter = 0
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter * Calculate_Fill_Grid.numOfHorizontal + 1 'modelsDT.Rows(counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
Dim horizontalBeams = Calculate_Fill_Grid.supportBeamsDT.Select("ROTATION = '90'", "GLOBAL_OFFSET DESC")
If horizontalBeams.Length > 0 Then
status = False
Dim counter As Integer = 1
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SW1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
gratingName = "SUPPORT_BEAM_" & horizontalBeams(0)("INDEX")
plane2Name = "Point6@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
Dim measurement As IDisplayDimension
OutLine = myView.GetOutline
measurement = iDrawing.AddVerticalDimension2(OutLine(0) - 0.005, 0, 0)
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SL1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHSEGMENT", 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 'modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal - 1 + counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
counter += 1
End While
Set_MeasurementProperties(measurement)
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0)
iDrawing.ClearSelection2(True)
For i = 0 To horizontalBeams.Length - 2
gratingName = "SUPPORT_BEAM_" & horizontalBeams(i)("INDEX")
plane1Name = "Point6@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
Set_MeasurementProperties(measurement)
measurement.ShowParenthesis = True
gratingName = "SUPPORT_BEAM_" & horizontalBeams(i + 1)("INDEX")
plane2Name = "Point6@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddVerticalDimension2(OutLine(0) - 0.005, 0, 0)
iDrawing.ClearSelection2(True)
Set_MeasurementProperties(measurement)
Next
status = False
counter = 1
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1) + counter
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SW2@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
gratingName = "SUPPORT_BEAM_" & horizontalBeams(horizontalBeams.Length - 1)("INDEX")
plane2Name = "Point6@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
OutLine = myView.GetOutline
measurement = iDrawing.AddVerticalDimension2(OutLine(0) - 0.005, 0, 0)
iDrawing.ClearSelection2(True)
Set_MeasurementProperties(measurement)
measurement.ShowParenthesis = True
End If
Dim verticalBeams = Calculate_Fill_Grid.supportBeamsDT.Select("ROTATION = '0'", "GLOBAL_OFFSET ASC")
If verticalBeams.Length > 0 Then
status = False
Dim counter As Integer = 0
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter * Calculate_Fill_Grid.numOfHorizontal + 1
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SL1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
gratingName = "SUPPORT_BEAM_" & verticalBeams(0)("INDEX")
plane2Name = "Point1@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
OutLine = myView.GetOutline
Dim measurement As IDisplayDimension
measurement = iDrawing.AddHorizontalDimension2(0, OutLine(3) + 0.005, 0)
iDrawing.ClearSelection2(True)
Set_MeasurementProperties(measurement)
For i = 0 To verticalBeams.Length - 2
gratingName = "SUPPORT_BEAM_" & verticalBeams(i)("INDEX")
plane1Name = "Point1@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
gratingName = "SUPPORT_BEAM_" & verticalBeams(i + 1)("INDEX")
plane2Name = "Point1@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddHorizontalDimension2(0, OutLine(3) + 0.005, 0)
iDrawing.ClearSelection2(True)
Set_MeasurementProperties(measurement)
Next
status = False
counter = 0
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal + counter * Calculate_Fill_Grid.numOfHorizontal
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SL2@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
gratingName = "SUPPORT_BEAM_" & verticalBeams(verticalBeams.Length - 1)("INDEX")
plane2Name = "Point1@SM1@" & CompName & "@" & viewName & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddHorizontalDimension2(0, OutLine(3) + 0.005, 0)
iDrawing.ClearSelection2(True)
Set_MeasurementProperties(measurement)
measurement.ShowParenthesis = True
End If
End If
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
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

View File

@ -50,9 +50,16 @@ Public Class Multiple_3D_Simplified
inst_ = ExternalClass.instantiate_parts(parentID, "support_beam", "")
ExternalClass.modify_parameter_value("DP_HEIGHT_OFFSET", inst_, gratingParameters("LOADBAR_HEIGHT"))
ExternalClass.modify_parameter_value("DP_LENGTH", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("LENGTH"))
ExternalClass.modify_parameter_value("DP_OFFSET_X", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("GLOBAL_OFFSET"))
ExternalClass.modify_parameter_value("DP_OFFSET_TOP", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("OFFSET_TOP"))
ExternalClass.modify_parameter_value("DP_OFFSET_BOTTOM", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("OFFSET_BOTTOM"))
ExternalClass.modify_parameter_value("DP_ROTATION", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("ROTATION"))
If Calculate_Fill_Grid.supportBeamsDT.Rows(i)("ROTATION") = 0 Then
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("GLOBAL_OFFSET"))
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, 0)
Else
ExternalClass.modify_parameter_value("DP_OFFSET_W", inst_, 0)
ExternalClass.modify_parameter_value("DP_OFFSET_L", inst_, Calculate_Fill_Grid.supportBeamsDT.Rows(i)("GLOBAL_OFFSET"))
End If
Next
End If
@ -64,6 +71,7 @@ Public Class Multiple_3D_Simplified
Delete_Obsolete()
Recess_Indent()
SupportBeams_Indent()
Suppress_Bodies()
Save_Assembly(withFrame)
@ -125,10 +133,10 @@ Public Class Multiple_3D_Simplified
Dim config As Configuration
config = assembly.GetActiveConfiguration
Dim swCustPropMgr = config.CustomPropertyManager
If withFrame = True Then
If User_Input.addInstructions = 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("ExtraBenämning1", 30, "Floor grating " & User_Input.gratingMesh & " " & User_Input.gratingHeight & "/" & User_Input.loadBarThickness, 1)
status = swCustPropMgr.Add3("ExtraBenämning2", 30, "LxW " & Data.gratingL & "x" & Data.gratingW, 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)
@ -468,7 +476,114 @@ Public Class Multiple_3D_Simplified
Next
End Sub
'FORTSÄTT HÄR: FIXA ATT SKÄRA VERTICAL MED HORIZONTAL BEAMS
Private Shared Sub SupportBeams_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 modelDoc As IModelDoc2
modelDoc = Assembly
Dim SelMgr = Assembly.SelectionManager()
AssemblyExtension = Assembly.Extension
Dim sldata = SelMgr.CreateSelectData
partDT = partModel.selectPart("*")
Dim gratingParts = partDT.Select("parentName = 'START'")
Dim components = Assembly.GetComponents(True)
'Indent
Dim beamParentName As String = partDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1))("partName")
Dim beamParts = partDT.Select("parentName = '" & beamParentName & "'")
For i = 0 To beamParts.Count - 1
Dim beamPartName As String = beamParts(i)("partName")
If beamPartName.Split("_")(0) = "RECESS" Then
Dim indexRecess As Integer
For k = 0 To components.Length - 1
If components(k).Name2 = beamPartName & "-1" Then
indexRecess = k
Exit For
End If
Next
Dim recessBodies = components(indexRecess).GetBodies2(0)
Dim recessComponent As SldWorks.Component2 = components(indexRecess)
Dim indexBody As Integer
For l = 0 To recessBodies.Length - 1
If recessBodies(l).Name = "Cut-Body" Then
indexBody = l
Exit For
End If
Next
Dim recessFace = recessBodies(indexBody).GetFirstFace
For j = 0 To Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal - 1
Assembly.ClearSelection2(True)
Dim gratingPartName As String = partDT.Rows(j)("partName")
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
If boolstatus = True Then
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
Assembly.EditPart
Dim indexGrating As Integer
For k = 0 To components.Length - 1
If components(k).Name2 = gratingPartName & "-1" Then
indexGrating = k
Exit For
End If
Next
Dim gratingComponent As SldWorks.Component2 = components(indexGrating)
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
For k = 0 To bodiesToCut.Length - 1
Assembly.ClearSelection2(True)
sldata.Mark = 1
Dim bodyName As String = bodiesToCut(k).Name & "@" & gratingPartName & "-1@" & designName
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
sldata.Mark = 4
recessFace.Select4(True, sldata)
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
Assembly.ClearSelection2(True)
Next
bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
For k = 0 To bodiesToCut.Length - 1
boolstatus = AssemblyExtension.SelectByID2(bodiesToCut(k).Name & "@" & gratingPartName & "-1@" & designName, "SOLIDBODY", 0, 0, 0, True, 0, Nothing, 0)
Dim myFeature As Object
Dim modelFeat As FeatureManager = modelDoc.FeatureManager
myFeature = modelFeat.InsertDeleteBody2(False)
Next
Assembly.EditAssembly
End If
Next
Assembly.ClearSelection2(True)
End If
Assembly.EditAssembly
boolstatus = modelDoc.EditRebuild3()
Next
Dim a = 1
End Sub
Private Shared Sub Delete_Obsolete()
listOfObsolete = Find_Obsolete()

View File

@ -131,12 +131,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(0), 0)
mesOffsets(0) += 0.01
@ -157,12 +157,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddVerticalDimension2(mesOffsets(1), 0, 0)
mesOffsets(1) += 0.01
@ -182,12 +182,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(2), 0)
mesOffsets(2) -= 0.01
@ -207,12 +207,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddVerticalDimension2(mesOffsets(3), 0, 0)
mesOffsets(3) -= 0.01
@ -237,12 +237,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddVerticalDimension2(mesOffsets(1), 0, 0)
mesOffsets(1) += 0.01
@ -256,12 +256,12 @@ Public Class Multiple_Drawing
iDrawing.ClearSelection2(True)
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
measurement = iDrawing.AddHorizontalDimension2(0, mesOffsets(2), 0)
mesOffsets(2) -= 0.01
@ -280,9 +280,9 @@ Public Class Multiple_Drawing
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & i + counter * Calculate_Fill_Grid.numOfHorizontal 'modelsDT.Rows(i + counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SL1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0) 'Fixa gratingname
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
counter += 1
End While
@ -299,7 +299,7 @@ Public Class Multiple_Drawing
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter * Calculate_Fill_Grid.numOfHorizontal + 1 'modelsDT.Rows(counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SL1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
@ -308,7 +308,7 @@ Public Class Multiple_Drawing
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal + counter * Calculate_Fill_Grid.numOfHorizontal 'modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal - 1 + counter * Calculate_Fill_Grid.numOfHorizontal)("partName")
plane2Name = "Point1@SL2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
counter += 1
End While
@ -326,9 +326,9 @@ Public Class Multiple_Drawing
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & i * Calculate_Fill_Grid.numOfHorizontal + counter 'modelsDT.Rows(i * Calculate_Fill_Grid.numOfHorizontal + counter)("partName")
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SW1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
counter += 1
End While
@ -345,7 +345,7 @@ Public Class Multiple_Drawing
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & counter 'modelsDT.Rows(counter)("partName")
iDrawing.ClearSelection2(True)
plane1Name = "Point1@SW1@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane1Name, "EXTSKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)
counter += 1
End While
@ -354,7 +354,7 @@ Public Class Multiple_Drawing
While status = False
gratingName = "SIMPLIFIED_FLOOR_GRATING_" & Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1) + counter 'modelsDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1) + counter)("partName")
plane2Name = "Point1@SW2@" & CompName & "@" & myView.GetName2 & "/" & gratingName & "-1@" & CompName.Split("-")(0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
counter += 1
End While
@ -440,9 +440,9 @@ Public Class Multiple_Drawing
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, "EXTSKETCHSEGMENT", 0, 0, 0, False, 0, Nothing, 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, "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
status = swExtensions.SelectByID2(plane2Name, "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0)
Dim measurement As IDisplayDimension
If verticalDim = True Then