Fixes to support beams (recesses etc)
This commit is contained in:
parent
8f1aa2a5c5
commit
9c07c563a8
Binary file not shown.
Binary file not shown.
|
|
@ -61,6 +61,24 @@ Public Class Multiple_3D
|
|||
Frame_3D.Build_Frame(gratingParameters, parentID)
|
||||
End If
|
||||
|
||||
If Calculate_Fill_Grid.withSupportBeam = True Then
|
||||
For i = 0 To Calculate_Fill_Grid.supportBeamsDT.Rows.Count - 1
|
||||
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_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
|
||||
|
||||
importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
|
||||
Dim grNr = groupClass.NewGroupID
|
||||
Dim designTable = designModel.selectDesign("*")
|
||||
|
|
@ -70,6 +88,7 @@ Public Class Multiple_3D
|
|||
Delete_Obsolete()
|
||||
Recess_Indent()
|
||||
|
||||
SupportBeams_Indent()
|
||||
Save_Assembly()
|
||||
|
||||
End Sub
|
||||
|
|
@ -299,6 +318,15 @@ Public Class Multiple_3D
|
|||
Dim components = Assembly.GetComponents(True)
|
||||
|
||||
'Indent
|
||||
Dim listOfBeams As New List(Of DataRow)
|
||||
For i = 0 To partDT.Rows.Count - 1
|
||||
Dim partName As String
|
||||
partName = partDT.Rows(i)("partName")
|
||||
If partName.Split("_")(0) = "SUPPORT" Then
|
||||
listOfBeams.Add(partDT.Rows(i))
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessParentName As String = partDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1))("partName")
|
||||
Dim recessParts = partDT.Select("parentName = '" & recessParentName & "'")
|
||||
For i = 0 To recessParts.Count - 1
|
||||
|
|
@ -326,61 +354,101 @@ Public Class Multiple_3D
|
|||
|
||||
Dim recessFace = recessBodies(indexBody).GetFirstFace
|
||||
|
||||
For j = 0 To Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal - 1
|
||||
For j = 0 To Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal - 1 + Calculate_Fill_Grid.supportBeamsDT.Rows.Count
|
||||
Assembly.ClearSelection2(True)
|
||||
If j < Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal Then
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
Assembly.EditPart
|
||||
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()
|
||||
|
||||
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 k = 0 To components.Length - 1
|
||||
If components(k).Name2 = gratingPartName & "-1" Then
|
||||
indexGrating = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
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 gratingComponent As SldWorks.Component2 = components(indexGrating)
|
||||
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
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 = 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)
|
||||
|
||||
sldata.Mark = 4
|
||||
recessFace.Select4(True, sldata)
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
|
||||
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)
|
||||
Dim a = 1
|
||||
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)
|
||||
Dim a = 1
|
||||
Next
|
||||
boolstatus = AssemblyExtension.SelectByID2("HorizontalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
boolstatus = AssemblyExtension.SelectByID2("VerticalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
Assembly.EditAssembly
|
||||
End If
|
||||
|
||||
Else
|
||||
Dim j2 As Integer = j - Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal
|
||||
Dim beamName As String = listOfBeams(j2)("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(beamName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
If boolstatus = True Then
|
||||
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
Assembly.EditPart
|
||||
|
||||
Dim indexBeam As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = beamName & "-1" Then
|
||||
indexBeam = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim beamComponent As SldWorks.Component2 = components(indexBeam)
|
||||
|
||||
Dim bodiesToCut = Check_Interference(beamComponent, recessComponent, beamName & "-1")
|
||||
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
Dim bodyName As String = bodiesToCut(k).Name & "@" & beamName & "-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
|
||||
Assembly.EditAssembly
|
||||
End If
|
||||
|
||||
boolstatus = AssemblyExtension.SelectByID2("HorizontalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
boolstatus = AssemblyExtension.SelectByID2("VerticalSplitBody@" & gratingPartName & "-1@" & designName, "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
|
||||
modelDoc.EditUnsuppress2()
|
||||
Assembly.EditAssembly
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Assembly.ClearSelection2(True)
|
||||
|
|
@ -494,6 +562,99 @@ Public Class Multiple_3D
|
|||
|
||||
End Sub
|
||||
|
||||
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 components = Assembly.GetComponents(True)
|
||||
|
||||
'Indent
|
||||
Dim listOfHorizBeams As New List(Of DataRow)
|
||||
Dim listOfVertBeams As New List(Of DataRow)
|
||||
Dim counter As Integer = 1
|
||||
For i = 0 To partDT.Rows.Count - 1
|
||||
Dim partName As String
|
||||
partName = partDT.Rows(i)("partName")
|
||||
If partName.Split("_")(0) = "SUPPORT" Then
|
||||
If counter < Calculate_Fill_Grid.numOfVertical Then
|
||||
listOfHorizBeams.Add(partDT.Rows(i))
|
||||
counter += 1
|
||||
Else
|
||||
listOfVertBeams.Add(partDT.Rows(i))
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
For i = 0 To listOfHorizBeams.Count - 1
|
||||
Dim nameOfHorizBeam As String = listOfHorizBeams(i)("partName")
|
||||
Dim indexBeamHoriz As Integer
|
||||
For j = 0 To components.Length - 1
|
||||
If components(j).Name2 = nameOfHorizBeam & "-1" Then
|
||||
indexBeamHoriz = j
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim horizBeamBodies = components(indexBeamHoriz).GetBodies2(0)
|
||||
Dim horizBeamComponent As SldWorks.Component2 = components(indexBeamHoriz)
|
||||
|
||||
Dim horizBeamFace = horizBeamBodies(0).GetFirstFace
|
||||
|
||||
For j = 0 To listOfVertBeams.Count - 1
|
||||
Dim nameOfVertBeam As String = listOfVertBeams(j)("partName")
|
||||
Dim indexBeamVert As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = nameOfVertBeam & "-1" Then
|
||||
indexBeamVert = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Dim vertBeamBodies = components(indexBeamVert).GetBodies2(0)
|
||||
Dim vertBeamComponent As SldWorks.Component2 = components(indexBeamVert)
|
||||
|
||||
Dim bodiesToCut = Check_Interference(vertBeamComponent, horizBeamComponent, nameOfVertBeam & "-1")
|
||||
If bodiesToCut Is Nothing Then
|
||||
Assembly.EditAssembly
|
||||
Continue For
|
||||
End If
|
||||
Assembly.ClearSelection2(True)
|
||||
boolstatus = AssemblyExtension.SelectByID2(nameOfVertBeam & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Assembly.EditPart
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
Dim bodyName As String = bodiesToCut(k).Name & "@" & nameOfVertBeam & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
horizBeamFace.Select4(True, sldata)
|
||||
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
Assembly.EditAssembly
|
||||
Next
|
||||
Next
|
||||
|
||||
Assembly.EditAssembly
|
||||
boolstatus = modelDoc.EditRebuild3()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Delete_Obsolete()
|
||||
Dim listOfObsolete As List(Of Integer)
|
||||
|
|
@ -746,7 +907,9 @@ Public Class Multiple_3D
|
|||
|
||||
vCompArray = CompArray
|
||||
swAssy.ToolsCheckInterference2(2, (vCompArray), interfering, vIntCompArray, vIntFaceArray)
|
||||
|
||||
If vIntFaceArray Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
Dim Bodies(UBound(vIntFaceArray)) As Object
|
||||
Dim BodyNames(UBound(vIntFaceArray)) As String
|
||||
Dim CompNames(UBound(vIntFaceArray)) As String
|
||||
|
|
|
|||
|
|
@ -394,6 +394,16 @@ Public Class Multiple_3D_Simplified
|
|||
Dim components = Assembly.GetComponents(True)
|
||||
|
||||
'Indent
|
||||
|
||||
Dim listOfBeams As New List(Of DataRow)
|
||||
For i = 0 To partDT.Rows.Count - 1
|
||||
Dim partName As String
|
||||
partName = partDT.Rows(i)("partName")
|
||||
If partName.Split("_")(0) = "SUPPORT" Then
|
||||
listOfBeams.Add(partDT.Rows(i))
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessParentName As String = partDT.Rows(Calculate_Fill_Grid.numOfHorizontal * (Calculate_Fill_Grid.numOfVertical - 1))("partName")
|
||||
Dim recessParts = partDT.Select("parentName = '" & recessParentName & "'")
|
||||
For i = 0 To recessParts.Count - 1
|
||||
|
|
@ -421,52 +431,89 @@ Public Class Multiple_3D_Simplified
|
|||
|
||||
Dim recessFace = recessBodies(indexBody).GetFirstFace
|
||||
|
||||
For j = 0 To Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal - 1
|
||||
For j = 0 To Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal - 1 + Calculate_Fill_Grid.supportBeamsDT.Rows.Count
|
||||
Assembly.ClearSelection2(True)
|
||||
If j < Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal Then
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
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 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 gratingComponent As SldWorks.Component2 = components(indexGrating)
|
||||
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
|
||||
|
||||
Dim bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
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 = 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)
|
||||
|
||||
sldata.Mark = 4
|
||||
recessFace.Select4(True, sldata)
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
bodiesToCut = Check_Interference(gratingComponent, recessComponent, gratingPartName & "-1")
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
Else
|
||||
Dim j2 As Integer = j - Calculate_Fill_Grid.numOfVertical * Calculate_Fill_Grid.numOfHorizontal
|
||||
Dim beamName As String = listOfBeams(j2)("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(beamName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
If boolstatus = True Then
|
||||
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
Assembly.EditAssembly
|
||||
Assembly.EditPart
|
||||
|
||||
Dim indexBeam As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = beamName & "-1" Then
|
||||
indexBeam = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim beamComponent As SldWorks.Component2 = components(indexBeam)
|
||||
|
||||
Dim bodiesToCut = Check_Interference(beamComponent, recessComponent, beamName & "-1")
|
||||
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
Dim bodyName As String = bodiesToCut(k).Name & "@" & beamName & "-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
|
||||
Assembly.EditAssembly
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Assembly.ClearSelection2(True)
|
||||
|
|
@ -476,7 +523,6 @@ 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)
|
||||
|
|
@ -494,94 +540,80 @@ Public Class Multiple_3D_Simplified
|
|||
|
||||
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)
|
||||
Dim listOfHorizBeams As New List(Of DataRow)
|
||||
Dim listOfVertBeams As New List(Of DataRow)
|
||||
Dim counter As Integer = 1
|
||||
For i = 0 To partDT.Rows.Count - 1
|
||||
Dim partName As String
|
||||
partName = partDT.Rows(i)("partName")
|
||||
If partName.Split("_")(0) = "SUPPORT" Then
|
||||
If counter < Calculate_Fill_Grid.numOfVertical Then
|
||||
listOfHorizBeams.Add(partDT.Rows(i))
|
||||
counter += 1
|
||||
Else
|
||||
listOfVertBeams.Add(partDT.Rows(i))
|
||||
End If
|
||||
End If
|
||||
Assembly.EditAssembly
|
||||
boolstatus = modelDoc.EditRebuild3()
|
||||
Next
|
||||
|
||||
Dim a = 1
|
||||
For i = 0 To listOfHorizBeams.Count - 1
|
||||
Dim nameOfHorizBeam As String = listOfHorizBeams(i)("partName")
|
||||
Dim indexBeamHoriz As Integer
|
||||
For j = 0 To components.Length - 1
|
||||
If components(j).Name2 = nameOfHorizBeam & "-1" Then
|
||||
indexBeamHoriz = j
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim horizBeamBodies = components(indexBeamHoriz).GetBodies2(0)
|
||||
Dim horizBeamComponent As SldWorks.Component2 = components(indexBeamHoriz)
|
||||
|
||||
Dim horizBeamFace = horizBeamBodies(0).GetFirstFace
|
||||
|
||||
For j = 0 To listOfVertBeams.Count - 1
|
||||
Dim nameOfVertBeam As String = listOfVertBeams(j)("partName")
|
||||
Dim indexBeamVert As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = nameOfVertBeam & "-1" Then
|
||||
indexBeamVert = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Dim vertBeamBodies = components(indexBeamVert).GetBodies2(0)
|
||||
Dim vertBeamComponent As SldWorks.Component2 = components(indexBeamVert)
|
||||
|
||||
Dim bodiesToCut = Check_Interference(vertBeamComponent, horizBeamComponent, nameOfVertBeam & "-1")
|
||||
If bodiesToCut Is Nothing Then
|
||||
Assembly.EditAssembly
|
||||
Continue For
|
||||
End If
|
||||
Assembly.ClearSelection2(True)
|
||||
boolstatus = AssemblyExtension.SelectByID2(nameOfVertBeam & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Assembly.EditPart
|
||||
For k = 0 To bodiesToCut.Length - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
Dim bodyName As String = bodiesToCut(k).Name & "@" & nameOfVertBeam & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
horizBeamFace.Select4(True, sldata)
|
||||
|
||||
Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
Assembly.EditAssembly
|
||||
Next
|
||||
Next
|
||||
|
||||
Assembly.EditAssembly
|
||||
boolstatus = modelDoc.EditRebuild3()
|
||||
|
||||
|
||||
End Sub
|
||||
Private Shared Sub Delete_Obsolete()
|
||||
|
|
@ -834,7 +866,9 @@ Public Class Multiple_3D_Simplified
|
|||
|
||||
vCompArray = CompArray
|
||||
swAssy.ToolsCheckInterference2(2, (vCompArray), interfering, vIntCompArray, vIntFaceArray)
|
||||
|
||||
If vIntFaceArray Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
Dim Bodies(UBound(vIntFaceArray)) As Object
|
||||
Dim BodyNames(UBound(vIntFaceArray)) As String
|
||||
Dim CompNames(UBound(vIntFaceArray)) As String
|
||||
|
|
|
|||
Loading…
Reference in New Issue