Combine added
This commit is contained in:
parent
436c157dc6
commit
7bc80d2f23
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Public Class Individual
|
Public Class Individual
|
||||||
Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
|
'Public Shared filepath As String = "C:\Users\Anton\Documents\Exjobb"
|
||||||
'Public Shared filepath As String = "C:\Users\xperd\Documents"
|
Public Shared filepath As String = "C:\Users\xperd\Documents"
|
||||||
|
|
||||||
Sub Load_GUI()
|
Sub Load_GUI()
|
||||||
' Initialize GUI
|
' Initialize GUI
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,67 @@ Public Class Model_3D_Fill
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Shared Sub Recess_Indent()
|
Private Shared Sub Recess_Indent()
|
||||||
|
'Combine all bodies
|
||||||
|
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 SelMgr = Assembly.SelectionManager()
|
||||||
|
AssemblyExtension = Assembly.Extension
|
||||||
|
Dim sldata = SelMgr.CreateSelectData
|
||||||
|
|
||||||
|
Dim partDT As New DataTable
|
||||||
|
partDT = partModel.selectPart("*")
|
||||||
|
|
||||||
|
Dim gratingParts = partDT.Select("parentName = 'START'")
|
||||||
|
|
||||||
|
Dim components = Assembly.GetComponents(True)
|
||||||
|
|
||||||
|
For i = 0 To gratingParts.Count - 1
|
||||||
|
Assembly.ClearSelection2(True)
|
||||||
|
|
||||||
|
Dim indexGrating As Integer
|
||||||
|
Dim gratingPartName As String = gratingParts(i)("partName")
|
||||||
|
For k = 0 To components.Length - 1
|
||||||
|
If components(k).Name2 = gratingPartName & "-1" Then
|
||||||
|
indexGrating = k
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||||
|
Assembly.EditPart
|
||||||
|
|
||||||
|
Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
||||||
|
Assembly.ClearSelection2(True)
|
||||||
|
|
||||||
|
For k = 0 To gratingBodies.Length - 1
|
||||||
|
'sldata.Mark = 2
|
||||||
|
Dim bodyName As String = gratingBodies(k).Name & "@" & gratingPartName & "-1@" & designName
|
||||||
|
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 2, Nothing, 0)
|
||||||
|
|
||||||
|
Next
|
||||||
|
Dim combinedFeature As SldWorks.Feature
|
||||||
|
Dim assemblyFeaMgr As SldWorks.IFeatureManager
|
||||||
|
|
||||||
|
assemblyFeaMgr = Assembly.FeatureManager
|
||||||
|
combinedFeature = assemblyFeaMgr.InsertCombineFeature(15903, Nothing, Nothing)
|
||||||
|
'combinedFeature = Assembly.FeatureManager.InsertCombineFeature(15903, Nothing, Nothing)
|
||||||
|
'combinedFeature = assemblyFeaMgr.InsertCombineFeature(15903, Nothing, gratingBodies)
|
||||||
|
Assembly.EditAssembly
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
'Indent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Shared Sub Recess_Indent2()
|
||||||
Dim swApp As SldWorks.SldWorks
|
Dim swApp As SldWorks.SldWorks
|
||||||
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
|
||||||
|
|
||||||
|
|
@ -263,74 +324,38 @@ Public Class Model_3D_Fill
|
||||||
|
|
||||||
Assembly.EditAssembly
|
Assembly.EditAssembly
|
||||||
Next
|
Next
|
||||||
|
Dim interfDectMgr As SldWorks.InterferenceDetectionMgr
|
||||||
|
'Dim interferences As Object
|
||||||
|
'Dim interferenceBody As SldWorks.IBody2
|
||||||
|
Assembly.ToolsCheckInterference
|
||||||
|
|
||||||
|
interfDectMgr = Assembly.InterferenceDetectionManager
|
||||||
|
|
||||||
|
interfDectMgr.TreatCoincidenceAsInterference = False
|
||||||
|
interfDectMgr.TreatSubAssembliesAsComponents = False
|
||||||
|
interfDectMgr.IncludeMultibodyPartInterferences = True
|
||||||
|
interfDectMgr.MakeInterferingPartsTransparent = True
|
||||||
|
interfDectMgr.CreateFastenersFolder = False
|
||||||
|
interfDectMgr.IgnoreHiddenBodies = False
|
||||||
|
interfDectMgr.ShowIgnoredInterferences = False
|
||||||
|
interfDectMgr.UseTransform = False
|
||||||
|
|
||||||
|
Dim interferences = interfDectMgr.GetInterferences()
|
||||||
|
'Dim tempinter As SldWorks.Interference
|
||||||
|
Dim tempinter = interferences(1)
|
||||||
|
Dim interferenceBody = tempinter.GetInterferenceBody()
|
||||||
|
Dim tempdata As SldWorks.SelectData
|
||||||
|
Dim tempbool As Boolean
|
||||||
|
tempbool = interferenceBody.Select2(True, tempdata)
|
||||||
|
|
||||||
|
Dim intBodyName As String = interferenceBody.Name
|
||||||
|
|
||||||
|
'interferenceBody.DisableDisplay = True
|
||||||
|
Dim a = 1
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
' Grating part
|
|
||||||
'Dim gratingPartName As String = partDT.Rows(0)("partName")
|
|
||||||
'boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
|
||||||
' Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
|
||||||
|
|
||||||
'Assembly.EditPart
|
|
||||||
|
|
||||||
' Dim components = Assembly.GetComponents(True)
|
|
||||||
|
|
||||||
'Dim indexGrating As Integer
|
|
||||||
'For i = 0 To components.Length - 1
|
|
||||||
' If components(i).Name2 = gratingPartName & "-1" Then
|
|
||||||
' indexGrating = i
|
|
||||||
' Exit For
|
|
||||||
' End If
|
|
||||||
'Next
|
|
||||||
|
|
||||||
'Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
|
||||||
|
|
||||||
'' Dim recessParts = partDT.Select("parentName = '" & gratingPartName & "'")
|
|
||||||
''Dim recessPartName As String
|
|
||||||
'For i = 0 To recessParts.Count - 1
|
|
||||||
' 'Assembly.ClearSelection2(True)
|
|
||||||
|
|
||||||
' ' Recess part
|
|
||||||
' 'recessPartName = recessParts(i)("partName")
|
|
||||||
' ' boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
|
||||||
' 'Dim recessPart = SelMgr.GetSelectedObject6(1, -1)
|
|
||||||
|
|
||||||
' 'Dim indexRecess As Integer
|
|
||||||
' 'For j = 0 To components.Length - 1
|
|
||||||
' ' If components(j).Name2 = recessPartName & "-1" Then
|
|
||||||
' ' indexRecess = j
|
|
||||||
' ' Exit For
|
|
||||||
' ' End If
|
|
||||||
' 'Next
|
|
||||||
|
|
||||||
' 'Dim recessBodies = components(indexRecess).GetBodies2(0)
|
|
||||||
|
|
||||||
' For j = 0 To gratingBodies.Length - 1
|
|
||||||
' sldata.Mark = 1
|
|
||||||
|
|
||||||
' Dim bodyName As String = gratingBodies(j).Name & "@" & gratingPartName & "-1@" & designName
|
|
||||||
' boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
|
||||||
|
|
||||||
' sldata.Mark = 4
|
|
||||||
|
|
||||||
' Dim indexBody As Integer
|
|
||||||
' For k = 0 To recessBodies.Length - 1
|
|
||||||
' If recessBodies(k).Name = "Boss-Extrude1" Then
|
|
||||||
' indexBody = k
|
|
||||||
' Exit For
|
|
||||||
' End If
|
|
||||||
' Next
|
|
||||||
|
|
||||||
' Dim recessFace = recessBodies(indexBody).GetFirstFace
|
|
||||||
' recessFace.Select4(True, sldata)
|
|
||||||
|
|
||||||
' Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
|
||||||
' Assembly.ClearSelection2(True)
|
|
||||||
' Next
|
|
||||||
'Next
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue