diff --git a/Wardrobe/GUI.vb b/Wardrobe/GUI.vb
index c05c3a2..f4ad408 100644
--- a/Wardrobe/GUI.vb
+++ b/Wardrobe/GUI.vb
@@ -1,534 +1,5 @@
Imports XCCLibrary
Public Class GUI
- 'Anton was here
- 'So was Mehdi
- 'New branch
- 'Anton test 2
- 'tttest
- Dim Control_ID
- Sub GUI_load() Handles MyBase.Load
- add_section()
-
- Control_ID = 0
-
- End Sub
- Sub add_section()
- ' adding the tab page
- Dim myTabPage As New TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage.Text = "Section " & TabContSec.TabPages.Count + 1
- myTabPage.Name = "Section_" & TabContSec.TabPages.Count + 1
-
- TabContSec.TabPages.Add(myTabPage)
- TabContSec.SelectedTab = myTabPage
-
- ' adding controls for section width and height
- Dim Width_lbl As New Label
- Width_lbl.Top = 10
- Width_lbl.Left = 10
- Width_lbl.Name = "Width_lb"
- Width_lbl.Text = "Section Width"
- myTabPage.Controls.Add(Width_lbl)
-
- Dim Width_tbox As New TextBox
- Width_tbox.Top = 10
- Width_tbox.Left = 120
- Width_tbox.Width = 120
- Width_tbox.Name = "Width_tb"
- myTabPage.Controls.Add(Width_tbox)
-
- Dim Height_lbl As New Label
- Height_lbl.Top = 35
- Height_lbl.Left = 10
- Height_lbl.Name = "Height_lb"
- Height_lbl.Text = "Section Height"
- myTabPage.Controls.Add(Height_lbl)
-
- Dim Height_tbox As New TextBox
- Height_tbox.Top = 35
- Height_tbox.Left = 120
- Height_tbox.Width = 120
- Height_tbox.Name = "Height_tb"
- myTabPage.Controls.Add(Height_tbox)
-
- End Sub
- Sub Del_section()
- ' Removing the tabpage
- If Section_gui.TabPages.Count > 1 Then
- Section_gui.TabPages.Remove(Section_gui.TabPages(Section_gui.TabPages.Count - 1))
- End If
- End Sub
-
- Sub add_hanger()
- 'Setting an ID of the item
- Control_ID += 1
-
- ' Geting the active tabpage and the location where to put the label
- Dim myTabPage As TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage = TabContSec.SelectedTab
-
- Dim y_pos = get_latest_position(myTabPage)
-
- y_pos = y_pos + 30
-
-
- 'adding the new controls
- Dim Hanger_lbl As New Label
- Hanger_lbl.Top = y_pos
- Hanger_lbl.Left = 10
- Hanger_lbl.Name = "Item_Hanger_" & Control_ID
- Hanger_lbl.Text = "Hanger"
- myTabPage.Controls.Add(Hanger_lbl)
-
- Dim Pos_tbox As New TextBox
- Pos_tbox.Top = y_pos
- Pos_tbox.Left = 180
- Pos_tbox.Width = 60
- Pos_tbox.Name = "Hanger_Pos_tb_" & Control_ID
- myTabPage.Controls.Add(Pos_tbox)
-
- Dim Pos_lbl As New Label
- Pos_lbl.Top = y_pos
- Pos_lbl.Left = 120
- Pos_lbl.Name = "Hanger_Pos_lb_" & Control_ID
- Pos_lbl.Text = "Position"
- myTabPage.Controls.Add(Pos_lbl)
-
- End Sub
-
- Sub add_hooks()
- 'Setting an ID of the item
- Control_ID += 1
-
- ' Geting the active tabpage and the location where to put the label
- Dim myTabPage As TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage = TabContSec.SelectedTab
-
- Dim y_pos = get_latest_position(myTabPage)
-
- y_pos = y_pos + 30
-
-
- 'adding the new controls
- Dim Hooks_lbl As New Label
- Hooks_lbl.Top = y_pos
- Hooks_lbl.Left = 10
- Hooks_lbl.Name = "Item_Hooks_" & Control_ID
- Hooks_lbl.Text = "Hooks"
- myTabPage.Controls.Add(Hooks_lbl)
-
- Dim Pos_tbox As New TextBox
- Pos_tbox.Top = y_pos
- Pos_tbox.Left = 180
- Pos_tbox.Width = 60
- Pos_tbox.Name = "Hooks_Pos_tb_" & Control_ID
- myTabPage.Controls.Add(Pos_tbox)
-
- Dim Pos_lbl As New Label
- Pos_lbl.Top = y_pos
- Pos_lbl.Left = 120
- Pos_lbl.Name = "Hooks_Pos_lb_" & Control_ID
- Pos_lbl.Text = "Position"
- myTabPage.Controls.Add(Pos_lbl)
-
- Dim Nr_tbox As New TextBox
- Nr_tbox.Top = y_pos
- Nr_tbox.Left = 320
- Nr_tbox.Width = 60
- Nr_tbox.Name = "Hooks_Nr_tb_" & Control_ID
- myTabPage.Controls.Add(Nr_tbox)
-
- Dim Nr_lbl As New Label
- Nr_lbl.Top = y_pos
- Nr_lbl.Left = 260
- Nr_lbl.Name = "Hooks_Nr_lb_" & Control_ID
- Nr_lbl.Text = "Quantity"
- myTabPage.Controls.Add(Nr_lbl)
-
- End Sub
-
- Sub add_basket()
- 'Setting an ID of the item
- Control_ID += 1
-
- ' Geting the active tabpage and the location where to put the label
- Dim myTabPage As TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage = TabContSec.SelectedTab
-
- Dim y_pos = get_latest_position(myTabPage)
-
- y_pos = y_pos + 30
-
-
- 'adding the new controls
- Dim Basket_lbl As New Label
- Basket_lbl.Top = y_pos
- Basket_lbl.Left = 10
- Basket_lbl.Name = "Item_Basket_" & Control_ID
- Basket_lbl.Text = "Basket"
- myTabPage.Controls.Add(Basket_lbl)
-
-
- Dim Pos_tbox As New TextBox
- Pos_tbox.Top = y_pos
- Pos_tbox.Left = 180
- Pos_tbox.Width = 60
- Pos_tbox.Name = "Basket_Pos_tb_" & Control_ID
- myTabPage.Controls.Add(Pos_tbox)
-
- Dim Pos_lbl As New Label
- Pos_lbl.Top = y_pos
- Pos_lbl.Left = 120
- Pos_lbl.Name = "Basket_Pos_lb_" & Control_ID
- Pos_lbl.Text = "Position"
- myTabPage.Controls.Add(Pos_lbl)
-
-
-
- Dim Depth_tbox As New TextBox
- Depth_tbox.Top = y_pos
- Depth_tbox.Left = 320
- Depth_tbox.Width = 60
- Depth_tbox.Name = "Basket_Depth_tb_" & Control_ID
- myTabPage.Controls.Add(Depth_tbox)
-
- Dim Depth_lbl As New Label
- Depth_lbl.Top = y_pos
- Depth_lbl.Left = 260
- Depth_lbl.Name = "Basket_Depth_lb_" & Control_ID
- Depth_lbl.Text = "Depth"
- myTabPage.Controls.Add(Depth_lbl)
-
-
-
- Dim Height_cmb As New ComboBox
- Height_cmb.Top = y_pos
- Height_cmb.Left = 460
- Height_cmb.Width = 60
- Height_cmb.Name = "Basket_Height_cmb_" & Control_ID
- Height_cmb.Items.Add("150")
- Height_cmb.Items.Add("300")
- Height_cmb.Items.Add("450")
- myTabPage.Controls.Add(Height_cmb)
-
- Dim Height_lbl As New Label
- Height_lbl.Top = y_pos
- Height_lbl.Left = 400
- Height_lbl.Name = "Basket_Height_lb_" & Control_ID
- Height_lbl.Text = "Height"
- myTabPage.Controls.Add(Height_lbl)
-
- End Sub
-
- Sub add_shelf()
- 'Setting an ID of the item
- Control_ID += 1
-
- ' Geting the active tabpage and the location where to put the label
- Dim myTabPage As TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage = TabContSec.SelectedTab
-
- Dim y_pos = get_latest_position(myTabPage)
-
- y_pos = y_pos + 30
-
-
- 'adding the new controls
- Dim Shelf_lbl As New Label
- Shelf_lbl.Top = y_pos
- Shelf_lbl.Left = 10
- Shelf_lbl.Name = "Item_Shelf_" & Control_ID
- Shelf_lbl.Text = "Shelf"
- myTabPage.Controls.Add(Shelf_lbl)
-
-
- Dim Pos_tbox As New TextBox
- Pos_tbox.Top = y_pos
- Pos_tbox.Left = 180
- Pos_tbox.Width = 60
- Pos_tbox.Name = "Shelf_Pos_tb_" & Control_ID
- myTabPage.Controls.Add(Pos_tbox)
-
- Dim Pos_lbl As New Label
- Pos_lbl.Top = y_pos
- Pos_lbl.Left = 120
- Pos_lbl.Name = "Shelf_Pos_lb_" & Control_ID
- Pos_lbl.Text = "Position"
- myTabPage.Controls.Add(Pos_lbl)
-
-
-
- Dim Depth_tbox As New TextBox
- Depth_tbox.Top = y_pos
- Depth_tbox.Left = 320
- Depth_tbox.Width = 60
- Depth_tbox.Name = "Shelf_Depth_tb_" & Control_ID
- myTabPage.Controls.Add(Depth_tbox)
-
- Dim Depth_lbl As New Label
- Depth_lbl.Top = y_pos
- Depth_lbl.Left = 260
- Depth_lbl.Name = "Shelf_Depth_lb_" & Control_ID
- Depth_lbl.Text = "Depth"
- myTabPage.Controls.Add(Depth_lbl)
-
-
-
- Dim Type_cmb As New ComboBox
- Type_cmb.Top = y_pos
- Type_cmb.Left = 460
- Type_cmb.Width = 60
- Type_cmb.Name = "Shelf_type_cmb_" & Control_ID
- Type_cmb.Items.Add("Flat")
- Type_cmb.Items.Add("Wire")
- myTabPage.Controls.Add(Type_cmb)
-
- Dim Height_lbl As New Label
- Height_lbl.Top = y_pos
- Height_lbl.Left = 400
- Height_lbl.Name = "Shelf_type_lb_" & Control_ID
- Height_lbl.Text = "Type"
- myTabPage.Controls.Add(Height_lbl)
-
- End Sub
-
- Sub add_drying_rack()
- 'Setting an ID of the item
- Control_ID += 1
-
- ' Geting the active tabpage and the location where to put the label
- Dim myTabPage As TabPage
-
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- myTabPage = TabContSec.SelectedTab
-
- Dim y_pos = get_latest_position(myTabPage)
-
- y_pos = y_pos + 30
-
-
- 'adding the new controls
- Dim Drying_lbl As New Label
- Drying_lbl.Top = y_pos
- Drying_lbl.Left = 10
- Drying_lbl.Name = "Item_Drying_" & Control_ID
- Drying_lbl.Text = "Drying Rack"
- myTabPage.Controls.Add(Drying_lbl)
-
-
- Dim Pos_tbox As New TextBox
- Pos_tbox.Top = y_pos
- Pos_tbox.Left = 180
- Pos_tbox.Width = 60
- Pos_tbox.Name = "Drying_Pos_tb_" & Control_ID
- myTabPage.Controls.Add(Pos_tbox)
-
- Dim Pos_lbl As New Label
- Pos_lbl.Top = y_pos
- Pos_lbl.Left = 120
- Pos_lbl.Name = "Drying_Pos_lb_" & Control_ID
- Pos_lbl.Text = "Position"
- myTabPage.Controls.Add(Pos_lbl)
-
-
- Dim Right_cb As New CheckBox
- Right_cb.Top = y_pos
- Right_cb.Left = 380
- Right_cb.Name = "Drying_Right_cb_" & Control_ID
- Right_cb.Text = "Right"
- myTabPage.Controls.Add(Right_cb)
-
-
-
- Dim Mid_cb As New CheckBox
- Mid_cb.Top = y_pos
- Mid_cb.Left = 320
- Mid_cb.Name = "Drying_mid_cb_" & Control_ID
- Mid_cb.Text = "Mid"
- myTabPage.Controls.Add(Mid_cb)
-
-
- Dim Left_cb As New CheckBox
- Left_cb.Top = y_pos
- Left_cb.Left = 260
- Left_cb.Name = "Drying_left_cb_" & Control_ID
- Left_cb.Text = "Left"
- myTabPage.Controls.Add(Left_cb)
- End Sub
- Function get_latest_position(myTabPage)
- Dim Y_pos As Integer = 0
-
- For Each ctl As Control In myTabPage.Controls
- If ctl.Location.Y > Y_pos Then
- Y_pos = ctl.Location.Y
- End If
- Next
-
- Return Y_pos
- End Function
-
- Function Populate_table_from_GUI()
- ' creating a set of tables, the data in the tables will be one row per item in the GUI and one table per section tab
- Dim Input As New DataSet
-
- Dim sectionTable As New DataTable
- sectionTable.Columns.Add("Section_width")
- sectionTable.Columns.Add("Section_height")
- sectionTable.Columns.Add("Type")
- sectionTable.Columns.Add("Position")
- sectionTable.Columns.Add("Depth")
- sectionTable.Columns.Add("Item_Height")
- sectionTable.Columns.Add("Type_of_shelf")
- sectionTable.Columns.Add("Quantity")
- sectionTable.Columns.Add("Right")
- sectionTable.Columns.Add("Mid")
- sectionTable.Columns.Add("Left")
-
-
- ' loop through all the tabs in the tab control and get the data
- Dim TabContSec As TabControl
- TabContSec = Section_gui
-
- For i = 0 To TabContSec.TabCount - 1
- sectionTable.Clear()
- sectionTable.TableName = "Section_" & i + 1
-
- Dim MyTabPage = TabContSec.TabPages(i)
- TabContSec.SelectedTab = MyTabPage
-
- ' Geting the data of the section
- Dim section_width = MyTabPage.Controls("Width_tb").Text
- Dim section_height = MyTabPage.Controls("Height_tb").Text
-
- For Each c As Control In MyTabPage.Controls
-
- ' using the name of the Item label to get the Item ID and type
- If c.Name.Contains("Item") Then
- Dim Splitname = c.Name.Split("_")
- Dim Item_Type = Splitname(1)
- Dim Item_ID = Splitname(2)
-
- Dim ItemRowNr As Integer
-
- ' adding a new row for the new item and start populating relevent colums with info from the GUI
- sectionTable.Rows.Add()
- ItemRowNr = sectionTable.Rows.Count - 1
- sectionTable.Rows(ItemRowNr)("Section_width") = section_width
- sectionTable.Rows(ItemRowNr)("Section_height") = section_height
-
- sectionTable.Rows(ItemRowNr)("Type") = Item_Type
-
- If Item_Type = "Basket" Then
- sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Basket_Pos_tb_" & Item_ID).Text
- sectionTable.Rows(ItemRowNr)("Depth") = MyTabPage.Controls("Basket_Depth_tb_" & Item_ID).Text
- sectionTable.Rows(ItemRowNr)("Item_Height") = MyTabPage.Controls("Basket_Height_cmb_" & Item_ID).Text
-
- ElseIf Item_Type = "Hanger" Then
- sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Hanger_Pos_tb_" & Item_ID).Text
-
- ElseIf Item_Type = "Hooks" Then
- sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Hooks_Pos_tb_" & Item_ID).Text
- sectionTable.Rows(ItemRowNr)("Quantity") = MyTabPage.Controls("Hooks_Nr_tb_" & Item_ID).Text
-
- ElseIf Item_Type = "Drying" Then
- sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Drying_Pos_tb_" & Item_ID).Text
- Dim CB As CheckBox
-
- CB = MyTabPage.Controls("Drying_Right_cb_" & Item_ID)
- sectionTable.Rows(ItemRowNr)("Right") = CB.Checked
-
- CB = MyTabPage.Controls("Drying_mid_cb_" & Item_ID)
- sectionTable.Rows(ItemRowNr)("Mid") = CB.Checked
-
- CB = MyTabPage.Controls("Drying_left_cb_" & Item_ID)
- sectionTable.Rows(ItemRowNr)("Left") = CB.Checked
-
- ElseIf Item_Type = "Shelf" Then
- sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Shelf_Pos_tb_" & Item_ID).Text
- sectionTable.Rows(ItemRowNr)("Depth") = MyTabPage.Controls("Shelf_Depth_tb_" & Item_ID).Text
- sectionTable.Rows(ItemRowNr)("Type_of_shelf") = MyTabPage.Controls("Shelf_type_cmb_" & Item_ID).Text
- End If
-
- End If
- Next
- Input.Tables.Add(sectionTable.Copy)
- Next
-
- Return Input
- End Function
-
- Private Sub Rail_btn_Click(sender As Object, e As EventArgs) Handles Rail_btn.Click
- add_section()
- End Sub
-
- Private Sub Del_rail_btn_Click(sender As Object, e As EventArgs) Handles Del_rail_btn.Click
- Del_section()
- End Sub
-
- Private Sub Hanger_btn_Click(sender As Object, e As EventArgs) Handles Hanger_btn.Click
- add_hanger()
- End Sub
-
- Private Sub Hooks_btn_Click(sender As Object, e As EventArgs) Handles Hooks_btn.Click
- add_hooks()
- End Sub
-
- Private Sub Basket_btn_Click(sender As Object, e As EventArgs) Handles Basket_btn.Click
- add_basket()
- End Sub
-
- Private Sub Shelf_btn_Click(sender As Object, e As EventArgs) Handles Shelf_btn.Click
- add_shelf()
- End Sub
-
- Private Sub Drying_btn_Click(sender As Object, e As EventArgs) Handles Drying_btn.Click
- add_drying_rack()
- End Sub
-
- Private Sub Build_btn_Click(sender As Object, e As EventArgs) Handles Build_btn.Click
-
- adminClass.loadSettings("C:\Users\Asus_station3\Desktop", "D:\OneDrive - XperDi AB\XperDi\DLL_Test\Wardrobe", "SolidWorks")
- XCCBaseClass.newDesign()
- 'comment test
- ExternalClass.PopulateTamplateXMLGroup()
- Dim Input As DataSet
- Input = Populate_table_from_GUI()
-
- Program.Add_Parts(Input)
-
- importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
- Dim GrNr = groupClass.NewGroupID
- Dim Design_table = designModel.selectDesign("*")
- Dim Design_name = Design_table.rows(0)("designName") '"135_0922244" 'CADLinkerClass.New_Design_Name '
- groupClass.InstantiateGroup(Design_name, GrNr, "START")
-
- '
- End Sub
-
- Private Sub Update_KB_Click(sender As Object, e As EventArgs) Handles Update_KB.Click
- Program.UpdateKB()
- End Sub
End Class
diff --git a/Wardrobe/Program.vb b/Wardrobe/Program.vb
index ab5542c..1419243 100644
--- a/Wardrobe/Program.vb
+++ b/Wardrobe/Program.vb
@@ -1,88 +1,7 @@
Imports XCCLibrary
Public Class Program
- 'lite ändring för branch test
- 'gratings
- Public Shared Function Add_Parts(Input As DataSet)
- Dim inst_ As Integer = 0
- Dim ParentID As Integer = 0
- Dim Last_section_height As Integer = 0
-
- For Each DT As DataTable In Input.Tables
- Dim Section_Width = DT.Rows(0)("Section_width")
- Dim Section_Height = DT.Rows(0)("Section_height")
-
- inst_ = ExternalClass.instantiate_parts(ParentID, "RAIL", "")
- ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
- If Last_section_height > Section_Height Then
- ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Last_section_height)
- Else
- ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Section_Height)
- End If
- Last_section_height = Section_Height
- ParentID = inst_
-
- For Each DR As DataRow In DT.Rows
- Dim Type = DR("Type")
- If Type = "Basket" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "BASKET", "")
- ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
- ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
- ExternalClass.modify_parameter_value("DP_CONFIGURATION", inst_, DR("Item_Height"))
-
- ElseIf Type = "Hanger" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "HANGER", "")
- ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
-
- ElseIf Type = "Hooks" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "HOOKS", "")
- ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
- ExternalClass.modify_parameter_value("DP_NUMBER", inst_, DR("Quantity"))
- ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
-
- ElseIf Type = "Drying" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "DRYING_RACK", "")
- ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
- ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
-
- If DR("Left") Then
- ExternalClass.instantiate_parts(inst_, "ROD", "1")
- End If
- If DR("Mid") Then
- ExternalClass.instantiate_parts(inst_, "ROD", "2")
- End If
- If DR("Right") Then
- ExternalClass.instantiate_parts(inst_, "ROD", "3")
- End If
-
- ElseIf Type = "Shelf" Then
-
- If DR("Type_of_shelf") = "Flat" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "FLAT_SHELF", "")
- ElseIf DR("Type_of_shelf") = "Wire" Then
- inst_ = ExternalClass.instantiate_parts(ParentID, "WIRE_SHELF", "")
- End If
- ExternalClass.modify_parameter_value("DP_DEPTH", inst_, DR("Depth"))
- ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
- ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
-
- End If
- Next
- Next
- inst_ = ExternalClass.instantiate_parts(ParentID, "RAIL", "")
- ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Last_section_height)
-
-
- Return groupClass.NewGroupID
-
- End Function
-
-
- Public Shared Sub UpdateKB()
- adminClass.loadSettings("C:\Users\Asus_station3\Desktop", "D:\OneDrive - XperDi AB\XperDi\DLL_Test\Wardrobe", "SolidWorks")
- adminClass.updateDatabase()
- End Sub
End Class
diff --git a/Wardrobe/Wardrobe.vbproj b/Wardrobe/Wardrobe.vbproj
index 92c0c48..e415141 100644
--- a/Wardrobe/Wardrobe.vbproj
+++ b/Wardrobe/Wardrobe.vbproj
@@ -98,6 +98,13 @@
Settings.settings
True
+
+
+ temp1.vb
+
+
+ Form
+
diff --git a/Wardrobe/temp.vb b/Wardrobe/temp.vb
new file mode 100644
index 0000000..ad86923
--- /dev/null
+++ b/Wardrobe/temp.vb
@@ -0,0 +1,87 @@
+Imports XCCLibrary
+
+Public Class temp
+ 'lite ändring för branch test
+ 'gratings
+ Public Shared Function Add_Parts(Input As DataSet)
+ Dim inst_ As Integer = 0
+ Dim ParentID As Integer = 0
+ Dim Last_section_height As Integer = 0
+
+ For Each DT As DataTable In Input.Tables
+ Dim Section_Width = DT.Rows(0)("Section_width")
+ Dim Section_Height = DT.Rows(0)("Section_height")
+
+ inst_ = ExternalClass.instantiate_parts(ParentID, "RAIL", "")
+ ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
+ If Last_section_height > Section_Height Then
+ ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Last_section_height)
+ Else
+ ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Section_Height)
+ End If
+ Last_section_height = Section_Height
+ ParentID = inst_
+
+ For Each DR As DataRow In DT.Rows
+ Dim Type = DR("Type")
+ If Type = "Basket" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "BASKET", "")
+ ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
+ ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
+ ExternalClass.modify_parameter_value("DP_CONFIGURATION", inst_, DR("Item_Height"))
+
+ ElseIf Type = "Hanger" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "HANGER", "")
+ ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
+
+ ElseIf Type = "Hooks" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "HOOKS", "")
+ ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
+ ExternalClass.modify_parameter_value("DP_NUMBER", inst_, DR("Quantity"))
+ ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
+
+ ElseIf Type = "Drying" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "DRYING_RACK", "")
+ ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
+ ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
+
+ If DR("Left") Then
+ ExternalClass.instantiate_parts(inst_, "ROD", "1")
+ End If
+ If DR("Mid") Then
+ ExternalClass.instantiate_parts(inst_, "ROD", "2")
+ End If
+ If DR("Right") Then
+ ExternalClass.instantiate_parts(inst_, "ROD", "3")
+ End If
+
+ ElseIf Type = "Shelf" Then
+
+ If DR("Type_of_shelf") = "Flat" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "FLAT_SHELF", "")
+ ElseIf DR("Type_of_shelf") = "Wire" Then
+ inst_ = ExternalClass.instantiate_parts(ParentID, "WIRE_SHELF", "")
+ End If
+ ExternalClass.modify_parameter_value("DP_DEPTH", inst_, DR("Depth"))
+ ExternalClass.modify_parameter_value("DP_POS", inst_, DR("Position"))
+ ExternalClass.modify_parameter_value("DP_WIDTH", inst_, Section_Width)
+
+ End If
+ Next
+
+
+ Next
+
+ inst_ = ExternalClass.instantiate_parts(ParentID, "RAIL", "")
+ ExternalClass.modify_parameter_value("DP_HEIGHT", inst_, Last_section_height)
+
+
+ Return groupClass.NewGroupID
+ End Function
+
+
+ Public Shared Sub UpdateKB()
+ adminClass.loadSettings("C:\Users\Asus_station3\Desktop", "D:\OneDrive - XperDi AB\XperDi\DLL_Test\Wardrobe", "SolidWorks")
+ adminClass.updateDatabase()
+ End Sub
+End Class
diff --git a/Wardrobe/temp1.Designer.vb b/Wardrobe/temp1.Designer.vb
new file mode 100644
index 0000000..8e8f743
--- /dev/null
+++ b/Wardrobe/temp1.Designer.vb
@@ -0,0 +1,290 @@
+
+Partial Class temp1
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+
+ Private Sub InitializeComponent()
+ Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(GUI))
+ Me.Section_gui = New System.Windows.Forms.TabControl()
+ Me.Rail_lb = New System.Windows.Forms.Label()
+ Me.Hanger_lb = New System.Windows.Forms.Label()
+ Me.Shelf_lb = New System.Windows.Forms.Label()
+ Me.Basket_lb = New System.Windows.Forms.Label()
+ Me.Drying_lb = New System.Windows.Forms.Label()
+ Me.Hooks_lb = New System.Windows.Forms.Label()
+ Me.Del_rail_lb = New System.Windows.Forms.Label()
+ Me.Del_rail_btn = New System.Windows.Forms.Button()
+ Me.Hanger_btn = New System.Windows.Forms.Button()
+ Me.Shelf_btn = New System.Windows.Forms.Button()
+ Me.Basket_btn = New System.Windows.Forms.Button()
+ Me.Drying_btn = New System.Windows.Forms.Button()
+ Me.Hooks_btn = New System.Windows.Forms.Button()
+ Me.Rail_btn = New System.Windows.Forms.Button()
+ Me.Build_btn = New System.Windows.Forms.Button()
+ Me.Update_KB = New System.Windows.Forms.Button()
+ Me.SuspendLayout()
+ '
+ 'Section_gui
+ '
+ Me.Section_gui.Location = New System.Drawing.Point(18, 298)
+ Me.Section_gui.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Section_gui.Name = "Section_gui"
+ Me.Section_gui.SelectedIndex = 0
+ Me.Section_gui.Size = New System.Drawing.Size(822, 703)
+ Me.Section_gui.TabIndex = 0
+ '
+ 'Rail_lb
+ '
+ Me.Rail_lb.AutoSize = True
+ Me.Rail_lb.Location = New System.Drawing.Point(14, 118)
+ Me.Rail_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Rail_lb.Name = "Rail_lb"
+ Me.Rail_lb.Size = New System.Drawing.Size(103, 20)
+ Me.Rail_lb.TabIndex = 13
+ Me.Rail_lb.Text = "Add Wall Rail"
+ '
+ 'Hanger_lb
+ '
+ Me.Hanger_lb.AutoSize = True
+ Me.Hanger_lb.Location = New System.Drawing.Point(162, 118)
+ Me.Hanger_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Hanger_lb.Name = "Hanger_lb"
+ Me.Hanger_lb.Size = New System.Drawing.Size(95, 20)
+ Me.Hanger_lb.TabIndex = 14
+ Me.Hanger_lb.Text = "Add Hanger"
+ '
+ 'Shelf_lb
+ '
+ Me.Shelf_lb.AutoSize = True
+ Me.Shelf_lb.Location = New System.Drawing.Point(304, 118)
+ Me.Shelf_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Shelf_lb.Name = "Shelf_lb"
+ Me.Shelf_lb.Size = New System.Drawing.Size(79, 20)
+ Me.Shelf_lb.TabIndex = 15
+ Me.Shelf_lb.Text = "Add Shelf"
+ '
+ 'Basket_lb
+ '
+ Me.Basket_lb.AutoSize = True
+ Me.Basket_lb.Location = New System.Drawing.Point(444, 118)
+ Me.Basket_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Basket_lb.Name = "Basket_lb"
+ Me.Basket_lb.Size = New System.Drawing.Size(92, 20)
+ Me.Basket_lb.TabIndex = 16
+ Me.Basket_lb.Text = "Add Basket"
+ '
+ 'Drying_lb
+ '
+ Me.Drying_lb.AutoSize = True
+ Me.Drying_lb.Location = New System.Drawing.Point(562, 118)
+ Me.Drying_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Drying_lb.Name = "Drying_lb"
+ Me.Drying_lb.Size = New System.Drawing.Size(128, 20)
+ Me.Drying_lb.TabIndex = 17
+ Me.Drying_lb.Text = "Add Drying Rack"
+ '
+ 'Hooks_lb
+ '
+ Me.Hooks_lb.AutoSize = True
+ Me.Hooks_lb.Location = New System.Drawing.Point(718, 118)
+ Me.Hooks_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Hooks_lb.Name = "Hooks_lb"
+ Me.Hooks_lb.Size = New System.Drawing.Size(88, 20)
+ Me.Hooks_lb.TabIndex = 18
+ Me.Hooks_lb.Text = "Add Hooks"
+ '
+ 'Del_rail_lb
+ '
+ Me.Del_rail_lb.AutoSize = True
+ Me.Del_rail_lb.Location = New System.Drawing.Point(14, 243)
+ Me.Del_rail_lb.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0)
+ Me.Del_rail_lb.Name = "Del_rail_lb"
+ Me.Del_rail_lb.Size = New System.Drawing.Size(133, 20)
+ Me.Del_rail_lb.TabIndex = 20
+ Me.Del_rail_lb.Text = "Remove Wall Rail"
+ '
+ 'Del_rail_btn
+ '
+ Me.Del_rail_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Del_rail_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.remove_b
+ Me.Del_rail_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Del_rail_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Del_rail_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Del_rail_btn.Location = New System.Drawing.Point(24, 162)
+ Me.Del_rail_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Del_rail_btn.Name = "Del_rail_btn"
+ Me.Del_rail_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Del_rail_btn.TabIndex = 19
+ Me.Del_rail_btn.UseVisualStyleBackColor = False
+ '
+ 'Hanger_btn
+ '
+ Me.Hanger_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Hanger_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Hanger_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Hanger_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Hanger_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Hanger_btn.Location = New System.Drawing.Point(166, 37)
+ Me.Hanger_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Hanger_btn.Name = "Hanger_btn"
+ Me.Hanger_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Hanger_btn.TabIndex = 12
+ Me.Hanger_btn.UseVisualStyleBackColor = False
+ '
+ 'Shelf_btn
+ '
+ Me.Shelf_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Shelf_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Shelf_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Shelf_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Shelf_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Shelf_btn.Location = New System.Drawing.Point(308, 70)
+ Me.Shelf_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Shelf_btn.Name = "Shelf_btn"
+ Me.Shelf_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Shelf_btn.TabIndex = 11
+ Me.Shelf_btn.UseVisualStyleBackColor = False
+ '
+ 'Basket_btn
+ '
+ Me.Basket_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Basket_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Basket_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Basket_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Basket_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Basket_btn.Location = New System.Drawing.Point(448, 37)
+ Me.Basket_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Basket_btn.Name = "Basket_btn"
+ Me.Basket_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Basket_btn.TabIndex = 10
+ Me.Basket_btn.UseVisualStyleBackColor = False
+ '
+ 'Drying_btn
+ '
+ Me.Drying_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Drying_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Drying_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Drying_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Drying_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Drying_btn.Location = New System.Drawing.Point(591, 37)
+ Me.Drying_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Drying_btn.Name = "Drying_btn"
+ Me.Drying_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Drying_btn.TabIndex = 9
+ Me.Drying_btn.UseVisualStyleBackColor = False
+ '
+ 'Hooks_btn
+ '
+ Me.Hooks_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Hooks_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Hooks_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Hooks_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Hooks_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Hooks_btn.Location = New System.Drawing.Point(723, 37)
+ Me.Hooks_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Hooks_btn.Name = "Hooks_btn"
+ Me.Hooks_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Hooks_btn.TabIndex = 8
+ Me.Hooks_btn.UseVisualStyleBackColor = False
+ '
+ 'Rail_btn
+ '
+ Me.Rail_btn.BackColor = System.Drawing.SystemColors.InactiveBorder
+ Me.Rail_btn.BackgroundImage = Global.Wardrobe.My.Resources.Resources.add_b
+ Me.Rail_btn.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
+ Me.Rail_btn.FlatAppearance.BorderColor = System.Drawing.SystemColors.Highlight
+ Me.Rail_btn.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Rail_btn.Location = New System.Drawing.Point(24, 37)
+ Me.Rail_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Rail_btn.Name = "Rail_btn"
+ Me.Rail_btn.Size = New System.Drawing.Size(75, 77)
+ Me.Rail_btn.TabIndex = 1
+ Me.Rail_btn.UseVisualStyleBackColor = False
+ '
+ 'Build_btn
+ '
+ Me.Build_btn.Location = New System.Drawing.Point(654, 226)
+ Me.Build_btn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Build_btn.Name = "Build_btn"
+ Me.Build_btn.Size = New System.Drawing.Size(144, 52)
+ Me.Build_btn.TabIndex = 21
+ Me.Build_btn.Text = "Build"
+ Me.Build_btn.UseVisualStyleBackColor = True
+ '
+ 'Update_KB
+ '
+ Me.Update_KB.Location = New System.Drawing.Point(476, 226)
+ Me.Update_KB.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Update_KB.Name = "Update_KB"
+ Me.Update_KB.Size = New System.Drawing.Size(144, 52)
+ Me.Update_KB.TabIndex = 22
+ Me.Update_KB.Text = "Update KB"
+ Me.Update_KB.UseVisualStyleBackColor = True
+ '
+ 'GUI
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(858, 1020)
+ Me.Controls.Add(Me.Update_KB)
+ Me.Controls.Add(Me.Build_btn)
+ Me.Controls.Add(Me.Del_rail_lb)
+ Me.Controls.Add(Me.Del_rail_btn)
+ Me.Controls.Add(Me.Hooks_lb)
+ Me.Controls.Add(Me.Drying_lb)
+ Me.Controls.Add(Me.Basket_lb)
+ Me.Controls.Add(Me.Shelf_lb)
+ Me.Controls.Add(Me.Hanger_lb)
+ Me.Controls.Add(Me.Rail_lb)
+ Me.Controls.Add(Me.Hanger_btn)
+ Me.Controls.Add(Me.Shelf_btn)
+ Me.Controls.Add(Me.Basket_btn)
+ Me.Controls.Add(Me.Drying_btn)
+ Me.Controls.Add(Me.Hooks_btn)
+ Me.Controls.Add(Me.Rail_btn)
+ Me.Controls.Add(Me.Section_gui)
+ Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
+ Me.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
+ Me.Name = "temp1"
+ Me.Text = "Build a wardrobe"
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+ Friend WithEvents Section_gui As TabControl
+ Friend WithEvents Rail_btn As Button
+ Friend WithEvents Hooks_btn As Button
+ Friend WithEvents Drying_btn As Button
+ Friend WithEvents Basket_btn As Button
+ Friend WithEvents Shelf_btn As Button
+ Friend WithEvents Hanger_btn As Button
+ Friend WithEvents Rail_lb As Label
+ Friend WithEvents Hanger_lb As Label
+ Friend WithEvents Shelf_lb As Label
+ Friend WithEvents Basket_lb As Label
+ Friend WithEvents Drying_lb As Label
+ Friend WithEvents Hooks_lb As Label
+ Friend WithEvents Del_rail_lb As Label
+ Friend WithEvents Del_rail_btn As Button
+ Friend WithEvents Build_btn As Button
+ Friend WithEvents Update_KB As Button
+End Class
+
diff --git a/Wardrobe/temp1.vb b/Wardrobe/temp1.vb
new file mode 100644
index 0000000..da4e735
--- /dev/null
+++ b/Wardrobe/temp1.vb
@@ -0,0 +1,534 @@
+Imports XCCLibrary
+
+Public Class temp1
+ 'Anton was here
+ 'So was Mehdi
+ 'New branch
+ 'Anton test 2
+ 'tttest
+ Dim Control_ID
+
+ Sub GUI_load() Handles MyBase.Load
+ add_section()
+
+ Control_ID = 0
+
+ End Sub
+ Sub add_section()
+ ' adding the tab page
+ Dim myTabPage As New TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage.Text = "Section " & TabContSec.TabPages.Count + 1
+ myTabPage.Name = "Section_" & TabContSec.TabPages.Count + 1
+
+ TabContSec.TabPages.Add(myTabPage)
+ TabContSec.SelectedTab = myTabPage
+
+ ' adding controls for section width and height
+ Dim Width_lbl As New Label
+ Width_lbl.Top = 10
+ Width_lbl.Left = 10
+ Width_lbl.Name = "Width_lb"
+ Width_lbl.Text = "Section Width"
+ myTabPage.Controls.Add(Width_lbl)
+
+ Dim Width_tbox As New TextBox
+ Width_tbox.Top = 10
+ Width_tbox.Left = 120
+ Width_tbox.Width = 120
+ Width_tbox.Name = "Width_tb"
+ myTabPage.Controls.Add(Width_tbox)
+
+ Dim Height_lbl As New Label
+ Height_lbl.Top = 35
+ Height_lbl.Left = 10
+ Height_lbl.Name = "Height_lb"
+ Height_lbl.Text = "Section Height"
+ myTabPage.Controls.Add(Height_lbl)
+
+ Dim Height_tbox As New TextBox
+ Height_tbox.Top = 35
+ Height_tbox.Left = 120
+ Height_tbox.Width = 120
+ Height_tbox.Name = "Height_tb"
+ myTabPage.Controls.Add(Height_tbox)
+
+ End Sub
+ Sub Del_section()
+ ' Removing the tabpage
+ If Section_gui.TabPages.Count > 1 Then
+ Section_gui.TabPages.Remove(Section_gui.TabPages(Section_gui.TabPages.Count - 1))
+ End If
+ End Sub
+
+ Sub add_hanger()
+ 'Setting an ID of the item
+ Control_ID += 1
+
+ ' Geting the active tabpage and the location where to put the label
+ Dim myTabPage As TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage = TabContSec.SelectedTab
+
+ Dim y_pos = get_latest_position(myTabPage)
+
+ y_pos = y_pos + 30
+
+
+ 'adding the new controls
+ Dim Hanger_lbl As New Label
+ Hanger_lbl.Top = y_pos
+ Hanger_lbl.Left = 10
+ Hanger_lbl.Name = "Item_Hanger_" & Control_ID
+ Hanger_lbl.Text = "Hanger"
+ myTabPage.Controls.Add(Hanger_lbl)
+
+ Dim Pos_tbox As New TextBox
+ Pos_tbox.Top = y_pos
+ Pos_tbox.Left = 180
+ Pos_tbox.Width = 60
+ Pos_tbox.Name = "Hanger_Pos_tb_" & Control_ID
+ myTabPage.Controls.Add(Pos_tbox)
+
+ Dim Pos_lbl As New Label
+ Pos_lbl.Top = y_pos
+ Pos_lbl.Left = 120
+ Pos_lbl.Name = "Hanger_Pos_lb_" & Control_ID
+ Pos_lbl.Text = "Position"
+ myTabPage.Controls.Add(Pos_lbl)
+
+ End Sub
+
+ Sub add_hooks()
+ 'Setting an ID of the item
+ Control_ID += 1
+
+ ' Geting the active tabpage and the location where to put the label
+ Dim myTabPage As TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage = TabContSec.SelectedTab
+
+ Dim y_pos = get_latest_position(myTabPage)
+
+ y_pos = y_pos + 30
+
+
+ 'adding the new controls
+ Dim Hooks_lbl As New Label
+ Hooks_lbl.Top = y_pos
+ Hooks_lbl.Left = 10
+ Hooks_lbl.Name = "Item_Hooks_" & Control_ID
+ Hooks_lbl.Text = "Hooks"
+ myTabPage.Controls.Add(Hooks_lbl)
+
+ Dim Pos_tbox As New TextBox
+ Pos_tbox.Top = y_pos
+ Pos_tbox.Left = 180
+ Pos_tbox.Width = 60
+ Pos_tbox.Name = "Hooks_Pos_tb_" & Control_ID
+ myTabPage.Controls.Add(Pos_tbox)
+
+ Dim Pos_lbl As New Label
+ Pos_lbl.Top = y_pos
+ Pos_lbl.Left = 120
+ Pos_lbl.Name = "Hooks_Pos_lb_" & Control_ID
+ Pos_lbl.Text = "Position"
+ myTabPage.Controls.Add(Pos_lbl)
+
+ Dim Nr_tbox As New TextBox
+ Nr_tbox.Top = y_pos
+ Nr_tbox.Left = 320
+ Nr_tbox.Width = 60
+ Nr_tbox.Name = "Hooks_Nr_tb_" & Control_ID
+ myTabPage.Controls.Add(Nr_tbox)
+
+ Dim Nr_lbl As New Label
+ Nr_lbl.Top = y_pos
+ Nr_lbl.Left = 260
+ Nr_lbl.Name = "Hooks_Nr_lb_" & Control_ID
+ Nr_lbl.Text = "Quantity"
+ myTabPage.Controls.Add(Nr_lbl)
+
+ End Sub
+
+ Sub add_basket()
+ 'Setting an ID of the item
+ Control_ID += 1
+
+ ' Geting the active tabpage and the location where to put the label
+ Dim myTabPage As TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage = TabContSec.SelectedTab
+
+ Dim y_pos = get_latest_position(myTabPage)
+
+ y_pos = y_pos + 30
+
+
+ 'adding the new controls
+ Dim Basket_lbl As New Label
+ Basket_lbl.Top = y_pos
+ Basket_lbl.Left = 10
+ Basket_lbl.Name = "Item_Basket_" & Control_ID
+ Basket_lbl.Text = "Basket"
+ myTabPage.Controls.Add(Basket_lbl)
+
+
+ Dim Pos_tbox As New TextBox
+ Pos_tbox.Top = y_pos
+ Pos_tbox.Left = 180
+ Pos_tbox.Width = 60
+ Pos_tbox.Name = "Basket_Pos_tb_" & Control_ID
+ myTabPage.Controls.Add(Pos_tbox)
+
+ Dim Pos_lbl As New Label
+ Pos_lbl.Top = y_pos
+ Pos_lbl.Left = 120
+ Pos_lbl.Name = "Basket_Pos_lb_" & Control_ID
+ Pos_lbl.Text = "Position"
+ myTabPage.Controls.Add(Pos_lbl)
+
+
+
+ Dim Depth_tbox As New TextBox
+ Depth_tbox.Top = y_pos
+ Depth_tbox.Left = 320
+ Depth_tbox.Width = 60
+ Depth_tbox.Name = "Basket_Depth_tb_" & Control_ID
+ myTabPage.Controls.Add(Depth_tbox)
+
+ Dim Depth_lbl As New Label
+ Depth_lbl.Top = y_pos
+ Depth_lbl.Left = 260
+ Depth_lbl.Name = "Basket_Depth_lb_" & Control_ID
+ Depth_lbl.Text = "Depth"
+ myTabPage.Controls.Add(Depth_lbl)
+
+
+
+ Dim Height_cmb As New ComboBox
+ Height_cmb.Top = y_pos
+ Height_cmb.Left = 460
+ Height_cmb.Width = 60
+ Height_cmb.Name = "Basket_Height_cmb_" & Control_ID
+ Height_cmb.Items.Add("150")
+ Height_cmb.Items.Add("300")
+ Height_cmb.Items.Add("450")
+ myTabPage.Controls.Add(Height_cmb)
+
+ Dim Height_lbl As New Label
+ Height_lbl.Top = y_pos
+ Height_lbl.Left = 400
+ Height_lbl.Name = "Basket_Height_lb_" & Control_ID
+ Height_lbl.Text = "Height"
+ myTabPage.Controls.Add(Height_lbl)
+
+ End Sub
+
+ Sub add_shelf()
+ 'Setting an ID of the item
+ Control_ID += 1
+
+ ' Geting the active tabpage and the location where to put the label
+ Dim myTabPage As TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage = TabContSec.SelectedTab
+
+ Dim y_pos = get_latest_position(myTabPage)
+
+ y_pos = y_pos + 30
+
+
+ 'adding the new controls
+ Dim Shelf_lbl As New Label
+ Shelf_lbl.Top = y_pos
+ Shelf_lbl.Left = 10
+ Shelf_lbl.Name = "Item_Shelf_" & Control_ID
+ Shelf_lbl.Text = "Shelf"
+ myTabPage.Controls.Add(Shelf_lbl)
+
+
+ Dim Pos_tbox As New TextBox
+ Pos_tbox.Top = y_pos
+ Pos_tbox.Left = 180
+ Pos_tbox.Width = 60
+ Pos_tbox.Name = "Shelf_Pos_tb_" & Control_ID
+ myTabPage.Controls.Add(Pos_tbox)
+
+ Dim Pos_lbl As New Label
+ Pos_lbl.Top = y_pos
+ Pos_lbl.Left = 120
+ Pos_lbl.Name = "Shelf_Pos_lb_" & Control_ID
+ Pos_lbl.Text = "Position"
+ myTabPage.Controls.Add(Pos_lbl)
+
+
+
+ Dim Depth_tbox As New TextBox
+ Depth_tbox.Top = y_pos
+ Depth_tbox.Left = 320
+ Depth_tbox.Width = 60
+ Depth_tbox.Name = "Shelf_Depth_tb_" & Control_ID
+ myTabPage.Controls.Add(Depth_tbox)
+
+ Dim Depth_lbl As New Label
+ Depth_lbl.Top = y_pos
+ Depth_lbl.Left = 260
+ Depth_lbl.Name = "Shelf_Depth_lb_" & Control_ID
+ Depth_lbl.Text = "Depth"
+ myTabPage.Controls.Add(Depth_lbl)
+
+
+
+ Dim Type_cmb As New ComboBox
+ Type_cmb.Top = y_pos
+ Type_cmb.Left = 460
+ Type_cmb.Width = 60
+ Type_cmb.Name = "Shelf_type_cmb_" & Control_ID
+ Type_cmb.Items.Add("Flat")
+ Type_cmb.Items.Add("Wire")
+ myTabPage.Controls.Add(Type_cmb)
+
+ Dim Height_lbl As New Label
+ Height_lbl.Top = y_pos
+ Height_lbl.Left = 400
+ Height_lbl.Name = "Shelf_type_lb_" & Control_ID
+ Height_lbl.Text = "Type"
+ myTabPage.Controls.Add(Height_lbl)
+
+ End Sub
+
+ Sub add_drying_rack()
+ 'Setting an ID of the item
+ Control_ID += 1
+
+ ' Geting the active tabpage and the location where to put the label
+ Dim myTabPage As TabPage
+
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ myTabPage = TabContSec.SelectedTab
+
+ Dim y_pos = get_latest_position(myTabPage)
+
+ y_pos = y_pos + 30
+
+
+ 'adding the new controls
+ Dim Drying_lbl As New Label
+ Drying_lbl.Top = y_pos
+ Drying_lbl.Left = 10
+ Drying_lbl.Name = "Item_Drying_" & Control_ID
+ Drying_lbl.Text = "Drying Rack"
+ myTabPage.Controls.Add(Drying_lbl)
+
+
+ Dim Pos_tbox As New TextBox
+ Pos_tbox.Top = y_pos
+ Pos_tbox.Left = 180
+ Pos_tbox.Width = 60
+ Pos_tbox.Name = "Drying_Pos_tb_" & Control_ID
+ myTabPage.Controls.Add(Pos_tbox)
+
+ Dim Pos_lbl As New Label
+ Pos_lbl.Top = y_pos
+ Pos_lbl.Left = 120
+ Pos_lbl.Name = "Drying_Pos_lb_" & Control_ID
+ Pos_lbl.Text = "Position"
+ myTabPage.Controls.Add(Pos_lbl)
+
+
+ Dim Right_cb As New CheckBox
+ Right_cb.Top = y_pos
+ Right_cb.Left = 380
+ Right_cb.Name = "Drying_Right_cb_" & Control_ID
+ Right_cb.Text = "Right"
+ myTabPage.Controls.Add(Right_cb)
+
+
+
+ Dim Mid_cb As New CheckBox
+ Mid_cb.Top = y_pos
+ Mid_cb.Left = 320
+ Mid_cb.Name = "Drying_mid_cb_" & Control_ID
+ Mid_cb.Text = "Mid"
+ myTabPage.Controls.Add(Mid_cb)
+
+
+ Dim Left_cb As New CheckBox
+ Left_cb.Top = y_pos
+ Left_cb.Left = 260
+ Left_cb.Name = "Drying_left_cb_" & Control_ID
+ Left_cb.Text = "Left"
+ myTabPage.Controls.Add(Left_cb)
+ End Sub
+ Function get_latest_position(myTabPage)
+ Dim Y_pos As Integer = 0
+
+ For Each ctl As Control In myTabPage.Controls
+ If ctl.Location.Y > Y_pos Then
+ Y_pos = ctl.Location.Y
+ End If
+ Next
+
+ Return Y_pos
+ End Function
+
+ Function Populate_table_from_GUI()
+ ' creating a set of tables, the data in the tables will be one row per item in the GUI and one table per section tab
+ Dim Input As New DataSet
+
+ Dim sectionTable As New DataTable
+ sectionTable.Columns.Add("Section_width")
+ sectionTable.Columns.Add("Section_height")
+ sectionTable.Columns.Add("Type")
+ sectionTable.Columns.Add("Position")
+ sectionTable.Columns.Add("Depth")
+ sectionTable.Columns.Add("Item_Height")
+ sectionTable.Columns.Add("Type_of_shelf")
+ sectionTable.Columns.Add("Quantity")
+ sectionTable.Columns.Add("Right")
+ sectionTable.Columns.Add("Mid")
+ sectionTable.Columns.Add("Left")
+
+
+ ' loop through all the tabs in the tab control and get the data
+ Dim TabContSec As TabControl
+ TabContSec = Section_gui
+
+ For i = 0 To TabContSec.TabCount - 1
+ sectionTable.Clear()
+ sectionTable.TableName = "Section_" & i + 1
+
+ Dim MyTabPage = TabContSec.TabPages(i)
+ TabContSec.SelectedTab = MyTabPage
+
+ ' Geting the data of the section
+ Dim section_width = MyTabPage.Controls("Width_tb").Text
+ Dim section_height = MyTabPage.Controls("Height_tb").Text
+
+ For Each c As Control In MyTabPage.Controls
+
+ ' using the name of the Item label to get the Item ID and type
+ If c.Name.Contains("Item") Then
+ Dim Splitname = c.Name.Split("_")
+ Dim Item_Type = Splitname(1)
+ Dim Item_ID = Splitname(2)
+
+ Dim ItemRowNr As Integer
+
+ ' adding a new row for the new item and start populating relevent colums with info from the GUI
+ sectionTable.Rows.Add()
+ ItemRowNr = sectionTable.Rows.Count - 1
+ sectionTable.Rows(ItemRowNr)("Section_width") = section_width
+ sectionTable.Rows(ItemRowNr)("Section_height") = section_height
+
+ sectionTable.Rows(ItemRowNr)("Type") = Item_Type
+
+ If Item_Type = "Basket" Then
+ sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Basket_Pos_tb_" & Item_ID).Text
+ sectionTable.Rows(ItemRowNr)("Depth") = MyTabPage.Controls("Basket_Depth_tb_" & Item_ID).Text
+ sectionTable.Rows(ItemRowNr)("Item_Height") = MyTabPage.Controls("Basket_Height_cmb_" & Item_ID).Text
+
+ ElseIf Item_Type = "Hanger" Then
+ sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Hanger_Pos_tb_" & Item_ID).Text
+
+ ElseIf Item_Type = "Hooks" Then
+ sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Hooks_Pos_tb_" & Item_ID).Text
+ sectionTable.Rows(ItemRowNr)("Quantity") = MyTabPage.Controls("Hooks_Nr_tb_" & Item_ID).Text
+
+ ElseIf Item_Type = "Drying" Then
+ sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Drying_Pos_tb_" & Item_ID).Text
+ Dim CB As CheckBox
+
+ CB = MyTabPage.Controls("Drying_Right_cb_" & Item_ID)
+ sectionTable.Rows(ItemRowNr)("Right") = CB.Checked
+
+ CB = MyTabPage.Controls("Drying_mid_cb_" & Item_ID)
+ sectionTable.Rows(ItemRowNr)("Mid") = CB.Checked
+
+ CB = MyTabPage.Controls("Drying_left_cb_" & Item_ID)
+ sectionTable.Rows(ItemRowNr)("Left") = CB.Checked
+
+ ElseIf Item_Type = "Shelf" Then
+ sectionTable.Rows(ItemRowNr)("Position") = MyTabPage.Controls("Shelf_Pos_tb_" & Item_ID).Text
+ sectionTable.Rows(ItemRowNr)("Depth") = MyTabPage.Controls("Shelf_Depth_tb_" & Item_ID).Text
+ sectionTable.Rows(ItemRowNr)("Type_of_shelf") = MyTabPage.Controls("Shelf_type_cmb_" & Item_ID).Text
+ End If
+
+ End If
+ Next
+ Input.Tables.Add(sectionTable.Copy)
+ Next
+
+ Return Input
+ End Function
+
+ Private Sub Rail_btn_Click(sender As Object, e As EventArgs) Handles Rail_btn.Click
+ add_section()
+ End Sub
+
+ Private Sub Del_rail_btn_Click(sender As Object, e As EventArgs) Handles Del_rail_btn.Click
+ Del_section()
+ End Sub
+
+ Private Sub Hanger_btn_Click(sender As Object, e As EventArgs) Handles Hanger_btn.Click
+ add_hanger()
+ End Sub
+
+ Private Sub Hooks_btn_Click(sender As Object, e As EventArgs) Handles Hooks_btn.Click
+ add_hooks()
+ End Sub
+
+ Private Sub Basket_btn_Click(sender As Object, e As EventArgs) Handles Basket_btn.Click
+ add_basket()
+ End Sub
+
+ Private Sub Shelf_btn_Click(sender As Object, e As EventArgs) Handles Shelf_btn.Click
+ add_shelf()
+ End Sub
+
+ Private Sub Drying_btn_Click(sender As Object, e As EventArgs) Handles Drying_btn.Click
+ add_drying_rack()
+ End Sub
+
+ Private Sub Build_btn_Click(sender As Object, e As EventArgs) Handles Build_btn.Click
+
+ adminClass.loadSettings("C:\Users\Asus_station3\Desktop", "D:\OneDrive - XperDi AB\XperDi\DLL_Test\Wardrobe", "SolidWorks")
+ XCCBaseClass.newDesign()
+ 'comment test
+ ExternalClass.PopulateTamplateXMLGroup()
+ Dim Input As DataSet
+ Input = Populate_table_from_GUI()
+
+ Program.Add_Parts(Input)
+
+ importClass.copyGroupsByDataSet(ExternalClass.groupds_new)
+ Dim GrNr = groupClass.NewGroupID
+ Dim Design_table = designModel.selectDesign("*")
+ Dim Design_name = Design_table.rows(0)("designName") '"135_0922244" 'CADLinkerClass.New_Design_Name '
+ groupClass.InstantiateGroup(Design_name, GrNr, "START")
+
+ '
+ End Sub
+
+ Private Sub Update_KB_Click(sender As Object, e As EventArgs) Handles Update_KB.Click
+ Program.UpdateKB()
+ End Sub
+End Class
\ No newline at end of file