Remove obsolete gratings
This commit is contained in:
parent
e2fceeac69
commit
583bd274c7
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Public Class Individual
|
||||
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\Anton\Documents\Exjobb"
|
||||
Public Shared filepath As String = "C:\Users\xperd\Documents"
|
||||
|
||||
Sub Load_GUI()
|
||||
' Initialize GUI
|
||||
|
|
@ -238,7 +238,7 @@ Public Class Individual
|
|||
' --- When calculate button is pressed ---
|
||||
Private Sub Button_Calculate_Click(sender As Object, e As EventArgs)
|
||||
Grating_Fill.Calculate_Grid()
|
||||
Grating_Fill.Calculate_Recesses()
|
||||
'Grating_Fill.Calculate_Recesses()
|
||||
End Sub
|
||||
|
||||
' ---------------------------------- Export to SW ----------------------------------
|
||||
|
|
@ -246,7 +246,7 @@ Public Class Individual
|
|||
Private Sub Button_Export_SW_Click(sender As Object, e As EventArgs) Handles Button_Export_SW.Click
|
||||
If AppForm.fillMode Then
|
||||
Grating_Fill.Calculate_Grid()
|
||||
Grating_Fill.Calculate_Recesses()
|
||||
'Grating_Fill.Calculate_Recesses()
|
||||
|
||||
Model_3D_Fill.BuildGrid()
|
||||
Else
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ Public Class Model_3D_Fill
|
|||
groupClass.InstantiateGroup(designName, grNr, "START")
|
||||
|
||||
Recess_Indent()
|
||||
Delete_Obsolete()
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Shared Sub Inst_Recesses(parentID As Integer, gratingParameters As DataRow, recessDR As DataRow)
|
||||
Dim inst_ As Integer
|
||||
|
||||
|
|
@ -241,11 +244,33 @@ Public Class Model_3D_Fill
|
|||
Dim recessParentName As String = partDT.Rows(Grating_Fill.numOfHorizontal * (Grating_Fill.numOfVertical - 1))("partName")
|
||||
Dim recessParts = partDT.Select("parentName = '" & recessParentName & "'")
|
||||
For i = 0 To recessParts.Count - 1
|
||||
Dim tempList As List(Of Integer) = Data.recessData.Rows(i)("GRATINGS")
|
||||
For j = 0 To tempList.Count - 1
|
||||
|
||||
Dim recessPartName As String = recessParts(i)("partName")
|
||||
|
||||
Dim indexRecess As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = recessPartName & "-1" Then
|
||||
indexRecess = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessBodies = components(indexRecess).GetBodies2(0)
|
||||
|
||||
Dim indexBody As Integer
|
||||
For l = 0 To recessBodies.Length - 1
|
||||
If recessBodies(l).Name = "Boss-Extrude1" Then
|
||||
indexBody = l
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessFace = recessBodies(indexBody).GetFirstFace
|
||||
|
||||
For j = 0 To Grating_Fill.numOfVertical * Grating_Fill.numOfHorizontal - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
Dim gratingPartName As String = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j))("partName")
|
||||
Dim gratingPartName As String = partDT.Rows(j)("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
|
|
@ -262,25 +287,13 @@ Public Class Model_3D_Fill
|
|||
Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
||||
Dim gratingBodyIndex As Integer
|
||||
For k = 0 To gratingBodies.Length - 1
|
||||
If gratingBodies(k).Name = "Combine1" Then
|
||||
If gratingBodies(k).Name <> "VerticalSplitBody" AndAlso gratingBodies(k).Name <> "HorizontalSplitBody" Then
|
||||
gratingBodyIndex = k
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Dim recessPartName As String = 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 k = 0 To components.Length - 1
|
||||
If components(k).Name2 = recessPartName & "-1" Then
|
||||
indexRecess = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessBodies = components(indexRecess).GetBodies2(0)
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
|
||||
|
|
@ -289,44 +302,25 @@ Public Class Model_3D_Fill
|
|||
|
||||
sldata.Mark = 4
|
||||
|
||||
Dim indexBody As Integer
|
||||
For l = 0 To recessBodies.Length - 1
|
||||
If recessBodies(l).Name = "Boss-Extrude1" Then
|
||||
indexBody = l
|
||||
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)
|
||||
|
||||
|
||||
Assembly.EditAssembly
|
||||
|
||||
|
||||
Next
|
||||
|
||||
|
||||
|
||||
Assembly.ClearSelection2(True)
|
||||
|
||||
Dim recessPartName2 As String = recessParts(i)("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(recessPartName2 & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
boolstatus = AssemblyExtension.SelectByID2(recessPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim recessPart2 = SelMgr.GetSelectedObject6(1, -1)
|
||||
|
||||
Assembly.EditPart
|
||||
|
||||
Dim indexRecess2 As Integer
|
||||
For k = 0 To components.Length - 1
|
||||
If components(k).Name2 = recessPartName2 & "-1" Then
|
||||
indexRecess2 = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
For j = 0 To Grating_Fill.numOfVertical * Grating_Fill.numOfHorizontal
|
||||
For j = 0 To Grating_Fill.numOfVertical * Grating_Fill.numOfHorizontal - 1
|
||||
For k = 1 To 2
|
||||
|
||||
Dim gratingPartName As String = partDT.Rows(j)("partName")
|
||||
|
|
@ -355,7 +349,7 @@ Public Class Model_3D_Fill
|
|||
Next
|
||||
Dim cutBody = gratingBodies(cutBodyIndex)
|
||||
|
||||
Dim recessBodies = components(indexRecess2).GetBodies2(0)
|
||||
recessBodies = components(indexRecess).GetBodies2(0)
|
||||
For l = 0 To recessBodies.Length - 1
|
||||
If recessBodies(l).Name <> "Boss-Extrude1" Then
|
||||
|
||||
|
|
@ -364,7 +358,7 @@ Public Class Model_3D_Fill
|
|||
Assembly.ClearSelection2(True)
|
||||
|
||||
sldata.Mark = 1
|
||||
Dim bodyName As String = recessBodies(l).Name & "@" & recessPartName2 & "-1@" & designName
|
||||
Dim bodyName As String = recessBodies(l).Name & "@" & recessPartName & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
|
|
@ -375,226 +369,168 @@ Public Class Model_3D_Fill
|
|||
|
||||
End If
|
||||
Next
|
||||
|
||||
Next
|
||||
|
||||
Assembly.ClearSelection2(True)
|
||||
Next
|
||||
|
||||
Assembly.EditAssembly
|
||||
Next
|
||||
|
||||
'Dim recessBodyIndex As Integer
|
||||
'For k = 0 To recessBodies.Length - 1
|
||||
' If recessBodies(k).Name = bodyToSplit Then 'Kommer ändras
|
||||
' recessBodyIndex = k
|
||||
' Exit For
|
||||
' End If
|
||||
'Next
|
||||
|
||||
'Dim recessBody = recessBodies(recessBodyIndex)
|
||||
|
||||
'Dim splitBodyName As String
|
||||
'Dim numOfSplits As Integer
|
||||
'If Math.Abs(tempList(0) - tempList(1)) = 1 Then
|
||||
' splitBodyName = "VerticalSplitBody"
|
||||
' numOfSplits = Grating_Fill.numOfHorizontal
|
||||
'Else
|
||||
' splitBodyName = "HorizontalSplitBody"
|
||||
' numOfSplits = Grating_Fill.numOfVertical
|
||||
'End If
|
||||
|
||||
'For k = 0 To numOfSplits - 1
|
||||
' gratingPartName = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j + k))("partName")
|
||||
' For l = 0 To components.Length - 1
|
||||
' If components(l).Name2 = gratingPartName & "-1" Then
|
||||
' indexGrating = l
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Dim gratingBodies = components(indexGrating).GetBodies2(0)
|
||||
' Dim cutBodyIndex As Integer
|
||||
' For l = 0 To gratingBodies.Length - 1
|
||||
' If gratingBodies(l).Name = splitBodyName Then
|
||||
' cutBodyIndex = l
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' Dim cutBody = gratingBodies(cutBodyIndex)
|
||||
|
||||
' Assembly.ClearSelection2(True)
|
||||
|
||||
' sldata.Mark = 1
|
||||
' Dim bodyName As String = recessBody.Name & "@" & recessPartName & "-1@" & designName
|
||||
' boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
' sldata.Mark = 4
|
||||
' Dim cutFace = cutBody.GetFirstFace
|
||||
' cutFace.Select4(True, sldata)
|
||||
|
||||
' Assembly.FeatureManager.InsertIndent(0.01, 0, False, True, True, False)
|
||||
' Next
|
||||
|
||||
|
||||
|
||||
|
||||
''Plane split
|
||||
'gratingPartName = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j + k))("partName")
|
||||
|
||||
'Dim planeName As String = "VerticalSplitPlane@" & gratingPartName & "-1@" & designName
|
||||
'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0)
|
||||
|
||||
'Dim RefPlane As Object
|
||||
'RefPlane = Assembly.FeatureManager.InsertRefPlane(4, 0, 0, 0, 0, 0)
|
||||
'Assembly.ClearSelection2(True)
|
||||
|
||||
'planeName = "Top Plane@" & recessPartName & "-1@" & designName
|
||||
'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0)
|
||||
'Dim swCompEnt = SelMgr.GetSelectedObject6(1, 0)
|
||||
'Dim swComp = SelMgr.GetSelectedObjectsComponent3(1, 0)
|
||||
'Dim swCompModel = swComp.GetModelDoc
|
||||
|
||||
'Dim swFeat As SldWorks.Feature
|
||||
'swFeat = swCompModel.FirstFeature
|
||||
|
||||
'Dim planeFeat As SldWorks.Feature
|
||||
'Do While Not swFeat Is Nothing
|
||||
' planeFeat = swFeat
|
||||
' swFeat = swFeat.GetNextFeature
|
||||
'Loop
|
||||
|
||||
'Assembly.ClearSelection2(True)
|
||||
'planeName = planeFeat.Name & "@" & recessPartName & "-1@" & designName
|
||||
'boolstatus = AssemblyExtension.SelectByID2(planeName, "PLANE", 0, 0, 0, True, 0, Nothing, 0)
|
||||
|
||||
'Dim vResultingBodies As Object
|
||||
'vResultingBodies = Assembly.FeatureManager.PreSplitBody()
|
||||
|
||||
'Dim bodyOrigins(1) As Object
|
||||
'bodyOrigins(0) = Nothing
|
||||
'bodyOrigins(1) = Nothing
|
||||
'Dim splitFeat As SldWorks.Feature
|
||||
|
||||
'splitFeat = Assembly.FeatureManager.PostSplitBody(vResultingBodies, False, bodyOrigins, "")
|
||||
'Assembly.ClearSelection2(True)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Sub Recess_Indent2()
|
||||
|
||||
Private Shared Sub Delete_Obsolete()
|
||||
Dim listOfObsolete As New List(Of Integer)
|
||||
listOfObsolete = Find_Obsolete()
|
||||
|
||||
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()
|
||||
Dim AssemblyExtension As SldWorks.ModelDocExtension
|
||||
AssemblyExtension = Assembly.Extension
|
||||
Dim sldata = SelMgr.CreateSelectData
|
||||
|
||||
Dim partDT As New DataTable
|
||||
partDT = partModel.selectPart("*")
|
||||
|
||||
Dim recessParentName As String = partDT.Rows(Grating_Fill.numOfHorizontal * (Grating_Fill.numOfVertical - 1))("partName")
|
||||
Dim recessParts = partDT.Select("parentName = '" & recessParentName & "'")
|
||||
For i = 0 To recessParts.Count - 1
|
||||
Dim tempList As List(Of Integer) = Data.recessData.Rows(i)("GRATINGS")
|
||||
For j = 0 To tempList.Count - 1
|
||||
Assembly.ClearSelection2(True)
|
||||
Dim gratingParts = partDT.Select("parentName = 'START'")
|
||||
|
||||
Dim gratingPartName As String = partDT.Rows(Data.recessData.Rows(i)("GRATINGS")(j))("partName")
|
||||
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Dim gratingPart = SelMgr.GetSelectedObject6(1, -1)
|
||||
For i = 0 To listOfObsolete.Count - 1
|
||||
Dim gratingPartName As String = gratingParts(listOfObsolete(i))("partName")
|
||||
|
||||
Assembly.EditPart
|
||||
|
||||
Dim components = Assembly.GetComponents(True)
|
||||
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 gratingBodies = components(indexGrating).GetBodies2(0)
|
||||
|
||||
Dim recessPartName As String = 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 k = 0 To components.Length - 1
|
||||
If components(k).Name2 = recessPartName & "-1" Then
|
||||
indexRecess = k
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim recessBodies = components(indexRecess).GetBodies2(0)
|
||||
For k = 0 To gratingBodies.Length - 1
|
||||
sldata.Mark = 1
|
||||
|
||||
Dim bodyName As String = gratingBodies(k).Name & "@" & gratingPartName & "-1@" & designName
|
||||
boolstatus = AssemblyExtension.SelectByID2(bodyName, "SOLIDBODY", 0, 0, 0, True, 1, Nothing, 0)
|
||||
|
||||
sldata.Mark = 4
|
||||
|
||||
Dim indexBody As Integer
|
||||
For l = 0 To recessBodies.Length - 1
|
||||
If recessBodies(l).Name = "Boss-Extrude1" Then
|
||||
indexBody = l
|
||||
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
|
||||
|
||||
Assembly.EditAssembly
|
||||
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
|
||||
Assembly.ClearSelection2(True)
|
||||
boolstatus = AssemblyExtension.SelectByID2(gratingPartName & "-1@" & designName, "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
|
||||
Assembly.EditDelete
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Shared Function Find_Obsolete()
|
||||
Dim listOfObsolete As New List(Of Integer)
|
||||
|
||||
For i = 0 To Grating_Fill.numOfVertical * Grating_Fill.numOfHorizontal - 1
|
||||
Dim gratingDR As DataRow = Grating_Fill.gratingDimensions.Rows(i)
|
||||
Dim origo(2) As Integer
|
||||
origo(0) = Data.gratingL / 2
|
||||
origo(1) = Data.gratingW / 2
|
||||
|
||||
Dim GP As New List(Of Integer())
|
||||
Dim p1(1), p2(1), p3(1), p4(1) As Integer
|
||||
p1(0) = -origo(0)
|
||||
p2(0) = -origo(0) + gratingDR("LENGTH")
|
||||
For j = 1 To gratingDR("COLUMN")
|
||||
p1(0) += Grating_Fill.gratingDimensions.Rows(i - j)("LENGTH")
|
||||
p2(0) += Grating_Fill.gratingDimensions.Rows(i - j)("LENGTH")
|
||||
Next
|
||||
p1(1) = origo(1)
|
||||
p3(1) = origo(1) - gratingDR("WIDTH")
|
||||
For j = 1 To gratingDR("ROW")
|
||||
p1(1) -= Grating_Fill.gratingDimensions.Rows(i - Grating_Fill.numOfHorizontal * j)("WIDTH")
|
||||
p3(1) -= Grating_Fill.gratingDimensions.Rows(i - Grating_Fill.numOfHorizontal * j)("WIDTH")
|
||||
Next
|
||||
|
||||
p2(1) = p1(1)
|
||||
p3(0) = p1(0)
|
||||
p4(0) = p2(0)
|
||||
p4(1) = p3(1)
|
||||
|
||||
GP.Add(p1)
|
||||
GP.Add(p2)
|
||||
GP.Add(p3)
|
||||
GP.Add(p4)
|
||||
|
||||
|
||||
Dim cornerAngleCounter As Integer = 1
|
||||
For j = 0 To Data.recessData.Rows.Count - 1
|
||||
If Data.recessData.Rows(j)("RECESS TYPE") = "ANGLE" Then
|
||||
Dim RP As New List(Of Integer())
|
||||
Dim rec1(1), rec2(1), rec3(1) As Integer
|
||||
If Data.recessData.Rows(j)("CORNER") = 1 Then
|
||||
rec1(0) = -origo(0)
|
||||
rec1(1) = origo(1)
|
||||
|
||||
ElseIf Data.recessData.Rows(j)("CORNER") = 2 Then
|
||||
rec1(0) = origo(0)
|
||||
rec1(1) = origo(1)
|
||||
|
||||
ElseIf Data.recessData.Rows(j)("CORNER") = 3 Then
|
||||
rec1(0) = origo(0)
|
||||
rec1(1) = -origo(1)
|
||||
|
||||
Else
|
||||
rec1(0) = -origo(0)
|
||||
rec1(1) = -origo(1)
|
||||
|
||||
End If
|
||||
|
||||
Dim rowIndex As Integer
|
||||
For k = 0 To Data.gratingPoints.Rows.Count - 1
|
||||
If Data.gratingPoints.Rows(k)("NAME") = "CA" & cornerAngleCounter & "_" & 1 Then
|
||||
rowIndex = k
|
||||
End If
|
||||
|
||||
Next
|
||||
rec2(0) = Data.gratingPoints.Rows(rowIndex)("X") * 1000
|
||||
rec2(1) = Data.gratingPoints.Rows(rowIndex)("Y") * 1000
|
||||
|
||||
rec3(0) = Data.gratingPoints.Rows(rowIndex + 1)("X") * 1000
|
||||
rec3(1) = Data.gratingPoints.Rows(rowIndex + 1)("Y") * 1000
|
||||
|
||||
RP.Add(rec1)
|
||||
RP.Add(rec2)
|
||||
RP.Add(rec3)
|
||||
|
||||
|
||||
|
||||
Dim gratingObsolete As Boolean = True
|
||||
For k = 0 To 3
|
||||
|
||||
Dim pInTriangle As Boolean = Calculate_Triangle_Bool(GP(k), RP(0), RP(1), RP(2))
|
||||
|
||||
|
||||
If pInTriangle = False Then
|
||||
gratingObsolete = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
If gratingObsolete = True Then
|
||||
listOfObsolete.Add(i)
|
||||
End If
|
||||
|
||||
|
||||
cornerAngleCounter += 1
|
||||
ElseIf Data.recessData.Rows(j)("RECESS TYPE") = "SQUARE" OrElse Data.recessData.Rows(j)("RECESS TYPE") = "SIDE SQUARE" Then
|
||||
'Fyra punkter rektangalarna
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Next
|
||||
Return listOfObsolete
|
||||
End Function
|
||||
|
||||
Private Shared Function Calculate_Triangle_Bool(gp As Integer(), p0 As Integer(), p1 As Integer(), p2 As Integer())
|
||||
|
||||
Dim s As Double = p0(1) * p2(0) - p0(0) * p2(1) + (p2(1) - p0(1)) * gp(0) + (p0(0) - p2(0)) * gp(1)
|
||||
Dim t As Double = p0(0) * p1(1) - p0(1) * p1(0) + (p0(1) - p1(1)) * gp(0) + (p1(0) - p0(0)) * gp(1)
|
||||
|
||||
If (s < 0 AndAlso t >= 0) OrElse (s >= 0 AndAlso t < 0) Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim area As Double = -p1(1) * p2(0) + p0(1) * (p2(0) - p1(0)) + p0(0) * (p1(1) - p2(1)) + p1(0) * p2(1)
|
||||
|
||||
If area < 0 Then
|
||||
If s <= 0 AndAlso s + t >= area Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
If s >= 0 AndAlso s + t <= area Then
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
End Class
|
||||
|
|
|
|||
Loading…
Reference in New Issue