Skip to content
Snippets Groups Projects
Commit bd1b8a25 authored by Sören Münker's avatar Sören Münker
Browse files

Refactor: Removal of unused code.

parent 8a1bf705
Branches
No related tags found
1 merge request!2Experiments
......@@ -51,19 +51,9 @@ Public Class AssemblyTiers2
Sub CatMain()
MsgBox("OK, lets start!")
''Test parameters
'iBoundingBoxCode = 1
'bBoundingBoxProjectionCheck = True
'bConnectivityCheck = False
'bAutomaticStep = False
'intStep = 5
'dCollSens = 2
'bChooseExtractionDirection = False
''number of analysed disassembly directions
''6 - only global axes, 12 - including local axes
'intJ = 6
'TODO: Include in Form
xlsPath = "D:\03_Dissertation\20_Tools\CATIA_NET\ProgData\"
'xlsFileName = "Centrifugal pump 5mm step"
CATIA = GetObject(, "CATIA.Application")
If CATIA Is Nothing Then CATIA = CreateObject("CATIA.Application")
......@@ -203,7 +193,7 @@ Public Class AssemblyTiers2
Debug.Print("Number of faces in assembly: " & CStr(intNumFaces))
'Export BB volumes of parts to Excel
'ExportBBVolumes()
ExportBBVolumes()
'Collision parameters
If bAutomaticStep Then
......@@ -229,13 +219,6 @@ Public Class AssemblyTiers2
aRemovalDistances(i, 5) = aAssemblyBoundaries(5) - aPartBBGlob(i, 4)
Next i
'MsgBox("Removal distances for " & cRelevantProducts.Item(1).PartNumber & ":" & vbNewLine &
'"X_pos = " & aRemovalDistances(0, 0) & vbNewLine &
'"X_neg = " & aRemovalDistances(0, 1) & vbNewLine &
'"Y_pos = " & aRemovalDistances(0, 2) & vbNewLine &
'"Y_neg = " & aRemovalDistances(0, 3) & vbNewLine &
'"Z_pos = " & aRemovalDistances(0, 4) & vbNewLine &
'"Z_neg = " & aRemovalDistances(0, 5))
'#################### Main algorithm ##########################
......@@ -438,8 +421,6 @@ entry1:
'if the disassembly tier is 1 lower (attention: tiers get reversed in the end to the assembly tiers!)
If secTier = intTier - 1 And Not (secTier = 0 And intTier = 1) Then
'Debug.Print("Collision with higher tier: " & oConflict1.FirstProduct.Name & " - " & oConflict1.SecondProduct.Name & " = " & oConflict1.Value)
'record precedence relation, because secProduct is an obstacle in the way of the current product
precedenceMatrix(int_i, iIndex) = 1
......@@ -680,19 +661,11 @@ exitCD:
Next intAxis
'Only for products with multiple extraction directions
If sum > 1 Then
'Add options to ComboBox
For intAxis = 0 To intJ - 1
If disassDir(int_i, intAxis) = 1 Then
'ExtractionDirection.ComboBox1.AddItem(d1.Item(intAxis))
End If
Next intAxis
'Highlight the product in CATIA
Dim selection5 As Selection
selection5 = CATIA.ActiveDocument.Selection
selection5.Clear()
selection5.Add(cRelevantProducts.Item(int_i + 1))
'Show dialog
'ExtractionDirection.Show
selection5.Clear()
'Translate chosen axis name back into index 0..11
Dim iChosenDir As Integer
......@@ -884,6 +857,7 @@ exitCD:
End If
End Function
Sub Liaison()
Dim n As Integer = cRelevantProducts.Count
......@@ -1048,15 +1022,6 @@ exitCD:
CATIA.StartCommand("Activate / Deactivate Component")
selection1.Clear()
intFasteners = intFasteners + 1
'ElseIf InStr(sName, "pin") > 0 Then
' Debug.Print(prod.Name + " was identified as a pin")
' selection1.Add(prod)
' primaryFasteners.Add(prod)
' CATIA.StartCommand("Activate / Deactivate Component")
' selection1.Clear()
' intFasteners = intFasteners + 1
ElseIf InStr(sName, "nut") > 0 Or (InStr(sName, "iso") > 0 And InStr(sName, "4161") > 0) Or (InStr(sName, "din") > 0 And (InStr(sName, "934") > 0 Or InStr(sName, "439") > 0)) Then
Debug.Print(prod.Name + " was identified as a nut")
selection1.Add(prod)
......@@ -1080,7 +1045,6 @@ exitCD:
End If
Next
'CATIA.StartCommand ("Activate / Deactivate Component")
Debug.Print("Deactivated " + CStr(intFasteners) + " fasteners")
intParts = intParts - intFasteners
Debug.Print(CStr(intParts) + " parts to assemble")
......@@ -1142,7 +1106,6 @@ exitCD:
Dim originpoint As HybridShapePointCoord
axissyst.GetOrigin(originCoord)
'MsgBox "X0 = " & CStr(originCoord(0)) & vbNewLine & "Y0 = " & CStr(originCoord(1)) & vbNewLine & "Z0 = " & CStr(originCoord(2))
originpoint = hybridShapeFactory1.AddNewPointCoord(originCoord(0), originCoord(1), originCoord(2))
axisref = part1.CreateReferenceFromObject(originpoint)
......@@ -1244,7 +1207,6 @@ exitCD:
part1.UpdateObject(HybridShapeExtremum5)
part1.UpdateObject(HybridShapeExtremum6)
'part1.Update
' Creates a 6 single points using the Extrenums as refs, so if the Extrenum was a line or surf, you can still off planes to these points
......@@ -1303,8 +1265,6 @@ exitCD:
part1.UpdateObject(Point5)
part1.UpdateObject(Point6)
'part1.Update
axissyst.IsCurrent = 1
'Read extremum coordinates
......@@ -1497,14 +1457,6 @@ exitCD:
End Sub
'Public Function ArrayLen(a As Object) As Integer
' If IsEmpty(a) Then
' ArrayLen = 0
' Else
' ArrayLen = UBound(a) - LBound(a) + 1
' End If
'End Function
Function Det3x3(dX11 As Double, dX12 As Double, dX13 As Double,
dX21 As Double, dX22 As Double, dX23 As Double,
dX31 As Double, dX32 As Double, dX33 As Double) As Double
......@@ -1707,22 +1659,9 @@ exitCD:
End Sub
Function collisionDetected(cClashes As Clashes, group1 As Group, group2 As Group) As Boolean
'cRelevantProducts As Collection, cDeactivated As Collection
collisionDetected = False
'define two groups
' Dim group1 As Group
'Dim group2 As Group
' group1 = cGroups.Add
' group2 = cGroups.Add
' group1.AddExplicit product1
' Dim relevantProduct As Product
' For Each relevantProduct In cRelevantProducts
' If Not relevantProduct.Name = product1.Name And Not productIsInCollection(relevantProduct, cDeactivated) Then
' group2.AddExplicit relevantProduct
' End If
' Next relevantProduct
'create a new clash analysis
Dim oClash As Clash
oClash = cClashes.Add
......@@ -1730,12 +1669,10 @@ exitCD:
oClash.FirstGroup = group1
oClash.SecondGroup = group2
oClash.InterferenceType = SPATypeLib.CatClashInterferenceType.catClashInterferenceTypeClearance
'oClash.Clearance = dCollSens
oClash.Compute()
Dim cConflicts As Conflicts
cConflicts = oClash.Conflicts
If cConflicts.Count > 0 Then
'MsgBox "Detected a collision: " & product1.Name
'If at least one conflict value exceeds the collision sensitivity, it is a collision
Dim oConflict As Conflict
Dim c As Integer
......@@ -1745,7 +1682,6 @@ exitCD:
If oConflict.Type = SPATypeLib.CatConflictType.catConflictTypeClash Then
If oConflict.Value < -dCollSens Then
collisionDetected = True
'Debug.Print("Clash detected: " & oConflict.FirstProduct.Name & " - " & oConflict.SecondProduct.Name & " = " & oConflict.Value)
Exit For
End If
End If
......@@ -1761,27 +1697,21 @@ exitCD:
oPosition.GetComponents(posArray)
If posArray(9) > aRemovalDistances(i1, 0) Then
productReachedFinalPosition = True
'MsgBox "X+ removal distance reached by " & objProd.Name
End If
If posArray(9) < aRemovalDistances(i1, 1) Then
productReachedFinalPosition = True
'MsgBox "X- removal distance reached by " & objProd.Name
End If
If posArray(10) > aRemovalDistances(i1, 2) Then
productReachedFinalPosition = True
'MsgBox "Y+ removal distance reached by " & objProd.Name
End If
If posArray(10) < aRemovalDistances(i1, 3) Then
productReachedFinalPosition = True
'MsgBox "Y- removal distance reached by " & objProd.Name
End If
If posArray(11) > aRemovalDistances(i1, 4) Then
productReachedFinalPosition = True
'MsgBox "Z+ removal distance reached by " & objProd.Name
End If
If posArray(11) < aRemovalDistances(i1, 5) Then
productReachedFinalPosition = True
'MsgBox "Z- removal distance reached by " & objProd.Name
End If
End Function
......@@ -1828,16 +1758,11 @@ exitCD:
oCurrentProd = oCurrentProd.ReferenceProduct 'You have to work with the "ReferenceProduct" object
lNumberOfItems = oCurrentProd.Products.Count
'For i = 1 To lNumberOfItems 'Clear out the rename array
' RenameArray(i) = "" 'Don't know if this is necessary
'Next
'Run through this loop once, to set everything to a dummy name, to avoid naming conflicts
For i = 1 To lNumberOfItems 'Cycle through the assembly's children
ItemToRename = oCurrentProd.Products.Item(i) 'Declare which item we are working on
ToRenamePartNumber = ItemToRename.PartNumber 'Get the Part Number
'ToRenamePartNumber = ItemToRename.DescriptionRef 'Toggle these two lines for testing
RenameArray(i) = ToRenamePartNumber 'Building the list of part names for the numbering loop
......@@ -1848,7 +1773,6 @@ exitCD:
End If
Next
CATIA.StatusBar = ItemToRename.Name & " > " & ToRenamePartNumber & "." & k
'MsgBox ItemToRename.Name & " / " & ToRenamePartNumber & "." & k 'This line is for testing only
ItemToRename.Name = ToRenamePartNumber & "TEMP." & k 'Set the new instance name, to a TEMP dummy value
Next
......@@ -1858,7 +1782,6 @@ exitCD:
ItemToRename = oCurrentProd.Products.Item(i)
ToRenamePartNumber = ItemToRename.PartNumber 'Toggle these two lines for testing
'ToRenamePartNumber = ItemToRename.DescriptionRef 'Toggle these two lines for testing
RenameArray(i) = ToRenamePartNumber
......@@ -1870,7 +1793,6 @@ exitCD:
Next
CATIA.StatusBar = ItemToRename.Name & " > " & ToRenamePartNumber & "." & k
'MsgBox ItemToRename.Name & " / " & ToRenamePartNumber & "." & k 'For testing
ItemToRename.Name = ToRenamePartNumber & "." & k 'Set the new instance name final
......@@ -1942,7 +1864,6 @@ Finish:
Do
intRel = System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
Loop While intRel > 0
'MsgBox("Final Released obj # " & intRel)
Catch ex As Exception
MsgBox("Error releasing object" & ex.ToString)
obj = Nothing
......@@ -1953,12 +1874,10 @@ Finish:
Sub ShowForm()
'Create a new form to input algorithm specifications first
'Dim Form2 As Form = New Form()
Me.Text = "Algorithm specifications"
Me.Size = New System.Drawing.Size(350, 400)
'Create elements for parameter inputs
'Code variant for BB calculation
'Dim BBCodeComboBox As ComboBox = New ComboBox()
BBCodeComboBox.Items.Add(1)
BBCodeComboBox.Items.Add(2)
BBCodeComboBox.Location = New System.Drawing.Point(200, 20)
......@@ -1969,28 +1888,24 @@ Finish:
Label1.Location = New System.Drawing.Point(20, 20)
Label1.Size = New System.Drawing.Size(150, 20)
'Projection check
'Dim BBPCCheckBox As System.Windows.Forms.CheckBox = New System.Windows.Forms.CheckBox()
BBPCCheckBox.Location = New System.Drawing.Point(200, 50)
Dim Label2 As System.Windows.Forms.Label = New System.Windows.Forms.Label()
Label2.Text = "BB projection check"
Label2.Location = New System.Drawing.Point(20, 50)
Label2.Size = New System.Drawing.Size(150, 20)
'Connectivity check
'Dim CCCheckBox As System.Windows.Forms.CheckBox = New System.Windows.Forms.CheckBox()
CCCheckBox.Location = New System.Drawing.Point(200, 80)
Dim Label3 As System.Windows.Forms.Label = New System.Windows.Forms.Label()
Label3.Text = "Connectivity check"
Label3.Location = New System.Drawing.Point(20, 80)
Label3.Size = New System.Drawing.Size(150, 20)
'Automatic step
'Dim AutoStepCheckBox As System.Windows.Forms.CheckBox = New System.Windows.Forms.CheckBox()
AutoStepCheckBox.Location = New System.Drawing.Point(200, 110)
Dim Label4 As System.Windows.Forms.Label = New System.Windows.Forms.Label()
Label4.Text = "Automatic step"
Label4.Location = New System.Drawing.Point(20, 110)
Label4.Size = New System.Drawing.Size(150, 20)
'Step
'Dim StepTextBox As System.Windows.Forms.TextBox = New System.Windows.Forms.TextBox()
StepTextBox.Text = 5
StepTextBox.Location = New System.Drawing.Point(200, 140)
StepTextBox.Size = New System.Drawing.Size(50, 20)
......@@ -1999,7 +1914,6 @@ Finish:
Label5.Location = New System.Drawing.Point(20, 140)
Label5.Size = New System.Drawing.Size(150, 20)
'Collision sensitivity
'Dim CollSensTextBox As System.Windows.Forms.TextBox = New System.Windows.Forms.TextBox()
CollSensTextBox.Text = 2
CollSensTextBox.Location = New System.Drawing.Point(200, 170)
CollSensTextBox.Size = New System.Drawing.Size(50, 20)
......@@ -2008,14 +1922,12 @@ Finish:
Label6.Location = New System.Drawing.Point(20, 170)
Label6.Size = New System.Drawing.Size(150, 20)
'Choice of extraction direction
'Dim ExtractDirCheckBox As System.Windows.Forms.CheckBox = New System.Windows.Forms.CheckBox()
ExtractDirCheckBox.Location = New System.Drawing.Point(200, 200)
Dim Label7 As System.Windows.Forms.Label = New System.Windows.Forms.Label()
Label7.Text = "Choice of disassembly axis"
Label7.Location = New System.Drawing.Point(20, 200)
Label7.Size = New System.Drawing.Size(150, 20)
'Number of disassembly axis
'Dim AxisComboBox As ComboBox = New ComboBox()
AxisComboBox.Items.Add(6)
AxisComboBox.Items.Add(12)
AxisComboBox.Location = New System.Drawing.Point(200, 230)
......@@ -2026,7 +1938,6 @@ Finish:
Label8.Location = New System.Drawing.Point(20, 230)
Label8.Size = New System.Drawing.Size(150, 20)
'Desired name of the output Excel file
'Dim XLSTextBox As System.Windows.Forms.TextBox = New System.Windows.Forms.TextBox()
XLSTextBox.Text = "Product"
XLSTextBox.Location = New System.Drawing.Point(200, 260)
Dim Label9 As System.Windows.Forms.Label = New System.Windows.Forms.Label()
......@@ -2034,7 +1945,6 @@ Finish:
Label9.Location = New System.Drawing.Point(20, 260)
Label9.Size = New System.Drawing.Size(150, 20)
'OK button
'Dim OKButton As System.Windows.Forms.Button = New System.Windows.Forms.Button()
OKButton.Text = "Accept parameters"
OKButton.Location = New System.Drawing.Point(100, 310)
OKButton.Size = New System.Drawing.Size(150, 40)
......
This diff is collapsed.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment