You are on page 1of 48

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Platform : WINDOWS xp Program : Visual Basic 6.

0 ' ' Notes : -This vrsion has a different feature, that is you can work ( draw and edit )in the three view plans ' any time without the need of active area buttons toggling. '''''****************************************************************************************** ********************* ''''' The " GK DrawPad 1.0 " ''''' an application created by Eng. Ghazy Fawzy Elkasef ''''' November,2011 ''''' Application aiding in designing and drawing 3D furniture staff made with sheet boards '''''****************************************************************************************** ********************* ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Just copy and paste into visual basic 6 code window 'codetop 'Form_Load 'cmdGrid_Click 'cmdCloseFile_Click 'cmdClearAll_Click 'cmdFlexRep1_Click 'cmdGrid_Click 'cmdRefresh_Click 'mnuexit_Click 'optActivPlan_Click 'optWorkMod_Click 'picElev_MouseDown 'picElev_MouseMove 'picElev_MouseUp 'Sub_Showthegrid 'Sub_Hidethegrid 'picPlan_MouseDown 'picPlan_MouseMove 'picPlan_MouseUp 'picSide_MouseDown 'picSide_MouseMove 'picSide_MouseUp ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit Dim lastx, lasty As Integer Dim x1 As Integer, x2 As Integer, x3 As Integer, x4 As Integer, y1 As Integer, y2 As Integer, y3 As Integer, y4 As Integer Dim x1a As Integer, x2a As Integer, x1b As Integer, x2b As Integer, y1a As Integer, y2a As Integer, y1b As Integer, y2b As Integer '''''''''''''''''''''''''''''''''''' Dim CreateBackupFile As Boolean Dim DrawingGrid As Boolean Dim ConnectLines As Boolean Dim DrawingScale As Integer Public Gridstep As Long 'String Public Gridcolor As String Public Gridstyle As String Public strProjectInfo As String '''''''''''''''''''''''''''''' 'Public BoardWidth As Long ' the variable type should be revised !!!

Public BoardHeight As Long Public BoardMax As Long Public BoardMin As Long Public TBoard As Long 'Integer Public MemberArea As Long 'String Public BoardsNum As Integer ''''''''''''''''''''''''''''''' Public LimitX As Single Public LimitY As Single Public LimitZ As Single Public Clearence1 As Integer Public Clearence As Integer 'Public ISel As Integer ''''''''''''''''''''''''''''' Dim Orientation As String Public ItemCounter As Integer Public ItemIDCount As Integer Public ItemCounterE As Integer Public ItemCounterP As Integer Public ItemCounterS As Integer Public Rep1Counter As Integer Public ItemSelect As Boolean '''''''''''''''''''''''''''''''''' Dim arrE() As Long, arrP() As Long, arrS() As Long, arrXYZ() As Long Dim arrEG() As Long, arrPG() As Long, arrSG() As Long Dim arrTemp() As Long Dim arrTemp1() As Long 'Dim arrProjBrowser() As Variant ''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim arrEC As Integer Dim arrPC As Integer Dim arrSC As Integer Dim arrxyzC As Integer Dim arrEgc As Integer Dim arrPgc As Integer Dim arrSgc As Integer '''''''''''''''''''''''''''''''''' Dim OrientationI As Long Public ActiveView As Long Dim ParentId As Integer Dim ItemIdE As Integer Dim ItemIdP As Integer Dim ItemIdS As Integer '''''''''''''''''''''''''''''''''''' Public AnchorX As Long Public AnchorY As Long Public AnchorX1 As Long Public AnchorY1 As Long Public AnchorX2 As Long Public anchorY2 As Long Public strsumtotalarea As String Public ItemMovex1 As Long, ItemMovey1 As Long, ItemMovex2 As Long, ItemMovey2 As Long Public DeltaAnchorX As Long

Public DeltaAnchorY As Long Public MoveAnchorx As Long Public MoveAnchory As Long Public MoveStat As Boolean Private MyLastDir As String Public SelI As Integer Public FileSavedBefore As Boolean Public strFileToSave As String Public strFileToOpen As String Public FolderWantedPath As String Public FileBup As Boolean Private Sub cmdBakup_Click() If CreateBackupFile = True Then mnuCBup.Checked = False CreateBackupFile = False Else: CreateBackupFile = True mnuCBup.Checked = True End If End Sub Private Sub cmdClearAll_Click() picElev.Cls lblItemCount.Caption = Val(lblItemCount.Caption) - Val(lblICe.Caption) lblICe.Caption = 0 ItemCounter = ItemCounter - ItemCounterE ItemCounterE = 0 picPlan.Cls lblItemCount.Caption = Val(lblItemCount.Caption) - Val(lblICp.Caption) lblICp.Caption = 0 ItemCounter = ItemCounter - ItemCounterP ItemCounterP = 0 picSide.Cls lblItemCount.Caption = Val(lblItemCount.Caption) - Val(lblICs.Caption) lblICs.Caption = 0 ItemCounter = ItemCounter - ItemCounterS ItemCounterS = 0 cmdGrid.Caption = "Hide Grid" picElev.DrawMode = 13 ' copy pen picPlan.DrawMode = 13 ' copy pen picSide.DrawMode = 13 ' copy pen Call Showthegrid picPlan.DrawMode = 6 picSide.DrawMode = 6 picElev.DrawMode = 6 cmdRefresh.Enabled = True End Sub Private Sub cmdDebugerPrint_Click() '''''''''''''''''''''''''''''''''' End Sub Private Sub cmdFlexRep1_Click() Load frmFlexRep ' as New frmFlexRep.Show 'vbModal End Sub

Private Sub cmdLoadFile_Click() '''''''''''''''''''''''''''''''''''''''' End Sub Private Sub cmdSave_Click() Call mnusave_Click End Sub Private Sub cmdShId_Click() lblIDC.Caption = ItemIDCount End Sub Private Sub cmdCloseFile_Click() Dim intResponse As Integer intResponse = MsgBox("Are you sure you want to close this file ?", vbYesNo + vbQuestion + vbDefaultButton2, "Close File") If intResponse = vbYes Then ' delete every thing, from screen and memory ... Call mnusave_Click picElev.Cls picPlan.Cls picSide.Cls picElev.Enabled = False picPlan.Enabled = False picSide.Enabled = False Erase arrE() Erase arrP() Erase arrS() Erase arrXYZ() Erase arrEG() Erase arrPG() Erase arrSG() Erase arrReport1() ' Erase arrProjBrowser() ReDim arrE(1 To 11, 1 To 1) As Long ReDim arrP(1 To 11, 1 To 1) As Long ReDim arrS(1 To 11, 1 To 1) As Long ReDim arrEG(1 To 23, 1 To 1) As Long ReDim arrPG(1 To 23, 1 To 1) As Long ReDim arrSG(1 To 23, 1 To 1) As Long ReDim arrXYZ(1 To 1) As Long ReDim arrReport1(1 To 7, 1 To 1) As String 'ReDim arrProjBrowser(1 To 5) As Variant ItemCounter = 0 ItemIDCount = 0 ItemCounterE = 0 ItemCounterP = 0 ItemCounterS = 0 Rep1Counter = 1 arrEC = 1 arrPC = 1 arrSC = 1 arrxyzC = 1 arrEgc = 1 arrPgc = 1

arrSgc = 1 ''''''''''''''''''''''''''''''''''''''''''' OrientationI = 0 lblRep1Counter.Caption = "" lblIDC = "" lblItemCount.Caption = "" lblICe.Caption = "" lblICp.Caption = "" lblICs.Caption = "" lblBoundVal(0).Caption = "" lblBoundVal(1).Caption = "" lblBoundVal(2).Caption = "" lblMember.Caption = "" ''''''''''''''''''''''''''''''''''''''''' cmdFlexRep1.Enabled = False ' cmdRep1.Enabled = False cmdClearAll.Enabled = False cmdShId.Enabled = False cmdCloseFile.Enabled = False cmdRefresh.Enabled = False MousePointer = Default 'FileSavedBefore = True Call Showthegrid Else: Exit Sub End If End Sub ''' The user chooses New on the child form File menu. Private Sub mnuchildFileNew_Click() FileNew End Sub Private Sub mnuExit_Click() If MsgBox("Do you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton2, "Quit") = vbYes Then Call mnusave_Click If MsgBox("Do you want to save before quit?", vbYesNoCancel + vbQuestion + vbDefaultButton2, "Quit") = vbNo Then End If MsgBox("Sure you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton2, "Quit") = vbCancel Then Exit Sub End Sub Private Sub cmdGrid_Click() If DrawingGrid = True Then picElev.DrawMode = 13 ' copy pen picPlan.DrawMode = 13 ' copy pen picSide.DrawMode = 13 ' copy pen Call Hidethegrid picElev.DrawMode = 6 picPlan.DrawMode = 6 ' invert picSide.DrawMode = 6 ' invert DrawingGrid = False cmdGrid.Caption = "Show &Grid"

Else: DrawingGrid = True picElev.DrawMode = 13 ' copy pen picPlan.DrawMode = 13 ' copy pen picSide.DrawMode = 13 ' copy pen Call Showthegrid picElev.DrawMode = 6 picPlan.DrawMode = 6 ' invert picSide.DrawMode = 6 ' invert cmdGrid.Caption = "Hide &Grid" End If End Sub ''' This code to redraw the drawing ( out of array ) after deleting the drawing Private Sub cmdRefresh_Click() On Error GoTo Err_Proc Dim i As Integer For i = 1 To UBound(arrE, 2) picElev.Line ((arrE(5, i)), (arrE(6, i)))-((arrE(7, i)), (arrE(8, i))), , B picPlan.Line ((arrP(5, i)), (arrP(6, i)))-((arrP(7, i)), (arrP(8, i))), , B picSide.Line ((arrS(5, i)), (arrS(6, i)))-((arrS(7, i)), (arrS(8, i))), , B Next i Err_Proc: Exit Sub End Sub '<<<<<<<<<<<<<< This code will be canceled at the end of program finishing >>>>>>>>>>>>>>> Private Sub cmdRep1_Click() Load frmReport1 frmReport1.Show vbModal End Sub ''' #################################### FORM LOAD ################################################### Private Sub Form_Load() 'MsgBox "Please select :Menu / File / New, or Open , to start work", vbOKOnly, "Make Choice First" 'DrawingScale = InputBox("Select Drawing Scale ( X ): " & vbCrLf & "X (draw) : 1 (real)", "Drawing Scale", 2) 'If DrawingScale = 0 Then DrawingScale = 2 'Load frmInitialization DrawingScale = 2 'Dim thickval As Integer BoardWidth = Val(frmInitialization.txtDimsX.Text) If BoardWidth = 0 Then BoardWidth = 2400 'BoardWidth = 240 BoardHeight = Val(frmInitialization.txtDimsY.Text) If BoardHeight = 0 Then BoardHeight = 1200 'BoardHeight = 120 If BoardWidth > BoardHeight Then BoardMax = BoardWidth * DrawingScale BoardMin = BoardHeight * DrawingScale Else: BoardMax = BoardHeight * DrawingScale BoardMin = BoardWidth * DrawingScale End If BoardArea = Format((BoardHeight * BoardWidth / 1000000), "#0.00") ' Val ( ) 'Debug.Print BoardThickness Clearence1 = 30

TBoard = BoardThickness + 100 ': If TBoard < 120 Then TBoard = 120' Board thickness from Initialization form Clearence = Clearence1 + TBoard ''' Debug.Print TBoard 'Gridstep = InputBox("Select Grid Lines Spacing", "Grid Spacing", 1000) 'If Gridstep = "" Then Gridstep = 1000 Gridstep = 1000 'Gridcolor = InputBox("Select Grid Lines Color", "Grid Color", 10) Gridcolor = 0 ' If Gridcolor > 13 Then Gridcolor = 13 Else Gridcolor = Gridcolor 'Gridstyle = InputBox("Select Grid Lines Style", "Grid Style", 2) Gridstyle = 2 'Debug.Print BoardArea '''**************************** picElev.DrawStyle = Gridstyle picPlan.DrawStyle = Gridstyle picSide.DrawStyle = Gridstyle '''**************************** LimitX = 200 LimitY = 200 LimitZ = 200 '''**************************** DrawingGrid = True lblXY.Font.Bold = True Me.DrawWidth = 1 lblItemCount.Caption = "" ItemIDCount = 0 ItemSelect = False lblMouse.Visible = False lblMouse.Caption = 0 & "," & 0 lblMouse.Left = 50: lblMouse.Top = 50 lblmousp.Visible = False lblmousp.Caption = 0 & "," & 0 lblmousp.Left = 50: lblMouse.Top = 50 lblmouss.Visible = False lblmouss.Caption = 0 & "," & 0 lblmouss.Left = 50: lblMouse.Top = 50 '''''''''''''''''''''''''''''''''''''''''''' MyLastDir = App.Path & "\My Projects" ' *** here I added " &\My Projects" ,string to make the open Directory ' ' default(file path), as 'My Projects' FileOpend = False FileOpendName = "" '''*************************** Call Showthegrid '''*************************** arrEC = 1 arrPC = 1 arrSC = 1 arrxyzC = 1 arrEgc = 1 arrPgc = 1 arrSgc = 1 Rep1Counter = 1 ItemIdE = 1 ItemIdP = 1 ItemIdS = 1 'cmdFlexRep1.Enabled = False

'cmdRep1.Enabled = False StatusBar1.Panels(6).Text = "" StatusBar1.Panels(6).Text = " Press mouse left button and drag to opposite corner to start drawing" picElev.Enabled = False picPlan.Enabled = False picSide.Enabled = False mnuopen.Enabled = True mnuVProInfo.Enabled = False cmdFlexRep1.Enabled = False cmdCloseFile.Enabled = False MsgBox "Please select :Menu / File / New, or Open , to start work", vbOKOnly, "Select Your Project" FileSavedBefore = False CreateBackupFile = True End Sub '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This procedure & the button will be canceled >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Private Sub cmdExit_Click() '''If MsgBox("Sure you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton1, "Quit") = vbYes Then Call mnusave_Click '''If MsgBox("Sure you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton1, "Quit") = vbNo Then 'End End '''End If End Sub ' <<<< this code should be modified , to set the action directly to the menu item not to button >>>>>>>>> Private Sub mnuFileClose_Click() Dim intResponse As Integer intResponse = MsgBox("Are you sure you want to close this file ?", vbYesNo + vbQuestion + vbDefaultButton2, "Close File") If intResponse = vbYes Then ' delete every thing, from screen and memory ... Call mnusave_Click picElev.Cls picPlan.Cls picSide.Cls picElev.Enabled = False picPlan.Enabled = False picSide.Enabled = False Erase arrE() Erase arrP() Erase arrS() Erase arrXYZ() Erase arrEG() Erase arrPG() Erase arrSG() Erase arrReport1() ' Erase arrProjBrowser() ReDim arrE(1 To 11, 1 To 1) As Long ReDim arrP(1 To 11, 1 To 1) As Long ReDim arrS(1 To 11, 1 To 1) As Long ReDim arrEG(1 To 23, 1 To 1) As Long ReDim arrPG(1 To 23, 1 To 1) As Long ReDim arrSG(1 To 23, 1 To 1) As Long ReDim arrXYZ(1 To 1) As Long ReDim arrReport1(1 To 7, 1 To 1) As Long 'String 'ReDim arrProjBrowser(1 To 5) As Variant

ItemCounter = 0 ItemIDCount = 0 ItemCounterE = 0 ItemCounterP = 0 ItemCounterS = 0 Rep1Counter = 1 arrEC = 1 arrPC = 1 arrSC = 1 arrxyzC = 1 arrEgc = 1 arrPgc = 1 arrSgc = 1 ''''''''''''''''''''''''''''''''''''''''''' OrientationI = 0 lblRep1Counter.Caption = "" lblIDC = "" lblItemCount.Caption = "" lblICe.Caption = "" lblICp.Caption = "" lblICs.Caption = "" lblBoundVal(0).Caption = "" lblBoundVal(1).Caption = "" lblBoundVal(2).Caption = "" lblMember.Caption = "" ''''''''''''''''''''''''''''''''''''''''' cmdFlexRep1.Enabled = False ' cmdRep1.Enabled = False cmdClearAll.Enabled = False cmdShId.Enabled = False cmdCloseFile.Enabled = False cmdRefresh.Enabled = False MousePointer = Default Call Showthegrid 'FileSavedBefore = True CreateBackupFile = True mnuCBup.Checked = True mnuCBup.Enabled = True Else: Exit Sub End If End Sub ''' this button may be located on the toolbar instead Private Sub mnunewproj_Click() frmInitialization.Show vbModal End Sub Private Sub mnunewprojmem_Click() If lblMember <> "" Then MsgBox "please, close the opened file first" Exit Sub End If frmProjectCheck.Show vbModal

End Sub Private Sub mnuopen_Click() Dim MyStamp As Date 'NOTE : this proced. opens common dialog for files ( proj member file, *.dpf ), and it's project.ini file If lblMember <> "" Then MsgBox "please, close the opened file first" Exit Sub End If Dim strBuffer As String Dim FreeFileNum As Integer Dim strFileToOpen As String Dim strIniFileToOpen As String Dim strIniFolderPath As String Dim strIniFolderParent As String Dim strIniFolderOnly As String Dim strIniFolderTitle As String Dim i As Integer Dim j As Integer Dim NumGroup As Integer ReDim arrXYZ(1 To 1) As Long Form1.mnuVProInfo.Enabled = True On Error GoTo cmdOpen_Click_Exit 'Load frmInitialization With Dialog1 .CancelError = True .InitDir = MyLastDir .Flags = cdlOFNHideReadOnly .FileName = "" .Filter = "DrawPad Files(*.dpf)|*.dpf|Text Files(*.txt)|*.txt|All Files(*.*)|*.*" .ShowOpen '.DialogTitle = "Open Project Member File" .DialogTitle = "Open File" strFileToOpen = .FileName End With strIniFolderPath = Left(strFileToOpen, InStrRev(strFileToOpen, "\") - 1) ' IniFilePath is the Project folder strIniFolderParent = Left(strIniFolderPath, InStrRev(strIniFolderPath, "\")) ' IniFolder is the parent directory strIniFolderTitle = Replace(strIniFolderPath, strIniFolderParent, "") ' IniFolderOnly1 is the project folder that gives it's name to the ini file FolderWantedPath = strIniFolderPath ' the folder path we use in saving files related to previously opend project On Error GoTo cmdOpen_Click_Error FreeFileNum = FreeFile Open strFileToOpen For Input As FreeFileNum i=0 Do While Not EOF(FreeFileNum) i=i+1 ReDim Preserve arrXYZ(1 To i) '(1 To 11, 1 To i) Input #FreeFileNum, arrXYZ(i) '(j, i) Loop Close #FreeFileNum NumGroup = 0 For i = 1 To UBound(arrXYZ) / 33

ReDim Preserve arrE(1 To 11, 1 To i) ReDim Preserve arrP(1 To 11, 1 To i) ReDim Preserve arrS(1 To 11, 1 To i) For j = 1 To 11 arrE(j, i) = arrXYZ(j + NumGroup) arrP(j, i) = arrXYZ(j + NumGroup + 11) arrS(j, i) = arrXYZ(j + NumGroup + 22) Next j NumGroup = NumGroup + 33 Next i For i = 1 To UBound(arrXYZ) / 33 picElev.Line ((arrE(5, i)), (arrE(6, i)))-((arrE(7, i)), (arrE(8, i))), , B picPlan.Line ((arrP(5, i)), (arrP(6, i)))-((arrP(7, i)), (arrP(8, i))), , B picSide.Line ((arrS(5, i)), (arrS(6, i)))-((arrS(7, i)), (arrS(8, i))), , B Next i '''''''''''''''''''''''' For i = 1 To UBound(arrE, 2) ReDim Preserve arrEG(1 To 23, 1 To i) ReDim Preserve arrPG(1 To 23, 1 To i) ReDim Preserve arrSG(1 To 23, 1 To i) arrEG(1, i) = i arrEG(2, i) = arrE(2, i) arrEG(3, i) = arrE(3, i) arrEG(4, i) = arrE(4, i) arrEG(5, i) = arrE(5, i) arrEG(6, i) = arrE(6, i) arrEG(7, i) = arrE(7, i) arrEG(8, i) = arrE(8, i) arrEG(9, i) = arrE(7, i) - arrE(5, i) ' Equals to width arrEG(10, i) = arrE(8, i) - arrE(6, i) ' Equals to height arrEG(11, i) = arrE(7, i) arrEG(12, i) = arrE(6, i) arrEG(13, i) = arrE(5, i) arrEG(14, i) = arrE(8, i) arrEG(15, i) = arrP(5, i) arrEG(16, i) = arrP(6, i) arrEG(17, i) = arrP(7, i) arrEG(18, i) = arrP(8, i) arrEG(19, i) = arrS(5, i) arrEG(20, i) = arrS(6, i) arrEG(21, i) = arrS(7, i) arrEG(22, i) = arrS(8, i) arrEG(23, i) = 0 LimitZ = 200 'LimitZ + Clearence * i '??????? arrPG(1, i) = i arrPG(2, i) = arrP(2, i) arrPG(3, i) = arrP(3, i) arrPG(4, i) = arrP(4, i) arrPG(5, i) = arrP(5, i) arrPG(6, i) = arrP(6, i) arrPG(7, i) = arrP(7, i) arrPG(8, i) = arrP(8, i) arrPG(9, i) = arrP(7, i) - arrP(5, i) arrPG(10, i) = arrP(8, i) - arrP(6, i)

?????????

arrPG(11, i) = arrP(7, i) arrPG(12, i) = arrP(6, i) arrPG(13, i) = arrP(5, i) arrPG(14, i) = arrP(8, i) arrPG(15, i) = arrS(5, i) arrPG(16, i) = arrS(6, i) arrPG(17, i) = arrS(7, i) arrPG(18, i) = arrS(8, i) arrPG(19, i) = arrE(5, i) arrPG(20, i) = arrE(6, i) arrPG(21, i) = arrE(7, i) arrPG(22, i) = arrE(8, i) arrPG(23, i) = 0 LimitY = 200 'LimitY + Clearence * i arrSG(1, i) = i arrSG(2, i) = arrS(2, i) arrSG(3, i) = arrS(3, i) arrSG(4, i) = arrS(4, i) arrSG(5, i) = arrS(5, i) arrSG(6, i) = arrS(6, i) arrSG(7, i) = arrS(7, i) arrSG(8, i) = arrS(8, i) arrSG(9, i) = arrS(7, i) - arrS(5, i) arrSG(10, i) = arrS(8, i) - arrS(6, i) arrSG(11, i) = arrS(7, i) arrSG(12, i) = arrS(6, i) arrSG(13, i) = arrS(5, i) arrSG(14, i) = arrS(8, i) arrSG(15, i) = arrE(5, i) arrSG(16, i) = arrE(6, i) arrSG(17, i) = arrE(7, i) arrSG(18, i) = arrE(8, i) arrSG(19, i) = arrP(5, i) arrSG(20, i) = arrP(6, i) arrSG(21, i) = arrP(7, i) arrSG(22, i) = arrP(8, i) arrSG(23, i) = 0 LimitX = 200 'LimitX + Clearence * i Next i For i = 1 To UBound(arrXYZ) / 33 If arrE(2, i) <> 0 Then ItemCounterE = ItemCounterE + 1 If arrP(2, i) <> 0 Then ItemCounterP = ItemCounterP + 1 If arrS(2, i) <> 0 Then ItemCounterS = ItemCounterS + 1 Next i ' lblBoundVal(0).Caption = UBound(arrE, 2) ''' Repeated code ' lblBoundVal(1).Caption = UBound(arrP, 2) ' lblBoundVal(2).Caption = UBound(arrS, 2) arrEC = UBound(arrE, 2) + 1 arrPC = UBound(arrP, 2) + 1 arrSC = UBound(arrS, 2) + 1 arrEgc = UBound(arrEG, 2) + 1 ''' *** added code for checking, may not be removed arrPgc = UBound(arrPG, 2) + 1

arrSgc = UBound(arrSG, 2) + 1 ItemCounter = UBound(arrE, 2) lblItemCount.Caption = ItemCounter ItemIDCount = ItemCounter lblICe.Caption = ItemCounterE lblICp.Caption = ItemCounterP lblICs.Caption = ItemCounterS Rep1Counter = 1 For i = 1 To UBound(arrXYZ) / 11 ReDim Preserve arrReport1(1 To 7, 1 To Rep1Counter) If arrXYZ(3 + (i - 1) * 11) <> 0 Then arrReport1(1, Rep1Counter) = Rep1Counter arrReport1(2, Rep1Counter) = arrXYZ(2 + (i - 1) * 11) arrReport1(3, Rep1Counter) = arrXYZ(3 + (i - 1) * 11) arrReport1(4, Rep1Counter) = arrXYZ(4 + (i - 1) * 11) arrReport1(5, Rep1Counter) = Int(Abs((arrXYZ(7 + (i - 1) * 11) - arrXYZ(5 + (i - 1) * 11))) / (DrawingScale)) arrReport1(6, Rep1Counter) = Int(Abs((arrXYZ(8 + (i - 1) * 11) - arrXYZ(6 + (i - 1) * 11))) / (DrawingScale)) arrReport1(7, Rep1Counter) = FormatNumber(Abs(CDbl((arrReport1(5, Rep1Counter)) * (arrReport1(6, Rep1Counter)))) / 1000 ^ 2, 2, vbTrue) Rep1Counter = Rep1Counter + 1 End If Next i '''''''''''''''''''''''''''''''''''''''''''''''''''''''' Form1.picElev.Enabled = True Form1.picPlan.Enabled = True Form1.picSide.Enabled = True Form1.lblMember.Caption = Left(Dialog1.FileTitle, Len(Dialog1.FileTitle) - 4) '''''''''''''''''''''''''''''''''''''''''''''''''''''''' MyLastDir = Left$(strFileToOpen, InStrRev(strFileToOpen, "\")) '''*** this code " ' - 1)" may be added before last bracet to open and save in one level heigher '''<<<<<<<<<<<<<<<<< Open project ini file and load main project data into Form1 >>>>>>>>>>>>>>>>> FreeFileNum = FreeFile strIniFileToOpen = strIniFolderTitle & ".ini" 'App.Path & "\my projects\" & strProjectName & "\" & "*.ini" Open strIniFileToOpen For Input As FreeFileNum j=0 Do While Not EOF(FreeFileNum) ReDim Preserve arrDataTemp(0 To j) Input #FreeFileNum, arrDataTemp(j) j=j+1 Loop Close #FreeFileNum Form1.lblProject.Caption = arrDataTemp(0) Form1.lblMaterial.Caption = arrDataTemp(1) Form1.lblWVal.Caption = arrDataTemp(2) Form1.lblHVal.Caption = arrDataTemp(3) Form1.lblThickness.Caption = arrDataTemp(4) Form1.lblDateCreated.Caption = arrDataTemp(5) cmdFlexRep1.Enabled = True cmdCloseFile.Enabled = True cmdBakup.Enabled = True ''''''''''''''''''''======================='''''''''''''''''''========================''''''''''''''''''''''' Exit Sub cmdOpen_Click_Error:

MsgBox "The following error has occurred:" & vbNewLine & "Err # " & Err.Number & " - " & Err.Description, vbCritical, "Open Error" cmdOpen_Click_Exit: End Sub Private Sub mnuprint_Click() frmFlexRep.Show 'frmFlexRep.PrintForm 'PrintFlexGrid Dim intX As Integer Dim intCopies As Integer On Error GoTo cmdPrint_Click_Exit With Dialog1 .CancelError = True .Flags = cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection .ShowPrinter .DialogTitle = "Print Member Summary Report" intCopies = .Copies End With On Error GoTo cmdPrint_Click_Error For intX = 0 To Printer.FontCount - 1 If Printer.Fonts(intX) Like "Courier*" Then Printer.FontName = Printer.Fonts(intX) Exit For End If Next Printer.FontSize = 10 For intX = 1 To intCopies If intX > 1 Then Printer.NewPage End If Dim i As Integer Dim j As Integer For i = 0 To frmFlexRep.FGrid1.Col For j = 0 To frmFlexRep.FGrid1.Row Printer.Print frmFlexRep.FGrid1.TextMatrix(i, j) ' Printer.Print TextAlignment = center Next j Next i Next intX Printer.EndDoc Exit Sub cmdPrint_Click_Error: MsgBox "The following error has occurred:" & vbNewLine & "Err # " & Err.Number & " - " & Err.Description, vbCritical, "Print Error" cmdPrint_Click_Exit: End Sub Private Sub mnuPrntProjSmry_Click() Dim intX As Integer Dim intCopies As Integer On Error GoTo cmdPrint_Click_Exit With DialogPS .CancelError = True .Flags = cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection .ShowPrinter .DialogTitle = "Print Project Summary Report"

intCopies = .Copies End With On Error GoTo cmdPrint_Click_Error For intX = 0 To Printer.FontCount - 1 If Printer.Fonts(intX) Like "Courier*" Then Printer.FontName = Printer.Fonts(intX) Exit For End If Next Printer.FontSize = 10 For intX = 1 To intCopies If intX > 1 Then Printer.NewPage End If Dim i As Integer Dim j As Integer For i = 0 To frmFlexRep.FGrid2.Col For j = 0 To frmFlexRep.FGrid2.Row Printer.Print frmFlexRep.FGrid2.TextMatrix(i, j) Next j Next i Next intX Printer.EndDoc Exit Sub cmdPrint_Click_Error: MsgBox "The following error has occurred:" & vbNewLine & "Err # " & Err.Number & " - " & Err.Description, vbCritical, "Print Error" cmdPrint_Click_Exit: End Sub Private Sub mnusave_Click() Dim arrTemp() As Long Dim i As Integer, j As Integer Dim FreeFileNum As Integer Dim SaveDate As Date Dim strFileToSave As String Form1.mnuVProInfo.Enabled = True 'Dim strSavePath As String On Error GoTo cmdSave_Click_Exit If FileSavedBefore = True Then GoTo SaveNoDilg End If SaveDate = Format$(Now, "d/m/yyyy") ' File Creation Date With Dialog1 .CancelError = True .InitDir = App.Path & "\my projects" & "\" & Form1.lblProject.Caption ' MyLastDir <<<<<<<<<< old code .Flags = cdlOFNOverwritePrompt ' + cdlOFNPathMustExist .FileName = Form1.lblMember.Caption .Filter = "DrwPad Files(*.dpf)|*.dpf|Text Files(*.txt)|*.txt|All Files(*.*)|*.*" .ShowSave .DialogTitle = "Save" strFileToSave = "" 'App.Path & "\my projects\" & strProjectName & "\" & "Form1.lblMember.Caption" & ".dpf" 'strFileToOpen.FileName

End With On Error GoTo cmdSave_Click_Error SaveNoDilg: strFileToSave = App.Path & "\my projects" & "\" & Form1.lblProject.Caption & "\" & Form1.lblMember.Caption & ".dpf" 'strFileToOpen.FileName 'strSavePath = Replace(Dialog1.InitDir, App.Path & "\my projects" & "\", "") 'Dim msg1 As String 'If strSavePath <> Form1.lblProject.Caption Then 'msg1 = MsgBox("You cann't save file outside it's project folder & vbcrlf& The file will be saved in it's original locatio", vbCritical + vbOKOnly, "Wrong Location") ' If msg1 = vbOK Then Exit Sub 'Debug.Print msg1 'End If FreeFileNum = FreeFile Open strFileToSave For Output As #FreeFileNum For i = 1 To UBound(arrE, 2) For j = 1 To 11 Write #FreeFileNum, arrE(j, i); Next j For j = 1 To 11 Write #FreeFileNum, arrP(j, i); Next j For j = 1 To 11 Write #FreeFileNum, arrS(j, i); Next j Next i Close #FreeFileNum If mnuCBup.Checked = True Then GoTo MakeBackup GoTo ContiueSave MakeBackup: FreeFileNum = FreeFile i=0 Open strFileToSave For Input As #FreeFileNum ' for output Do While Not EOF(FreeFileNum) ReDim Preserve arrTemp(0 To i) As Long Input #FreeFileNum, arrTemp(i) i=i+1 Loop Close #FreeFileNum If FileSavedBefore = True And mnuCBup.Checked = True Then SetAttr Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb", vbNormal End If FreeFileNum = FreeFile Open Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb" For Output As #FreeFileNum ' Extension .dpb stands for DrawPadBackup file For i = 0 To UBound(arrTemp) Write #FreeFileNum, arrTemp(i); Next i Close #FreeFileNum SetAttr Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb", vbHidden + vbReadOnly ' Hidden and Readonly Copy of strFileToSave, 'Debug.Print "GHAZY"; strProjectInfo ''' * Open report form and get the member total area 'Dim strsumtotalarea As String

''''''''''''''''''''''''''''''''''''''''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Load frmReport1 strsumtotalarea = frmReport1.lblTotalArea.Caption 'Format(frmReport1.lblTotalArea.Caption, "##0.00") '''''''''''''''''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'''''''''''''''''''''''' 'Debug.Print strsumtotalarea 'MemberArea = Format(Val(frmReport1. SumTotalArea), 2, True) Unload frmReport1 FreeFileNum = FreeFile Open App.Path & "\my projects" & "\" & Form1.lblProject.Caption & "\" & Form1.lblProject.Caption & ".inf" For Append As #FreeFileNum Write #FreeFileNum, Form1.lblMember.Caption; SaveDate; strsumtotalarea; BoardsNum; '"Total Area" Close #FreeFileNum ContiueSave: MyLastDir = Left$(strFileToSave, InStrRev(strFileToSave, "\") - 1) Exit Sub cmdSave_Click_Error: Exit Sub 'End 'MsgBox "The following error has occurred:" & vbNewLine & "Err # " & Err.Number & " - " & Err.Description, vbCritical, "Save Error" cmdSave_Click_Exit: Exit Sub End Sub Private Sub mnusaveas_Click() Dim arrTemp() As Long Dim i As Integer, j As Integer Dim FreeFileNum As Integer Dim strFileToSave As String On Error GoTo cmdSave_Click_Exit Form1.mnuVProInfo.Enabled = True 'If MsgBox("Sure you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton2, "Quit") = vbNo Then ' Exit Sub ' End 'End If 'If MsgBox("Sure you want to save and quit?", vbYesNoCancel + vbQuestion + vbDefaultButton2, "Quit") = vbYes Then With Dialog1 .CancelError = True .InitDir = App.Path & "\my projects" & "\" & Form1.lblProject.Caption ' MyLastDir .Flags = cdlOFNOverwritePrompt ' + cdlOFNPathMustExist .FileName = "" 'Form1.lblMember.Caption .Filter = "DrwPad Files(*.dpf)|*.dpf|Text Files(*.txt)|*.txt|All Files(*.*)|*.*" .ShowSave .DialogTitle = "Save As" strFileToSave = .FileName End With On Error GoTo cmdSave_Click_Error FreeFileNum = FreeFile Open strFileToSave For Output As #FreeFileNum For i = 1 To UBound(arrE, 2) For j = 1 To 11 Write #FreeFileNum, arrE(j, i); Next j

For j = 1 To 11 Write #FreeFileNum, arrP(j, i); Next j For j = 1 To 11 Write #FreeFileNum, arrS(j, i); Next j Next i Close #FreeFileNum FreeFileNum = FreeFile i=0 Open strFileToSave For Input As #FreeFileNum ' for output Do While Not EOF(FreeFileNum) ReDim Preserve arrTemp(0 To i) As Long Input #FreeFileNum, arrTemp(i) i=i+1 Loop Close #FreeFileNum If FileSavedBefore = True And mnuCBup.Checked = True Then SetAttr Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb", vbNormal End If FreeFileNum = FreeFile Open Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb" For Output As #FreeFileNum ' Extension .dpb stands for DrawPadBackup file For i = 0 To UBound(arrTemp) Write #FreeFileNum, arrTemp(i); Next i Close #FreeFileNum SetAttr Left(strFileToSave, Len(strFileToSave) - 4) & ".dpb", vbHidden + vbReadOnly ' Hidden and Readonly Copy of strFileToSave, MyLastDir = Left$(strFileToSave, InStrRev(strFileToSave, "\") - 1) Exit Sub cmdSave_Click_Error: Exit Sub 'End 'MsgBox "The following error has occurred:" & vbNewLine & "Err # " & Err.Number & " - " & Err.Description, vbCritical, "Save Error" cmdSave_Click_Exit: Exit Sub End Sub Private Sub mnuVProInfo_Click() Dim i As Integer Dim j As Integer Dim k As Integer Dim FreeFileNum As Integer '''''''''''''''''''''''''''''''''''''''' 'Do While Not EOF(FreeFileNum) ' i=i+1 ' ReDim Preserve arrXYZ(1 To i) '(1 To 11, 1 To i) ' Input #FreeFileNum, arrXYZ(i) '(j, i) 'Loop i=0 ' ReDim arrProjectInfo(1 To i) FreeFileNum = FreeFile

Open App.Path & "\my projects" & "\" & Form1.lblProject.Caption & "\" & Form1.lblProject.Caption & ".inf" For Input As #FreeFileNum If Len(FreeFileNum) = 0 Then MsgBox "Please Save File first", vbOKOnly + vbCritical, "Info Not Yet Available" Debug.Print "File is Empty" Exit Sub Else Do While Not EOF(FreeFileNum) i=i+1 ReDim Preserve arrProjectInfo(1 To i) Input #FreeFileNum, arrProjectInfo(i) 'Debug.Print arrProjectInfo(i), Loop Close #FreeFileNum 'If Len(App.Path & "\my projects" & "\" & Form1.lblProject.Caption & "\" & Form1.lblProject.Caption & ".inf") = 0 Then ' Exit Sub 'Else Load frmPrBrowser frmPrBrowser.Show vbModal End If End Sub Private Sub optActivPlan_Click(index As Integer) Select Case index Case 0 picElev.Enabled = True ' picPlan.Enabled = False ' picSide.Enabled = False OrientationI = 1 lblXY.Font.Bold = True ' lblXZ.Font.Bold = False ' lblZY.Font.Bold = False StatusBar1.Panels(5).Text = "Active Area : " & "X - Y" Case 1 ' picElev.Enabled = False picPlan.Enabled = True ' picSide.Enabled = False OrientationI = 2 ' lblXY.Font.Bold = False lblXZ.Font.Bold = True ' lblZY.Font.Bold = False StatusBar1.Panels(5).Text = "Active Area : " & "X - Z" Case 2 ' picElev.Enabled = False ' picPlan.Enabled = False picSide.Enabled = True OrientationI = 3 ' lblXY.Font.Bold = False ' lblXZ.Font.Bold = False lblZY.Font.Bold = True StatusBar1.Panels(5).Text = "Active Area : " & "Z - Y" End Select End Sub

Private Sub optWorkMod_Click(index As Integer) Dim j As Integer If optWorkMod(0) = True Then 'cmdClear.Enabled = True cmdShId.Enabled = True StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Press mouse left button and drag to opposite corner to start drawing" For j = 0 To 3 shpHande(j).Visible = False shpHandp(j).Visible = False shpHands(j).Visible = False Next j End If If optWorkMod(1) = True Then ' cmdClear.Enabled = True cmdShId.Enabled = True StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Hoover your mouse over objects, to select , then press mouse left button to edit " For j = 0 To 3 shpHande(j).Visible = False shpHandp(j).Visible = False shpHands(j).Visible = False Next j End If If optWorkMod(2) = True Then ' cmdClear.Enabled = False cmdShId.Enabled = True StatusBar1.Panels(6).Text = " " For j = 0 To 3 shpHande(j).Visible = False shpHandp(j).Visible = False shpHands(j).Visible = False Next j End If End Sub Private Sub picElev_Click() Dim i As Integer Dim Button As Integer If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton Then '''''''''''''''''''''''''' '''''''''''''''''''''''''' End If '''''' End Sub Private Sub picElev_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer ''' *** Drawing mood If optWorkMod(0) = True And optWorkMod(1) = False Then If Button = vbLeftButton Then lblMouse.Visible = True lblMouse.Caption = 0 & "," & 0 lblMouse.Left = (X - 50 - lblMouse.Width): lblMouse.Top = (y - 275) OrientationI = 1 CurrentX = X

CurrentY = y lastx = X lasty = y MousePointer = 2 Else: Exit Sub End If If OrientationI = 1 Then lblOrientation.Caption = "X-Y" End If End If '''''''''''''''''''''''''''''''''''''''''''' ''' *** Edit mood If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton Then Dim ISel As Integer On Error GoTo errortrap ''ReDim arrTemp(1 To 23) ReDim arrTemp1(1 To 14) AnchorX = X ' Basic Value AnchorY = y ' Basic Value ' For i = 1 To UBound(arrEG, 2) For i = 1 To UBound(arrE, 2) 'If AnchorX > arrEG(5, i) And AnchorX < arrEG(7, i) Then ' If AnchorY > arrEG(6, i) And AnchorY < arrEG(8, i) Then If AnchorX > arrE(5, i) And AnchorX < arrE(7, i) Then If AnchorY > arrE(6, i) And AnchorY < arrE(8, i) Then ''''''''''''''''''''''''' * Matching Detected, Start Some Action '''''''''''''''' * Fixing Handles to corners '' shpHande(0).Left = arrEG(5, i) - 45: shpHande(0).Top = arrEG(6, i) - 45 '' shpHande(1).Left = arrEG(7, i) - 45: shpHande(1).Top = arrEG(6, i) - 45 '' shpHande(2).Left = arrEG(7, i) - 45: shpHande(2).Top = arrEG(8, i) - 45 '' shpHande(3).Left = arrEG(5, i) - 45: shpHande(3).Top = arrEG(8, i) - 45 '' 'Debug.Print arrEG(5, i); arrEG(6, i) '' shpHandp(0).Left = arrEG(15, i) - 45: shpHandp(0).Top = arrEG(16, i) - 45 '' shpHandp(1).Left = arrEG(17, i) - 45: shpHandp(1).Top = arrEG(16, i) - 45 '' shpHandp(2).Left = arrEG(17, i) - 45: shpHandp(2).Top = arrEG(18, i) - 45 '' shpHandp(3).Left = arrEG(15, i) - 45: shpHandp(3).Top = arrEG(18, i) - 45 '' 'Debug.Print arrPG(5, i); arrPG(6, i) '' shpHands(0).Left = arrEG(19, i) - 45: shpHands(0).Top = arrEG(20, i) - 45 '' shpHands(1).Left = arrEG(21, i) - 45: shpHands(1).Top = arrEG(20, i) - 45 '' shpHands(2).Left = arrEG(21, i) - 45: shpHands(2).Top = arrEG(22, i) - 45 '' shpHands(3).Left = arrEG(19, i) - 45: shpHands(3).Top = arrEG(22, i) - 45 ISel = i Call FixHandles(ISel) ' shpHande(0).Left = arrE(5, i) - 45: shpHande(0).Top = arrE(6, i) - 45 ' shpHande(1).Left = arrE(7, i) - 45: shpHande(1).Top = arrE(6, i) - 45 ' shpHande(2).Left = arrE(7, i) - 45: shpHande(2).Top = arrE(8, i) - 45 ' shpHande(3).Left = arrE(5, i) - 45: shpHande(3).Top = arrE(8, i) - 45 ' shpHandp(0).Left = arrP(5, i) - 45: shpHandp(0).Top = arrP(6, i) - 45 ' shpHandp(1).Left = arrP(7, i) - 45: shpHandp(1).Top = arrP(6, i) - 45 ' shpHandp(2).Left = arrP(7, i) - 45: shpHandp(2).Top = arrP(8, i) - 45 ' shpHandp(3).Left = arrP(5, i) - 45: shpHandp(3).Top = arrP(8, i) - 45 ' shpHands(0).Left = arrS(5, i) - 45: shpHands(0).Top = arrS(6, i) - 45 ' shpHands(1).Left = arrS(7, i) - 45: shpHands(1).Top = arrS(6, i) - 45 ' shpHands(2).Left = arrS(7, i) - 45: shpHands(2).Top = arrS(8, i) - 45 ' shpHands(3).Left = arrS(5, i) - 45: shpHands(3).Top = arrS(8, i) - 45 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' MousePointer = 5 '''' * Showing the handles ' For j = 0 To 3 ' shpHande(j).Visible = True ' shpHandp(j).Visible = True ' shpHands(j).Visible = True ' Next j ItemSelect = True '' arrEG(23, i) = ItemSelect ''' * Marking to show that this is the selected item arrTemp1(14) = ItemSelect MoveStat = True lastx = X '*************** lasty = y '**************** '' AnchorX1 = AnchorX - arrEG(5, i) ' Seting relative coordinates '' AnchorY1 = AnchorY - arrEG(6, i) ' Seting relative coordinates AnchorX1 = AnchorX - arrE(5, i) ' Seting relative coordinates AnchorY1 = AnchorY - arrE(6, i) ' Seting relative coordinates ''''''''''''' *** Storing data of selected item to be moved in temp array arrtemp() arrTemp1(1) = i arrTemp1(2) = arrE(5, i) arrTemp1(3) = arrE(6, i) arrTemp1(4) = arrE(7, i) arrTemp1(5) = arrE(8, i) arrTemp1(6) = arrP(5, i) arrTemp1(7) = arrP(6, i) arrTemp1(8) = arrP(7, i) arrTemp1(9) = arrP(8, i) arrTemp1(10) = arrS(5, i) arrTemp1(11) = arrS(6, i) arrTemp1(12) = arrS(7, i) arrTemp1(13) = arrS(8, i) arrTemp1(14) = ItemSelect SelI = i ' arrTemp(1) 'For k = 1 To 14 ' Debug.Print arrTemp1(k); 'Next k '' For k = 1 To 23 '' arrTemp(k) = arrEG(k, i) '' Next k ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Else ' For j = 0 To 3 ''' *** These code line are marked temporaly ' shpHande(j).Visible = False ' shpHandp(j).Visible = False ' shpHands(j).Visible = False ' Next j ' ItemSelect = 0 ' arrTemp(23) = ItemSelect ' MoveStat = False MousePointer = Default End If Else ' For j = 0 To 3 ' shpHande(j).Visible = False ' shpHandp(j).Visible = False ' shpHands(j).Visible = False ' Next j

' ItemSelect = 0 ' arrTemp(23) = ItemSelect MousePointer = Default End If Next i ''''''''''''''''''''''''''''''''''''''''''''''''''''''* End Scan End If ' errortrap: End Sub Private Sub picElev_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer AnchorX = X ' Basic Value AnchorY = y ' Basic Value MousePointer = Default ''' Drawing Mode *** If optWorkMod(0) = True And optWorkMod(1) = False Then picElev.DrawStyle = 0 picPlan.DrawStyle = 0 picSide.DrawStyle = 0 picElev.DrawMode = vbInvert picPlan.DrawMode = vbInvert picSide.DrawMode = vbInvert ''''''''''''''''''''''''''''''''''''''''''''''''''' If Button = vbLeftButton Then picElev.Line (CurrentX, CurrentY)-(X, y), , B picElev.Line (CurrentX, CurrentY)-(lastx, lasty), , B picPlan.Line (CurrentX, LimitZ)-(X, LimitZ + TBoard), , B picPlan.Line (CurrentX, LimitZ)-(lastx, LimitZ + TBoard), , B picSide.Line (LimitZ, CurrentY)-(LimitZ + TBoard, y), , B picSide.Line (LimitZ, CurrentY)-(LimitZ + TBoard, lasty), , B lastx = X lasty = y End If StatusBar1.Panels(1).Text = " X : " & Int(X) StatusBar1.Panels(2).Text = " Y : " & Int(y) lblMouse.Caption = Abs((lastx - CurrentX)) / DrawingScale & "," & Abs((lasty - CurrentY)) / DrawingScale lblMouse.Left = (X - 50 - lblMouse.Width): lblMouse.Top = (y - 275) End If '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' Mouse Hoovering Event *** If optWorkMod(0) = False And optWorkMod(1) = True Then StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Hoover your mouse over objects, to select , then press mouse left button to edit " ''' Docking and initializing the handles For j = 0 To 3 shpHande(j).Left = 0: shpHande(j).Top = 0 shpHandp(j).Left = 0: shpHandp(j).Top = 0 shpHands(j).Left = 0: shpHands(j).Top = 0 shpHande(j).Visible = False ' this line causes the handles to hide at shpHandp(j).Visible = False ' the bigining of mouse move first time !!! shpHands(j).Visible = False Next j StatusBar1.Panels(1).Text = " X : " & Int(AnchorX) StatusBar1.Panels(2).Text = " Y : " & Int(AnchorY)

'''''''''''''''''' *** Editing : Re-Drawing the selected item in new location If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton And MoveStat = True Then 'And ItemSelect = True Then MoveItem: MousePointer = 5 '' picElev.Line (X - AnchorX1, Y - AnchorY1)-(X - AnchorX1 + arrTemp(7) - arrTemp(5), Y - AnchorY1 + arrTemp(8) - arrTemp(6)), , B '' picElev.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp(7) - arrTemp(5), lasty AnchorY1 + arrTemp(8) - arrTemp(6)), , B '' picPlan.Line (X - AnchorX1, arrTemp(16))-(X - AnchorX1 + arrTemp(7) - arrTemp(5), arrTemp(16) + TBoard), ,B '' picPlan.Line (lastx - AnchorX1, arrTemp(16))-(lastx - AnchorX1 + arrTemp(7) - arrTemp(5), arrTemp(16) + TBoard), , B '' picSide.Line (arrTemp(16), Y - AnchorY1)-(arrTemp(16) + TBoard, Y - AnchorY1 + arrTemp(8) - arrTemp(6)), ,B '' picSide.Line (arrTemp(16), lasty - AnchorY1)-(arrTemp(16) + TBoard, lasty - AnchorY1 + arrTemp(8) arrTemp(6)), , B '''########################################################################################## ################################ Dim ItemAddress As Integer ItemAddress = 6 - (arrE(4, SelI) + arrE(11, SelI)) Select Case ItemAddress Case 4 picElev.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picElev.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (X - AnchorX1, arrTemp1(7))-(X - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B 'arrTemp1(7) + TBoard picPlan.Line (lastx - AnchorX1, arrTemp1(7))-(lastx - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B picSide.Line (arrTemp1(10), y - AnchorY1)-(arrTemp1(12), y - AnchorY1 + arrTemp1(13) - arrTemp1(11)), , B picSide.Line (arrTemp1(10), lasty - AnchorY1)-(arrTemp1(12), lasty - AnchorY1 + arrTemp1(13) arrTemp1(11)), , B lastx = X lasty = y Case 3 picElev.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picElev.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (X - AnchorX1, arrTemp1(7))-(X - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B 'arrTemp1(7) + TBoard picPlan.Line (lastx - AnchorX1, arrTemp1(7))-(lastx - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B picSide.Line (arrTemp1(10), y - AnchorY1)-(arrTemp1(12), y - AnchorY1 + arrTemp1(13) - arrTemp1(11)), , B picSide.Line (arrTemp1(10), lasty - AnchorY1)-(arrTemp1(12), lasty - AnchorY1 + arrTemp1(13) arrTemp1(11)), , B lastx = X lasty = y Case 2 picElev.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B

picElev.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (X - AnchorX1, arrTemp1(7))-(X - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B 'arrTemp1(7) + TBoard picPlan.Line (lastx - AnchorX1, arrTemp1(7))-(lastx - AnchorX1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B picSide.Line (arrTemp1(10), y - AnchorY1)-(arrTemp1(12), y - AnchorY1 + arrTemp1(13) - arrTemp1(11)), , B picSide.Line (arrTemp1(10), lasty - AnchorY1)-(arrTemp1(12), lasty - AnchorY1 + arrTemp1(13) arrTemp1(11)), , B lastx = X lasty = y End Select ''' SelI = arrTemp(1) ''' * This code to transfere the selected item ID from temp arrey to its arrEG SelI = arrTemp1(1) ''' * This code to transfere the selected item ID from temp arrey to its arrEGEnd If End If End If End Sub Private Sub picElev_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, temp As Long Dim dimensionA As Long, dimensionB As Long MousePointer = Default '''''''''''''''''''''' On Error GoTo errortrap ''' Edit Mood 'Debug.Print SelI If optWorkMod(0) = False And optWorkMod(1) = True Then 'And ItemSelect = True Then MousePointer = Default 'arrEG(1, SelI) = arrTemp(1) 'arrEG(2, SelI) = arrTemp(2) 'arrEG(3, SelI) = arrTemp(3) 'arrEG(4, SelI) = arrTemp(4) 'arrEG(5, SelI) = lastx - AnchorX1 'arrEG(6, SelI) = lasty - AnchorY1 'arrEG(7, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrEG(8, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) 'arrEG(9, SelI) = arrEG(7, SelI) - arrEG(5, SelI) ' Width 'arrEG(10, SelI) = arrEG(8, SelI) - arrEG(6, SelI) ' Height 'arrEG(11, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrEG(12, SelI) = lasty - AnchorY1 'arrEG(13, SelI) = lastx - AnchorX1 'arrEG(14, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrEG(15, SelI) = lastx - AnchorX1 'arrEG(16, SelI) = arrTemp(16) 'arrEG(17, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrEG(18, SelI) = arrTemp(18) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrEG(19, SelI) = arrTemp(19) 'arrEG(20, SelI) = lasty - AnchorY1 'arrEG(21, SelI) = arrTemp(21) 'arrEG(22, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) '''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrEG(23, SelI) = arrTemp(23) MousePointer = 5

'================================================================================= ===== arrE(5, SelI) = lastx - AnchorX1 ' CurrentX arrE(6, SelI) = lasty - AnchorY1 ' CurrentY arrE(7, SelI) = lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2) ' lastX arrE(8, SelI) = lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3) ' lastY arrE(9, SelI) = lastx - AnchorX1 ' LimitX arrE(10, SelI) = lasty - AnchorY1 ' LimitY arrP(5, SelI) = lastx - AnchorX1 arrP(6, SelI) = arrTemp1(7) arrP(7, SelI) = lastx - AnchorX1 + arrTemp1(8) - arrTemp1(6) arrP(8, SelI) = arrTemp1(9) ' arrTemp1(7) + TBoard arrP(9, SelI) = lastx - AnchorX1 'LimitZ in x direction arrP(10, SelI) = arrTemp1(7) 'LimitZ in Y direction arrS(5, SelI) = arrTemp1(10) arrS(6, SelI) = lasty - AnchorY1 arrS(7, SelI) = arrTemp1(12) ' arrTemp1(10) + TBoard arrS(8, SelI) = lasty - AnchorY1 + arrTemp1(13) - arrTemp1(11) arrS(9, SelI) = arrTemp1(10) 'PlanLimit arrS(10, SelI) = lasty - AnchorY1 '================================================================================= ===== Erase arrTemp1() 'Erase arrTemp() ''' *** make check what if this line remarked End If If optWorkMod(0) = True And optWorkMod(1) = False Then '''* this 3 code lines causes the application to stay in edit GoTo StartUpData ''' mood only unless we click and swich to design mood, so Else: Exit Sub ''' the following codes applied for new objects drawn . End If StartUpData: '' '' ''' Drawing Mood '' Here we should return arrEG data '' If lastx < CurrentX Then '' back to arrE to save final data after'' temp = lastx '' editing the item '' lastx = CurrentX ''''''''''''''''''''''''''''''''''''''''''' CurrentX = temp dimensionA = lastx - CurrentX Else: dimensionA = lastx - CurrentX End If If lasty < CurrentY Then temp = lasty lasty = CurrentY CurrentY = temp dimensionB = lasty - CurrentY Else: dimensionB = lasty - CurrentY End If If MoveStat = True Then MoveStat = False lblMouse.Visible = False lblMouse.Caption = 0 & "," & 0 lblMouse.Left = 50: lblMouse.Top = 50 If Button = vbRightButton Then Exit Sub If Button = vbLeftButton Then picElev.DrawMode = 13 If Abs(lastx - CurrentX) < 3 * (TBoard) Or Abs(lasty - CurrentY) < 3 * (TBoard) Then picElev.DrawMode = 6 picElev.Line (CurrentX, CurrentY)-(lastx, lasty), , B

picPlan.Line (CurrentX, LimitZ)-(lastx, LimitZ + TBoard), , B picSide.Line (LimitZ, CurrentY)-(LimitZ + TBoard, lasty), , B MousePointer = Default Exit Sub End If ''''''''''''''''''''''********** If Abs(dimensionA) > BoardMax Or Abs(dimensionB) > BoardMax Then picElev.DrawMode = 6 picElev.Line (CurrentX, CurrentY)-(lastx, lasty), , B picPlan.Line (CurrentX, LimitZ)-(lastx, LimitZ + TBoard), , B picSide.Line (LimitZ, CurrentY)-(LimitZ + TBoard, lasty), , B MousePointer = Default MsgBox "Sorry , the dimensions exceed board dimensions", vbOK, "Invalid entry" Exit Sub End If If Abs(dimensionA) > BoardMin And Abs(dimensionB) > BoardMin Then picElev.DrawMode = 6 picElev.Line (CurrentX, CurrentY)-(lastx, lasty), , B picPlan.Line (CurrentX, LimitZ)-(lastx, LimitZ + TBoard), , B picSide.Line (LimitZ, CurrentY)-(LimitZ + TBoard, lasty), , B MousePointer = Default MsgBox "Sorry , the dimensions exceed board dimensions", vbOK, "Invalid entry" Exit Sub End If cmdFlexRep1.Enabled = True cmdRep1.Enabled = True cmdClearAll.Enabled = True cmdShId.Enabled = True cmdCloseFile.Enabled = True MousePointer = Default ReDim Preserve arrE(1 To 11, 1 To arrEC) As Long ReDim Preserve arrP(1 To 11, 1 To arrPC) As Long ReDim Preserve arrS(1 To 11, 1 To arrSC) As Long 'ReDim Preserve arrXYZ(1 To arrxyzC) As Long ReDim Preserve arrEG(1 To 23, 1 To arrEgc) As Long ReDim Preserve arrPG(1 To 23, 1 To arrPgc) As Long ReDim Preserve arrSG(1 To 23, 1 To arrSgc) As Long ReDim Preserve arrReport1(1 To 7, 1 To Rep1Counter) As String lblRep1Counter.Caption = Rep1Counter '''''''''''''''''''''''''' lblBoundVal(0).Caption = UBound(arrE, 2) ''' Repeated code lblBoundVal(1).Caption = UBound(arrP, 2) lblBoundVal(2).Caption = UBound(arrS, 2) End If StatusBar1.Panels(3).Text = " Width : " & Abs((lastx - CurrentX) / DrawingScale) & " m.m" StatusBar1.Panels(4).Text = " Height : " & Abs((CurrentY - lasty) / DrawingScale) & " m.m" ''''''''''''' ItemIDCount = ItemIDCount + 1 ItemCounter = ItemCounter + 1 lblItemCount.Caption = ItemCounter ItemCounterE = ItemCounterE + 1 lblICe.Caption = ItemCounterE '''********************************************* If lastx < CurrentX Then temp = lastx lastx = CurrentX CurrentX = temp

End If If lasty < CurrentY Then temp = lasty lasty = CurrentY CurrentY = temp End If 'LimitZ = arrP(10, UBound(arrP)) + Clearence ' LimitZ + Clearence '################ x1 = CurrentX: y1 = CurrentY: x2 = lastx: y2 = lasty x3 = x2: y3 = y1: x4 = x1: y4 = y2 x1a = x1: y1a = LimitZ: x2a = x2: y2a = LimitZ + TBoard x1b = LimitZ: y1b = y1: x2b = LimitZ + TBoard: y2b = y2 arrE(1, arrEC) = arrEC ' Ser. No. arrE(2, arrEC) = ItemIdE ' Local Part ID arrE(3, arrEC) = ItemIDCount ' General Part ID arrE(4, arrEC) = 1 ' Orientation (1 E, 2 P, 3 S ) arrE(5, arrEC) = x1 ' CurrentX arrE(6, arrEC) = y1 ' CurrentY arrE(7, arrEC) = x2 ' lastX arrE(8, arrEC) = y2 ' lastY arrE(9, arrEC) = 0 'x1 ' LimitX arrE(10, arrEC) = 0 'y1 ' LimitY arrE(11, arrEC) = 1 'Parent Orientation ' Parent ID ( Old Code ) ''''''''''''''''''''''''''''''''''''''' arrP(1, arrPC) = arrPC arrP(2, arrPC) = 0 arrP(3, arrPC) = 0 arrP(4, arrPC) = 2 arrP(5, arrPC) = x1 arrP(6, arrPC) = LimitZ arrP(7, arrPC) = x2 arrP(8, arrPC) = LimitZ + TBoard arrP(9, arrPC) = x1 'LimitZ in x direction arrP(10, arrPC) = LimitZ 'LimitZ in Y direction arrP(11, arrPC) = 1 'ItemIDCount ' Parent Orientation '''''''''''''''''''''''''''''''''''''''''' arrS(1, arrSC) = arrSC arrS(2, arrSC) = 0 arrS(3, arrSC) = 0 arrS(4, arrSC) = 3 arrS(5, arrSC) = LimitZ arrS(6, arrSC) = y1 arrS(7, arrSC) = LimitZ + TBoard arrS(8, arrSC) = y2 arrS(9, arrSC) = LimitZ 'LimitZ in x direction arrS(10, arrSC) = 0 ' y1 arrS(11, arrSC) = 1 'ItemIDCount ' Parent Orientation '''''''''''''''''''''''''''''''''''' ''' Array of all Parent items in PicElev ,grouped with their 2 sons arrEG(1, arrEgc) = arrEgc ' Array Counter arrEG(2, arrEgc) = ItemIdE ' Parent Local ID arrEG(3, arrEgc) = ItemIDCount ' Parent General ID arrEG(4, arrEgc) = 1 ' Orientation

arrEG(5, arrEgc) = x1 'corner 1x arrEG(6, arrEgc) = y1 'corner 1y arrEG(7, arrEgc) = x2 'corner 2x arrEG(8, arrEgc) = y2 'corner 2y arrEG(9, arrEgc) = x2 - x1 ' Width arrEG(10, arrEgc) = y2 - y1 ' Height arrEG(11, arrEgc) = x3 'corner 3x arrEG(12, arrEgc) = y3 'corner 3y arrEG(13, arrEgc) = x4 'corner 4x arrEG(14, arrEgc) = y4 'corner 4y arrEG(15, arrEgc) = x1a 'corner1 xa ,son in plan arrEG(16, arrEgc) = y1a 'corner1 ya ' limit Z arrEG(17, arrEgc) = x2a 'corner2 xa arrEG(18, arrEgc) = y2a 'corner2 ya arrEG(19, arrEgc) = x1b 'corner1 xb ' limit Z arrEG(20, arrEgc) = y1b 'corner1 yb arrEG(21, arrEgc) = x2b 'corner2 xb arrEG(22, arrEgc) = y2b 'corner2 yb arrEG(23, arrEgc) = ItemSelect 'Tag for selecting ,Boolean '''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Filling Report1 array : arrReport1 If OrientationI = 1 Then Orientation = "x-y,Elevation" arrReport1(1, Rep1Counter) = Rep1Counter arrReport1(2, Rep1Counter) = arrE(2, arrEC) arrReport1(3, Rep1Counter) = arrE(3, arrEC) arrReport1(4, Rep1Counter) = Orientation arrReport1(5, Rep1Counter) = Int(Abs((arrE(7, arrEC) - arrE(5, arrEC))) / (DrawingScale)) ' * 10) arrReport1(6, Rep1Counter) = Int(Abs((arrE(8, arrEC) - arrE(6, arrEC))) / (DrawingScale)) ' * 10) arrReport1(7, Rep1Counter) = FormatNumber(Abs(CDbl((arrE(7, arrEC) - arrE(5, arrEC)) * (arrE(8, arrEC) arrE(6, arrEC)))) / (DrawingScale * 1000) ^ 2, 2, vbTrue) 'ReportEnd: ''''''''''''''''''''''''''''''''''''''''' ItemIdE = ItemIdE + 1 arrEC = arrEC + 1 arrPC = arrPC + 1 arrSC = arrSC + 1 arrxyzC = arrxyzC + 1 arrEgc = arrEgc + 1 arrPgc = arrPgc + 1 arrSgc = arrSgc + 1 Rep1Counter = Rep1Counter + 1 LimitZ = LimitZ + Clearence ' LimitZ = arrP(10, UBound(arrP)) + Clearence ' LimitZ + Clearence StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Press mouse left button and drag to opposite corner to start drawing " errortrap: End Sub ''' =================================================== ''Sub_Showthegrid Sub Showthegrid() Dim i, j As Integer picElev.ForeColor = QBColor(Gridcolor): picElev.DrawStyle = Gridstyle picPlan.ForeColor = QBColor(Gridcolor): picPlan.DrawStyle = Gridstyle picSide.ForeColor = QBColor(Gridcolor): picSide.DrawStyle = Gridstyle ' vbMagenta For j = 0 To picElev.ScaleHeight Step Gridstep

picElev.Line (0, j)-(picElev.ScaleWidth, j) ', picElev.ForeColor Next j For i = 0 To picElev.ScaleWidth Step Gridstep picElev.Line (i, 0)-(i, picElev.ScaleHeight) ', picElev.ForeColor Next i For j = 0 To picPlan.ScaleHeight Step Gridstep picPlan.Line (0, j)-(ScaleWidth, j) ', picPlan.ForeColor Next j For i = 0 To picPlan.ScaleWidth Step Gridstep picPlan.Line (i, 0)-(i, ScaleHeight) ', picPlan.ForeColor Next i For j = 0 To picSide.ScaleHeight Step Gridstep picSide.Line (0, j)-(ScaleWidth, j) ', picSide.ForeColor Next j For i = 0 To picSide.ScaleWidth Step Gridstep picSide.Line (i, 0)-(i, ScaleHeight) ', picSide.ForeColor Next i picElev.DrawStyle = 0 picPlan.DrawStyle = 0 picSide.DrawStyle = 0 End Sub Sub Hidethegrid() picElev.ForeColor = &H80000005 picPlan.ForeColor = &H80000005 picSide.ForeColor = &H80000005 Dim i, j As Integer For j = 0 To picElev.ScaleHeight Step Gridstep picElev.Line (0, j)-(ScaleWidth, j) ', picElev.ForeColor For i = 0 To picElev.ScaleWidth Step Gridstep picElev.Line (i, 0)-(i, ScaleHeight) ', picElev.ForeColor Next i Next j For j = 0 To picPlan.ScaleHeight Step Gridstep picPlan.Line (0, j)-(ScaleWidth, j) ', picPlan.ForeColor For i = 0 To picPlan.ScaleWidth Step Gridstep picPlan.Line (i, 0)-(i, ScaleHeight) ', picPlan.ForeColor Next i Next j For j = 0 To picSide.ScaleHeight Step Gridstep picSide.Line (0, j)-(ScaleWidth, j) ', picSide.ForeColor For i = 0 To picSide.ScaleWidth Step Gridstep picSide.Line (i, 0)-(i, ScaleHeight) ', picSide.ForeColor Next i Next j End Sub Sub FixHandles(index As Integer) Dim j As Integer shpHande(0).Left = arrE(5, index) - 45: shpHande(0).Top = arrE(6, index) - 45 shpHande(1).Left = arrE(7, index) - 45: shpHande(1).Top = arrE(6, index) - 45 shpHande(2).Left = arrE(7, index) - 45: shpHande(2).Top = arrE(8, index) - 45

shpHande(3).Left = arrE(5, index) - 45: shpHande(3).Top = arrE(8, index) - 45 shpHandp(0).Left = arrP(5, index) - 45: shpHandp(0).Top = arrP(6, index) - 45 shpHandp(1).Left = arrP(7, index) - 45: shpHandp(1).Top = arrP(6, index) - 45 shpHandp(2).Left = arrP(7, index) - 45: shpHandp(2).Top = arrP(8, index) - 45 shpHandp(3).Left = arrP(5, index) - 45: shpHandp(3).Top = arrP(8, index) - 45 shpHands(0).Left = arrS(5, index) - 45: shpHands(0).Top = arrS(6, index) - 45 shpHands(1).Left = arrS(7, index) - 45: shpHands(1).Top = arrS(6, index) - 45 shpHands(2).Left = arrS(7, index) - 45: shpHands(2).Top = arrS(8, index) - 45 shpHands(3).Left = arrS(5, index) - 45: shpHands(3).Top = arrS(8, index) - 45 MousePointer = 5 For j = 0 To 3 shpHande(j).Visible = True shpHandp(j).Visible = True shpHands(j).Visible = True Next j ' ItemSelect = 1 ' MoveStat = True ' lastx = X '*************** ' lasty = Y '**************** End Sub '''=========================================================================== Private Sub picPlan_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer If optWorkMod(0) = True And optWorkMod(1) = False Then If Button = vbLeftButton Then lblmousp.Visible = True lblmousp.Caption = 0 & "," & 0 lblmousp.Left = (X - 50 - lblmousp.Width): lblmousp.Top = (y - 275) OrientationI = 2 CurrentX = X CurrentY = y lastx = X lasty = y MousePointer = 2 Else: Exit Sub End If If OrientationI = 2 Then lblOrientation.Caption = "X-Z" End If End If '''***************************************************** If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton Then Dim ISel As Integer On Error GoTo errortrap 'ReDim arrTemp(1 To 23) ReDim arrTemp1(1 To 14) AnchorX = X ' Basic Value AnchorY = y ' Basic Value For i = 1 To UBound(arrP, 2) ' (arrPG, 2) 'If AnchorX > arrPG(5, i) And AnchorX < arrPG(7, i) Then ' If AnchorY > arrPG(6, i) And AnchorY < arrPG(8, i) Then If AnchorX > arrP(5, i) And AnchorX < arrP(7, i) Then If AnchorY > arrP(6, i) And AnchorY < arrP(8, i) Then ISel = i Call FixHandles(ISel)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' shpHandp(0).Left = arrPG(5, i) - 45: shpHandp(0).Top = arrPG(6, i) - 45 ' shpHandp(1).Left = arrPG(7, i) - 45: shpHandp(1).Top = arrPG(6, i) - 45 ' shpHandp(2).Left = arrPG(7, i) - 45: shpHandp(2).Top = arrPG(8, i) - 45 ' shpHandp(3).Left = arrPG(5, i) - 45: shpHandp(3).Top = arrPG(8, i) - 45 'Debug.Print arrPG(5, i); arrPG(6, i) ' shpHands(0).Left = arrPG(15, i) - 45: shpHands(0).Top = arrPG(16, i) - 45 ' shpHands(1).Left = arrPG(17, i) - 45: shpHands(1).Top = arrPG(16, i) - 45 ' shpHands(2).Left = arrPG(17, i) - 45: shpHands(2).Top = arrPG(18, i) - 45 ' shpHands(3).Left = arrPG(15, i) - 45: shpHands(3).Top = arrPG(18, i) - 45 'Debug.Print arrPG(5, i); arrPG(6, i) ' shpHande(0).Left = arrPG(19, i) - 45: shpHande(0).Top = arrPG(20, i) - 45 ' shpHande(1).Left = arrPG(21, i) - 45: shpHande(1).Top = arrPG(20, i) - 45 ' shpHande(2).Left = arrPG(21, i) - 45: shpHande(2).Top = arrPG(22, i) - 45 ' shpHande(3).Left = arrPG(19, i) - 45: shpHande(3).Top = arrPG(22, i) - 45 ' shpHande(0).Left = arrE(5, i) - 45: shpHande(0).Top = arrE(6, i) - 45 ' shpHande(1).Left = arrE(7, i) - 45: shpHande(1).Top = arrE(6, i) - 45 ' shpHande(2).Left = arrE(7, i) - 45: shpHande(2).Top = arrE(8, i) - 45 ' shpHande(3).Left = arrE(5, i) - 45: shpHande(3).Top = arrE(8, i) - 45 ' shpHandp(0).Left = arrP(5, i) - 45: shpHandp(0).Top = arrP(6, i) - 45 ' shpHandp(1).Left = arrP(7, i) - 45: shpHandp(1).Top = arrP(6, i) - 45 ' shpHandp(2).Left = arrP(7, i) - 45: shpHandp(2).Top = arrP(8, i) - 45 ' shpHandp(3).Left = arrP(5, i) - 45: shpHandp(3).Top = arrP(8, i) - 45 ' shpHands(0).Left = arrS(5, i) - 45: shpHands(0).Top = arrS(6, i) - 45 ' shpHands(1).Left = arrS(7, i) - 45: shpHands(1).Top = arrS(6, i) - 45 ' shpHands(2).Left = arrS(7, i) - 45: shpHands(2).Top = arrS(8, i) - 45 ' shpHands(3).Left = arrS(5, i) - 45: shpHands(3).Top = arrS(8, i) - 45 ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' MousePointer = 5 ' For j = 0 To 3 ' shpHande(j).Visible = True ' shpHandp(j).Visible = True ' shpHands(j).Visible = True ' Next j ItemSelect = True '' arrPG(23, i) = ItemSelect MoveStat = True lastx = X '*************** lasty = y '**************** '' AnchorX1 = AnchorX - arrPG(5, i) ' Fixed value '' AnchorY1 = AnchorY - arrPG(6, i) ' Fixed value AnchorX1 = AnchorX - arrP(5, i) ' Fixed value AnchorY1 = AnchorY - arrP(6, i) ' Fixed value ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' arrTemp1(1) = i arrTemp1(2) = arrP(5, i) arrTemp1(3) = arrP(6, i) arrTemp1(4) = arrP(7, i) arrTemp1(5) = arrP(8, i) arrTemp1(6) = arrS(5, i) arrTemp1(7) = arrS(6, i) arrTemp1(8) = arrS(7, i) arrTemp1(9) = arrS(8, i) arrTemp1(10) = arrE(5, i) arrTemp1(11) = arrE(6, i)

arrTemp1(12) = arrE(7, i) arrTemp1(13) = arrE(8, i) arrTemp1(14) = ItemSelect ' For k = 1 To 23 ' arrTemp(k) = arrPG(k, i) ' Next k SelI = i 'arrTemp(1) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Else 'For j = 0 To 3 'shpHande(j).Visible = False 'shpHandp(j).Visible = False 'shpHands(j).Visible = False 'Next j 'ItemSelect = 0 'arrTemp(23) = ItemSelect 'MoveStat = False MousePointer = Default End If Else 'For j = 0 To 3 ' shpHande(j).Visible = False ' shpHandp(j).Visible = False ' shpHands(j).Visible = False 'Next j ' ItemSelect = 0 ' arrTemp(23) = ItemSelect MousePointer = Default End If Next i End If errortrap: End Sub Private Sub picPlan_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer AnchorX = X ' Basic Value AnchorY = y ' Basic Value MousePointer = Default ''' Drawing Mode *** If optWorkMod(0) = True And optWorkMod(1) = False Then picElev.DrawStyle = 0 picPlan.DrawStyle = 0 picSide.DrawStyle = 0 picPlan.DrawMode = vbInvert picSide.DrawMode = vbInvert picElev.DrawMode = vbInvert If Button = vbLeftButton Then picPlan.Line (CurrentX, CurrentY)-(X, y), , B picPlan.Line (CurrentX, CurrentY)-(lastx, lasty), , B picSide.Line (CurrentY, LimitY)-(y, LimitY + TBoard), , B picSide.Line (CurrentY, LimitY)-(lasty, LimitY + TBoard), , B picElev.Line (CurrentX, LimitY)-(X, LimitY + TBoard), , B picElev.Line (CurrentX, LimitY)-(lastx, LimitY + TBoard), , B lastx = X lasty = y

End If StatusBar1.Panels(1).Text = " X : " & Int(X) StatusBar1.Panels(2).Text = " Y : " & Int(y) lblmousp.Caption = (lastx - CurrentX) / DrawingScale & "," & (lasty - CurrentY) / DrawingScale lblmousp.Left = (X - 50 - lblmousp.Width): lblmousp.Top = (y - 275) End If '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' Mouse hoover event *** If optWorkMod(0) = False And optWorkMod(1) = True Then StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Hoover your mouse over objects, to select , then press mouse left button to edit " For j = 0 To 3 shpHande(j).Left = 0: shpHande(j).Top = 0 shpHandp(j).Left = 0: shpHandp(j).Top = 0 shpHands(j).Left = 0: shpHands(j).Top = 0 shpHande(j).Visible = False ' this line causes the handles to hide at shpHandp(j).Visible = False ' the bigining of mouse move first time !!! shpHands(j).Visible = False Next j StatusBar1.Panels(1).Text = " X : " & Int(AnchorX) StatusBar1.Panels(2).Text = " Y : " & Int(AnchorY) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton And MoveStat = True Then 'And ItemSelect = True Then MoveItem: 'Debug.Print SelI; "ghazy" MousePointer = 5 ' picPlan.Line (X - AnchorX1, Y - AnchorY1)-(X - AnchorX1 + arrTemp(7) - arrTemp(5), Y - AnchorY1 + arrTemp(8) - arrTemp(6)), , B ' picPlan.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp(7) - arrTemp(5), lasty AnchorY1 + arrTemp(8) - arrTemp(6)), , B ' picSide.Line (Y - AnchorY1, arrTemp(16))-(Y - AnchorY1 + arrTemp(8) - arrTemp(6), arrTemp(16) + TBoard), ,B ' picSide.Line (lasty - AnchorY1, arrTemp(16))-(lasty - AnchorY1 + arrTemp(8) - arrTemp(6), arrTemp(16) + TBoard), , B ' picElev.Line (X - AnchorX1, arrTemp(20))-(X - AnchorX1 + arrTemp(7) - arrTemp(5), arrTemp(20) + TBoard), ,B ' arrTemp(16)) ' picElev.Line (lastx - AnchorX1, arrTemp(20))-(lastx - AnchorX1 + arrTemp(7) - arrTemp(5), arrTemp(20) + TBoard), , B Dim ItemAddress As Integer ItemAddress = 6 - (arrP(4, SelI) + arrP(11, SelI)) Select Case ItemAddress Case 1 picPlan.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picSide.Line (y - AnchorY1, arrTemp1(7))-(y - AnchorY1 + arrTemp1(5) - arrTemp1(3), arrTemp1(9)), , B picSide.Line (lasty - AnchorY1, arrTemp1(7))-(lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3), arrTemp1(9)), ,B picElev.Line (X - AnchorX1, arrTemp1(11))-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), arrTemp1(13)), , B ' arrTemp1(16)) picElev.Line (lastx - AnchorX1, arrTemp1(11))-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), arrTemp1(13)), , B lastx = X

lasty = y Case 2 picPlan.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picSide.Line (y - AnchorY1, arrTemp1(7))-(y - AnchorY1 + arrTemp1(5) - arrTemp1(3), arrTemp1(9)), , B picSide.Line (lasty - AnchorY1, arrTemp1(7))-(lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3), arrTemp1(9)), ,B picElev.Line (X - AnchorX1, arrTemp1(11))-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), arrTemp1(13)), , B ' arrTemp1(16)) picElev.Line (lastx - AnchorX1, arrTemp1(11))-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), arrTemp1(13)), , B lastx = X lasty = y Case 3 picPlan.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picPlan.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picSide.Line (y - AnchorY1, arrTemp1(7))-(y - AnchorY1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), , B picSide.Line (lasty - AnchorY1, arrTemp1(7))-(lasty - AnchorY1 + arrTemp1(8) - arrTemp1(6), arrTemp1(9)), ,B picElev.Line (X - AnchorX1, arrTemp1(11))-(X - AnchorX1 + arrTemp1(12) - arrTemp1(10), arrTemp1(13)), , B ' arrTemp1(16)) picElev.Line (lastx - AnchorX1, arrTemp1(11))-(lastx - AnchorX1 + arrTemp1(12) - arrTemp1(10), arrTemp1(13)), , B lastx = X lasty = y End Select SelI = arrTemp1(1) End If End If End Sub Private Sub picPlan_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, temp As Long Dim dimensionA As Long, dimensionB As Long MousePointer = Default '''''''''''''''''''''' On Error GoTo errortrap If optWorkMod(0) = False And optWorkMod(1) = True Then 'And ItemSelect = True Then MousePointer = Default 'arrPG(1, SelI) = arrTemp(1) 'arrPG(2, SelI) = arrTemp(2) 'arrPG(3, SelI) = arrTemp(3) 'arrPG(4, SelI) = arrTemp(4) 'arrPG(5, SelI) = lastx - AnchorX1 'arrPG(6, SelI) = lasty - AnchorY1 'arrPG(7, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrPG(8, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) 'arrPG(9, SelI) = arrPG(7, SelI) - arrPG(5, SelI) ' Width 'arrPG(10, SelI) = arrPG(8, SelI) - arrPG(6, SelI) ' Height 'arrPG(11, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5)

'arrPG(12, SelI) = lasty - AnchorY1 'arrPG(13, SelI) = lastx - AnchorX1 'arrPG(14, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) '''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrPG(15, SelI) = lasty - AnchorY1 'arrPG(16, SelI) = arrTemp(16) 'arrPG(17, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) 'arrPG(18, SelI) = arrTemp(18) '''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrPG(19, SelI) = lastx - AnchorX1 'arrPG(20, SelI) = arrTemp(20) 'arrPG(21, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrPG(22, SelI) = arrTemp(22) 'arrEG(23, SelI) = arrTemp(23) MousePointer = 5 '================================================================================= === arrP(5, SelI) = lastx - AnchorX1 ' CurrentX arrP(6, SelI) = lasty - AnchorY1 ' CurrentY arrP(7, SelI) = lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2) ' lastX arrP(8, SelI) = lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3) ' lastY arrP(9, SelI) = lastx - AnchorX1 ' LimitX arrP(10, SelI) = lasty - AnchorY1 ' LimitY arrS(5, SelI) = lasty - AnchorY1 arrS(6, SelI) = arrTemp(7) arrS(7, SelI) = lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3) 'lastx - AnchorX1 + arrTemp(7) arrTemp(5) arrS(8, SelI) = arrTemp1(7) + TBoard arrS(9, SelI) = lasty - AnchorY1 'lastx - AnchorX1 'LimitZ in x direction arrS(10, SelI) = arrTemp1(7) 'LimitZ in Y direction arrE(5, SelI) = lastx - AnchorX1 'arrTemp(19) ' arrE(6, SelI) = arrTemp1(11) 'lasty - AnchorY1 arrE(7, SelI) = lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2) 'arrTemp(21) arrE(8, SelI) = arrTemp1(11) + TBoard 'lasty - AnchorY1 + arrTemp(8) - arrTemp(6) arrE(9, SelI) = lastx - AnchorX1 'arrTemp(19) 'PlanLimit arrE(10, SelI) = arrTemp1(11) 'lasty - AnchorY1 '================================================================================= ===== Erase arrTemp1() 'Erase arrTemp() End If If optWorkMod(0) = True And optWorkMod(1) = False Then GoTo StartUpData Else: Exit Sub End If StartUpData: If lastx < CurrentX Then temp = lastx lastx = CurrentX CurrentX = temp dimensionA = lastx - CurrentX Else: dimensionA = lastx - CurrentX End If If lasty < CurrentY Then temp = lasty

lasty = CurrentY CurrentY = temp dimensionB = lasty - CurrentY Else: dimensionB = lasty - CurrentY End If If MoveStat = True Then MoveStat = False lblmousp.Visible = False lblmousp.Caption = 0 & "," & 0 lblmousp.Left = 50: lblmousp.Top = 50 If Button = vbRightButton Then Exit Sub If Button = vbLeftButton Then picPlan.DrawMode = 13 ''' Check to eleminate the drawing of very small parts ( less than 3 times board thickness ) If Abs(lastx - CurrentX) < 3 * (TBoard) Or Abs(lasty - CurrentY) < 3 * (TBoard) Then picPlan.DrawMode = 6 picPlan.Line (CurrentX, CurrentY)-(lastx, lasty), , B picSide.Line (CurrentY, LimitY)-(lasty, LimitY + TBoard), , B picElev.Line (CurrentX, LimitY)-(lastx, LimitY + TBoard), , B MousePointer = Default Exit Sub End If If Abs(dimensionA) > BoardMax Or Abs(dimensionB) > BoardMax Then picPlan.DrawMode = 6 picPlan.Line (CurrentX, CurrentY)-(lastx, lasty), , B picSide.Line (CurrentY, LimitY)-(lasty, LimitY + TBoard), , B picElev.Line (CurrentX, LimitY)-(lastx, LimitY + TBoard), , B MousePointer = Default MsgBox "Sorry , the dimensions are outside board dimensions", vbOK, "Invalid entry" Exit Sub End If If Abs(dimensionA) > BoardMin And Abs(dimensionB) > BoardMin Then picPlan.DrawMode = 6 picPlan.Line (CurrentX, CurrentY)-(lastx, lasty), , B picSide.Line (CurrentY, LimitY)-(lasty, LimitY + TBoard), , B picElev.Line (CurrentX, LimitY)-(lastx, LimitY + TBoard), , B MousePointer = Default MsgBox "Sorry , the dimensions are outside board dimensions", vbOK, "Invalid entry" Exit Sub End If cmdFlexRep1.Enabled = True cmdRep1.Enabled = True cmdClearAll.Enabled = True cmdShId.Enabled = True cmdCloseFile.Enabled = True MousePointer = Default ReDim Preserve arrE(1 To 11, 1 To arrEC) As Long ReDim Preserve arrP(1 To 11, 1 To arrPC) As Long ReDim Preserve arrS(1 To 11, 1 To arrSC) As Long 'ReDim Preserve arrXYZ(1 To arrxyzC) As Long ReDim Preserve arrEG(1 To 23, 1 To arrEgc) As Long ReDim Preserve arrPG(1 To 23, 1 To arrPgc) As Long ReDim Preserve arrSG(1 To 23, 1 To arrSgc) As Long ReDim Preserve arrReport1(1 To 7, 1 To Rep1Counter) As String lblRep1Counter.Caption = Rep1Counter ''''''''''''''''''''''''' lblBoundVal(1).Caption = UBound(arrP, 2)

lblBoundVal(2).Caption = UBound(arrS, 2) lblBoundVal(0).Caption = UBound(arrE, 2) End If StatusBar1.Panels(3).Text = " Width : " & Abs((lastx - CurrentX) / DrawingScale) & " m.m" StatusBar1.Panels(4).Text = " Height : " & Abs((CurrentY - lasty) / DrawingScale) & " m.m" ItemIDCount = ItemIDCount + 1 ItemCounter = ItemCounter + 1 lblItemCount.Caption = ItemCounter ItemCounterP = ItemCounterP + 1 lblICp.Caption = ItemCounterP ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If lastx < CurrentX Then temp = lastx lastx = CurrentX CurrentX = temp End If If lasty < CurrentY Then temp = lasty lasty = CurrentY CurrentY = temp End If ''''''''''''''''''''''''''''''''''''''''''' x1 = CurrentX: y1 = CurrentY: x2 = lastx: y2 = lasty x3 = x2: y3 = y1: x4 = x1: y4 = y2 x1a = y1: y1a = LimitY: x2a = y2: y2a = LimitY + TBoard x1b = x1: y1b = LimitY: x2b = x2: y2b = LimitY + TBoard arrP(1, arrPC) = arrPC arrP(2, arrPC) = ItemIdP arrP(3, arrPC) = ItemIDCount arrP(4, arrPC) = 2 arrP(5, arrPC) = x1 arrP(6, arrPC) = y1 arrP(7, arrPC) = x2 arrP(8, arrPC) = y2 arrP(9, arrPC) = 0 'x1 arrP(10, arrPC) = 0 'y1 arrP(11, arrPC) = 2 ''''''''''''''''''''''''''''''''''''''''' arrS(1, arrSC) = arrSC arrS(2, arrSC) = 0 arrS(3, arrSC) = 0 arrS(4, arrSC) = 3 arrS(5, arrSC) = y1 arrS(6, arrSC) = LimitY arrS(7, arrSC) = y2 arrS(8, arrSC) = LimitY + TBoard arrS(9, arrSC) = y1 'PlanLimit arrS(10, arrSC) = LimitY arrS(11, arrSC) = 2 'ItemIDCount '''''''''''''''''''''''''''''''''''''''''''' arrE(1, arrEC) = arrEC arrE(2, arrEC) = 0 arrE(3, arrEC) = 0

arrE(4, arrEC) = 1 arrE(5, arrEC) = x1 arrE(6, arrEC) = LimitY arrE(7, arrEC) = x2 arrE(8, arrEC) = LimitY + TBoard arrE(9, arrEC) = x1 'ElevLimit arrE(10, arrEC) = LimitY arrE(11, arrEC) = 2 'ItemIDCount ''''''''''''''''''''''''''''''''''' ''' Array of all Parent items in PicPlan ,grouped with their 2 sons arrPG(1, arrPgc) = arrPgc ' Array Counter arrPG(2, arrPgc) = ItemIdP ' Parent Local ID arrPG(3, arrPgc) = ItemIDCount ' Parent General ID arrPG(4, arrPgc) = 1 ' Orientation arrPG(5, arrPgc) = x1 'corner 1x arrPG(6, arrPgc) = y1 'corner 1y arrPG(7, arrPgc) = x2 'corner 2x arrPG(8, arrPgc) = y2 'corner 2y arrPG(9, arrPgc) = x2 - x1 ' Width arrPG(10, arrPgc) = y2 - y1 ' Height arrPG(11, arrPgc) = x3 'corner 3x arrPG(12, arrPgc) = y3 'corner 3y arrPG(13, arrPgc) = x4 'corner 4x arrPG(14, arrPgc) = y4 'corner 4y arrPG(15, arrPgc) = x1a 'corner 1xa ' son in Side arrPG(16, arrPgc) = y1a 'corner 1ya arrPG(17, arrPgc) = x2a 'corner 2xa arrPG(18, arrPgc) = y2a 'corner 2ya arrPG(19, arrPgc) = x1b 'corner 1xb ' son in Elev arrPG(20, arrPgc) = y1b 'corner 1yb arrPG(21, arrPgc) = x2b 'corner 2xb arrPG(22, arrPgc) = y2b 'corner 2yb arrPG(23, arrPgc) = ItemSelect 'Tag for selecting ,Boolean '''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Filling Report1 array : arrReport1 If OrientationI = 2 Then Orientation = "x-z,Plan" arrReport1(1, Rep1Counter) = Rep1Counter arrReport1(2, Rep1Counter) = arrP(2, arrPC) arrReport1(3, Rep1Counter) = arrP(3, arrPC) arrReport1(4, Rep1Counter) = Orientation arrReport1(5, Rep1Counter) = Int(Abs((arrP(7, arrPC) - arrP(5, arrPC))) / (DrawingScale)) ' * 10) arrReport1(6, Rep1Counter) = Int(Abs((arrP(8, arrPC) - arrP(6, arrPC))) / (DrawingScale)) ' * 10) arrReport1(7, Rep1Counter) = FormatNumber(Abs(CDbl((arrP(7, arrPC) - arrP(5, arrPC)) * (arrP(8, arrPC) arrP(6, arrPC)))) / (DrawingScale * 1000) ^ 2, 2, vbTrue) 'ReportEnd: '''''''''''''''''''''''''''''''''''''' ItemIdP = ItemIdP + 1 arrEC = arrEC + 1 arrPC = arrPC + 1 arrSC = arrSC + 1 arrxyzC = arrxyzC + 1 arrEgc = arrEgc + 1 arrPgc = arrPgc + 1 arrSgc = arrSgc + 1 Rep1Counter = Rep1Counter + 1 LimitY = LimitY + Clearence

'LimitY = arrS(10, UBound(arrS)) + Clearence ' Limity + Clearence StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Press mouse left button and drag to opposite corner to start drawing " errortrap: End Sub Private Sub picSide_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer If optWorkMod(0) = True And optWorkMod(1) = False Then If Button = vbLeftButton Then lblmouss.Visible = True lblmouss.Caption = 0 & "," & 0 lblmouss.Left = (X - 50 - lblmouss.Width): lblmouss.Top = (y - 275) OrientationI = 3 CurrentX = X CurrentY = y lastx = X lasty = y MousePointer = 2 Else: Exit Sub End If If OrientationI = 3 Then lblOrientation.Caption = "Z-Y" End If End If '''******************************************************* If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton Then Dim ISel As Integer On Error GoTo errortrap ''ReDim arrTemp(1 To 23) ReDim arrTemp1(1 To 14) AnchorX = X ' Basic Value AnchorY = y ' Basic Value For i = 1 To UBound(arrS, 2) ' If AnchorX > arrSG(5, i) And AnchorX < arrSG(7, i) Then ' If AnchorY > arrSG(6, i) And AnchorY < arrSG(8, i) Then If AnchorX > arrS(5, i) And AnchorX < arrS(7, i) Then If AnchorY > arrS(6, i) And AnchorY < arrS(8, i) Then ISel = i Call FixHandles(ISel) '' '' '' '' '' '' '' '' '' '' '' '' shpHands(0).Left = arrSG(5, i) - 45: shpHands(0).Top = arrSG(6, i) - 45 shpHands(1).Left = arrSG(7, i) - 45: shpHands(1).Top = arrSG(6, i) - 45 shpHands(2).Left = arrSG(7, i) - 45: shpHands(2).Top = arrSG(8, i) - 45 shpHands(3).Left = arrSG(5, i) - 45: shpHands(3).Top = arrSG(8, i) - 45 'Debug.Print arrSG(5, i); arrSG(6, i) shpHande(0).Left = arrSG(15, i) - 45: shpHande(0).Top = arrSG(16, i) - 45 shpHande(1).Left = arrSG(17, i) - 45: shpHande(1).Top = arrSG(16, i) - 45 shpHande(2).Left = arrSG(17, i) - 45: shpHande(2).Top = arrSG(18, i) - 45 shpHande(3).Left = arrSG(15, i) - 45: shpHande(3).Top = arrSG(18, i) - 45 'Debug.Print arrSG(5, i); arrSG(6, i) shpHandp(0).Left = arrSG(19, i) - 45: shpHandp(0).Top = arrSG(20, i) - 45 shpHandp(1).Left = arrSG(21, i) - 45: shpHandp(1).Top = arrSG(20, i) - 45 shpHandp(2).Left = arrSG(21, i) - 45: shpHandp(2).Top = arrSG(22, i) - 45 shpHandp(3).Left = arrSG(19, i) - 45: shpHandp(3).Top = arrSG(22, i) - 45

' shpHande(0).Left = arrE(5, i) - 45: shpHande(0).Top = arrE(6, i) - 45 ' shpHande(1).Left = arrE(7, i) - 45: shpHande(1).Top = arrE(6, i) - 45 ' shpHande(2).Left = arrE(7, i) - 45: shpHande(2).Top = arrE(8, i) - 45 ' shpHande(3).Left = arrE(5, i) - 45: shpHande(3).Top = arrE(8, i) - 45 ' shpHandp(0).Left = arrP(5, i) - 45: shpHandp(0).Top = arrP(6, i) - 45 ' shpHandp(1).Left = arrP(7, i) - 45: shpHandp(1).Top = arrP(6, i) - 45 ' shpHandp(2).Left = arrP(7, i) - 45: shpHandp(2).Top = arrP(8, i) - 45 ' shpHandp(3).Left = arrP(5, i) - 45: shpHandp(3).Top = arrP(8, i) - 45 ' shpHands(0).Left = arrS(5, i) - 45: shpHands(0).Top = arrS(6, i) - 45 ' shpHands(1).Left = arrS(7, i) - 45: shpHands(1).Top = arrS(6, i) - 45 ' shpHands(2).Left = arrS(7, i) - 45: shpHands(2).Top = arrS(8, i) - 45 ' shpHands(3).Left = arrS(5, i) - 45: shpHands(3).Top = arrS(8, i) - 45 '''''''''''''''''''''''''''''''''''''''''''''''''''''' ' MousePointer = 5 ' For j = 0 To 3 ' shpHande(j).Visible = True ' shpHandp(j).Visible = True ' shpHands(j).Visible = True ' Next j ItemSelect = True '' arrSG(23, i) = ItemSelect arrTemp1(14) = ItemSelect MoveStat = True lastx = X '*************** lasty = y '**************** '' AnchorX1 = AnchorX - arrSG(5, i) ' Fixed value '' AnchorY1 = AnchorY - arrSG(6, i) ' Fixed value AnchorX1 = AnchorX - arrS(5, i) ' Fixed value AnchorY1 = AnchorY - arrS(6, i) ' Fixed value ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' arrTemp1(1) = i arrTemp1(2) = arrS(5, i) arrTemp1(3) = arrS(6, i) arrTemp1(4) = arrS(7, i) arrTemp1(5) = arrS(8, i) arrTemp1(6) = arrE(5, i) arrTemp1(7) = arrE(6, i) arrTemp1(8) = arrE(7, i) arrTemp1(9) = arrE(8, i) arrTemp1(10) = arrP(5, i) arrTemp1(11) = arrP(6, i) arrTemp1(12) = arrP(7, i) arrTemp1(13) = arrP(8, i) arrTemp1(14) = ItemSelect '' For k = 1 To 23 '' arrTemp(k) = arrSG(k, i) '' Next k SelI = i 'arrTemp(1) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Else 'For j = 0 To 3 'shpHande(j).Visible = False 'shpHandp(j).Visible = False 'shpHands(j).Visible = False 'Next j 'ItemSelect = 0

'arrTemp(23) = ItemSelect 'MoveStat = False MousePointer = Default End If Else 'For j = 0 To 3 'shpHande(j).Visible = False 'shpHandp(j).Visible = False 'shpHands(j).Visible = False 'Next j 'ItemSelect = 0 'arrTemp(23) = ItemSelect MousePointer = Default End If Next i End If errortrap: End Sub Private Sub picSide_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, k As Integer AnchorX = X ' Basic Value AnchorY = y ' Basic Value MousePointer = Default ''' Drawing Mode *** If optWorkMod(0) = True And optWorkMod(1) = False Then picElev.DrawStyle = 0 picPlan.DrawStyle = 0 picSide.DrawStyle = 0 picElev.DrawMode = vbInvert picPlan.DrawMode = vbInvert picSide.DrawMode = vbInvert '''''''''''''''''''''''''''''''''''''''''''''''''' If Button = vbLeftButton Then picSide.Line (CurrentX, CurrentY)-(X, y), , B picSide.Line (CurrentX, CurrentY)-(lastx, lasty), , B picElev.Line (LimitX, CurrentY)-(LimitX + TBoard, y), , B picElev.Line (LimitX, CurrentY)-(LimitX + TBoard, lasty), , B picPlan.Line (LimitX, CurrentX)-(LimitX + TBoard, X), , B picPlan.Line (LimitX, CurrentX)-(LimitX + TBoard, lastx), , B lastx = X lasty = y End If StatusBar1.Panels(1).Text = " X : " & Int(X) StatusBar1.Panels(2).Text = " Y : " & Int(y) lblmouss.Caption = (lastx - CurrentX) / DrawingScale & "," & (lasty - CurrentY) / DrawingScale lblmouss.Left = (X - 50 - lblmouss.Width): lblmouss.Top = (y - 275) End If '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' Mouse Hoovering Event *** If optWorkMod(0) = False And optWorkMod(1) = True Then StatusBar1.Panels(6).Text = " " StatusBar1.Panels(6).Text = " Hoover your mouse over objects, to select , then press mouse left button to edit " ''' Docking and initializing the handles For j = 0 To 3 shpHande(j).Left = 0: shpHande(j).Top = 0

shpHandp(j).Left = 0: shpHandp(j).Top = 0 shpHands(j).Left = 0: shpHands(j).Top = 0 shpHande(j).Visible = False ' this line causes the handles to hide at shpHandp(j).Visible = False ' the bigining of mouse move first time !!! shpHands(j).Visible = False Next j StatusBar1.Panels(1).Text = " X : " & Int(AnchorX) StatusBar1.Panels(2).Text = " Y : " & Int(AnchorY) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If optWorkMod(0) = False And optWorkMod(1) = True And Button = vbLeftButton And MoveStat = True Then 'And ItemSelect = True Then MoveItem: MousePointer = 5 '' picSide.Line (X - AnchorX1, Y - AnchorY1)-(X - AnchorX1 + arrTemp(7) - arrTemp(5), Y - AnchorY1 + arrTemp(8) - arrTemp(6)), , B '' picSide.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp(7) - arrTemp(5), lasty AnchorY1 + arrTemp(8) - arrTemp(6)), , B '' picElev.Line (arrTemp(15), Y - AnchorY1)-(arrTemp(15) + TBoard, Y - AnchorY1 + arrTemp(8) - arrTemp(6)), ,B '' picElev.Line (arrTemp(15), lasty - AnchorY1)-(arrTemp(15) + TBoard, lasty - AnchorY1 + arrTemp(8) arrTemp(6)), , B '' picPlan.Line (arrTemp(19), X - AnchorX1)-(arrTemp(19) + TBoard, X - AnchorX1 + arrTemp(7) - arrTemp(5)), ,B '' picPlan.Line (arrTemp(19), lastx - AnchorX1)-(arrTemp(19) + TBoard, lastx - AnchorX1 + arrTemp(7) arrTemp(5)), , B ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' picSide.Line (X - AnchorX1, y - AnchorY1)-(X - AnchorX1 + arrTemp1(4) - arrTemp1(2), y - AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B picSide.Line (lastx - AnchorX1, lasty - AnchorY1)-(lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2), lasty AnchorY1 + arrTemp1(5) - arrTemp1(3)), , B '* picElev.Line (arrTemp1(6), Y - AnchorY1)-(arrTemp1(6) + TBoard, Y - AnchorY1 + arrTemp1(5) arrTemp1(3)), , B '* picElev.Line (arrTemp1(6), lasty - AnchorY1)-(arrTemp1(6) + TBoard, lasty - AnchorY1 + arrTemp1(5) arrTemp1(3)), , B picElev.Line (arrTemp1(6), y - AnchorY1)-(arrTemp1(8), y - AnchorY1 + arrTemp1(9) - arrTemp1(7)), , B ' may be 5-3 picElev.Line (arrTemp1(6), lasty - AnchorY1)-(arrTemp1(8), lasty - AnchorY1 + arrTemp1(9) - arrTemp1(7)), , B picPlan.Line (arrTemp1(10), X - AnchorX1)-(arrTemp1(12), X - AnchorX1 + arrTemp1(13) - arrTemp1(11)), , B picPlan.Line (arrTemp1(10), lastx - AnchorX1)-(arrTemp1(12), lastx - AnchorX1 + arrTemp1(13) arrTemp1(11)), , B lastx = X lasty = y ' SelI = arrTemp(1) SelI = arrTemp1(1) End If End If End Sub Private Sub picSide_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single) Dim i As Integer, j As Integer, temp As Long Dim dimensionA As Long, dimensionB As Long MousePointer = Default ''''''''''''''''''''''

On Error GoTo errortrap If optWorkMod(0) = False And optWorkMod(1) = True Then 'And ItemSelect = True Then MousePointer = Default 'arrSG(1, SelI) = arrTemp(1) 'arrSG(2, SelI) = arrTemp(2) 'arrSG(3, SelI) = arrTemp(3) 'arrSG(4, SelI) = arrTemp(4) 'arrSG(5, SelI) = lastx - AnchorX1 'arrSG(6, SelI) = lasty - AnchorY1 'arrSG(7, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrSG(8, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) 'arrEG(9, SelI) = arrSG(7, SelI) - arrSG(5, SelI) 'arrEG(10, SelI) = arrSG(8, SelI) - arrSG(6, SelI) 'arrEG(11, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrEG(12, SelI) = lasty - AnchorY1 'arrEG(13, SelI) = lastx - AnchorX1 'arrEG(14, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) '''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrSG(15, SelI) = arrTemp(15) 'arrSG(16, SelI) = lasty - AnchorY1 'arrSG(17, SelI) = arrTemp(17) 'arrSG(18, SelI) = lasty - AnchorY1 + arrTemp(8) - arrTemp(6) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'arrSG(19, SelI) = arrTemp(19) 'arrSG(20, SelI) = lastx - AnchorX1 'arrTemp(20) 'arrSG(21, SelI) = arrTemp(21) 'arrSG(22, SelI) = lastx - AnchorX1 + arrTemp(7) - arrTemp(5) 'arrEG(23, SelI) = arrTemp(23) MousePointer = 5 '================================================================================= ===== arrS(5, SelI) = lastx - AnchorX1 ' CurrentX arrS(6, SelI) = lasty - AnchorY1 ' CurrentY arrS(7, SelI) = lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2) ' lastX arrS(8, SelI) = lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3) ' lastY arrS(9, SelI) = lastx - AnchorX1 ' LimitX arrS(10, SelI) = lasty - AnchorY1 ' LimitY arrE(5, SelI) = arrTemp1(6) 'lastx - AnchorX1 arrE(6, SelI) = lasty - AnchorY1 ' arrTemp1(16) arrE(7, SelI) = arrTemp1(6) + TBoard 'lastx - AnchorX1 + arrTemp1(7) - arrTemp1(5) arrE(8, SelI) = lasty - AnchorY1 + arrTemp1(5) - arrTemp1(3) 'arrTemp1(18) arrE(9, SelI) = arrTemp1(6) 'lastx - AnchorX1 'Limitx in x direction arrE(10, SelI) = lasty - AnchorY1 ' arrTemp1(16) 'Limitx in Y direction arrP(5, SelI) = arrTemp1(10) arrP(6, SelI) = lastx - AnchorX1 'lasty - AnchorY1 arrP(7, SelI) = arrTemp1(10) + TBoard arrP(8, SelI) = lastx - AnchorX1 + arrTemp1(4) - arrTemp1(2) 'lasty - AnchorY1 + arrTemp1(8) arrTemp1(6) arrP(9, SelI) = arrTemp1(10) 'PlanLimit arrP(10, SelI) = lastx - AnchorX1 ' ( lasty - AnchorY1 ) correction after last revision '================================================================================= ===== Erase arrTemp1() 'Erase arrTemp() End If If optWorkMod(0) = True And optWorkMod(1) = False Then

GoTo StartUpData Else: Exit Sub End If StartUpData: If lastx < CurrentX Then temp = lastx lastx = CurrentX CurrentX = temp dimensionA = lastx - CurrentX Else: dimensionA = lastx - CurrentX End If If lasty < CurrentY Then temp = lasty lasty = CurrentY CurrentY = temp dimensionB = lasty - CurrentY Else: dimensionB = lasty - CurrentY End If If MoveStat = True Then MoveStat = False lblmouss.Visible = False lblmouss.Caption = 0 & "," & 0 lblmouss.Left = 50: lblmouss.Top = 50 If Button = vbRightButton Then Exit Sub If Button = vbLeftButton Then picSide.DrawMode = 13 If Abs(lastx - CurrentX) < 3 * (TBoard) Or Abs(lasty - CurrentY) < 3 * (TBoard) Then picSide.DrawMode = 6 picSide.Line (CurrentX, CurrentY)-(lastx, lasty), , B picElev.Line (LimitX, CurrentY)-(LimitX + TBoard, lasty), , B '(SideLimit, CurrentY)-(SideLimit + TBoard, lastY), , B picPlan.Line (LimitX, CurrentX)-(LimitX + TBoard, lastx), , B '(SideLimit, CurrentX)-(SideLimit + TBoard, lastX), , B MousePointer = Default Exit Sub End If ''''''''''''''''''''************ If Abs(dimensionA) > BoardMax Or Abs(dimensionB) > BoardMax Then picSide.DrawMode = 6 picSide.Line (CurrentX, CurrentY)-(lastx, lasty), , B picElev.Line (LimitX, CurrentY)-(LimitX + TBoard, lasty), , B picPlan.Line (LimitX, LimitZ)-(LimitX + TBoard, lastx), , B MousePointer = Default MsgBox "Sorry , the dimensions are outside board dimensions", vbOK, "Invalid entry" Exit Sub End If If Abs(dimensionA) > BoardMin And Abs(dimensionB) > BoardMin Then picSide.DrawMode = 6 picSide.Line (CurrentX, CurrentY)-(lastx, lasty), , B picElev.Line (LimitX, CurrentY)-(LimitX + TBoard, lasty), , B picPlan.Line (LimitX, LimitZ)-(LimitX + TBoard, lastx), , B MousePointer = Default MsgBox "Sorry , the dimensions are outside board dimensions", vbOK, "Invalid entry" Exit Sub End If cmdFlexRep1.Enabled = True

cmdRep1.Enabled = True cmdClearAll.Enabled = True cmdShId.Enabled = True cmdCloseFile.Enabled = True MousePointer = Default ReDim Preserve arrE(1 To 11, 1 To arrEC) As Long ReDim Preserve arrP(1 To 11, 1 To arrPC) As Long ReDim Preserve arrS(1 To 11, 1 To arrSC) As Long 'ReDim Preserve arrXYZ(1 To arrxyzC) As Long ReDim Preserve arrEG(1 To 23, 1 To arrEgc) As Long ReDim Preserve arrPG(1 To 23, 1 To arrPgc) As Long ReDim Preserve arrSG(1 To 23, 1 To arrSgc) As Long ReDim Preserve arrReport1(1 To 7, 1 To Rep1Counter) As String lblRep1Counter.Caption = Rep1Counter ''''''''''''''''' lblBoundVal(2).Caption = UBound(arrS, 2) lblBoundVal(0).Caption = UBound(arrE, 2) lblBoundVal(1).Caption = UBound(arrP, 2) End If StatusBar1.Panels(3).Text = " Width : " & Abs((lastx - CurrentX) / DrawingScale) & " m.m" StatusBar1.Panels(4).Text = " Height : " & Abs((CurrentY - lasty) / DrawingScale) & " m.m" '''''''''''''''''' ItemIDCount = ItemIDCount + 1 ItemCounter = ItemCounter + 1 lblItemCount.Caption = ItemCounter ItemCounterS = ItemCounterS + 1 lblICs.Caption = ItemCounterS '''********************************************** If lastx < CurrentX Then temp = lastx lastx = CurrentX CurrentX = temp End If If lasty < CurrentY Then temp = lasty lasty = CurrentY CurrentY = temp End If x1 = CurrentX: y1 = CurrentY: x2 = lastx: y2 = lasty x3 = x2: y3 = y1: x4 = x1: y4 = y2 x1a = LimitX: y1a = y1: x2a = LimitX + TBoard: y2a = y2 x1b = LimitX: y1b = x1: x2b = LimitX + TBoard: y2b = x2 arrS(1, arrSC) = arrSC arrS(2, arrSC) = ItemIdS arrS(3, arrSC) = ItemIDCount arrS(4, arrSC) = 3 arrS(5, arrSC) = x1 arrS(6, arrSC) = y1 arrS(7, arrSC) = x2 arrS(8, arrSC) = y2 arrS(9, arrSC) = 0 'x1 arrS(10, arrSC) = 0 'y1 arrS(11, arrSC) = 3 ''''''''''''''''''''''''''''''''''''''''' arrE(1, arrEC) = arrSC

arrE(2, arrEC) = 0 arrE(3, arrEC) = 0 arrE(4, arrEC) = 1 arrE(5, arrEC) = LimitX arrE(6, arrEC) = y1 arrE(7, arrEC) = LimitX + TBoard arrE(8, arrEC) = y2 arrE(9, arrEC) = LimitX 'PlanLimit arrE(10, arrEC) = y1 arrE(11, arrEC) = 3 'ItemIDCount '''''''''''''''''''''''''''''''''''''''''''' arrP(1, arrPC) = arrSC arrP(2, arrPC) = 0 arrP(3, arrPC) = 0 arrP(4, arrPC) = 2 arrP(5, arrPC) = LimitX arrP(6, arrPC) = x1 arrP(7, arrPC) = LimitX + TBoard arrP(8, arrPC) = x2 arrP(9, arrPC) = LimitX 'PlanLimit arrP(10, arrPC) = x1 arrP(11, arrPC) = 3 'ItemIDCount '''''''''''''''''''''''''''''''''''' ''' Array of all Parent items in PicSide ,grouped with their 2 sons arrSG(1, arrSgc) = arrSgc ' Array Counter arrSG(2, arrSgc) = ItemIdS ' Parent Local ID arrSG(3, arrSgc) = ItemIDCount ' Parent General ID arrSG(4, arrSgc) = 1 ' Orientation arrSG(5, arrSgc) = x1 'corner 1x arrSG(6, arrSgc) = y1 'corner 1y arrSG(7, arrSgc) = x2 'corner 2x arrSG(8, arrSgc) = y2 'corner 2y arrSG(9, arrSgc) = x2 - x1 ' Width arrSG(10, arrSgc) = y2 - y1 ' Height arrSG(11, arrSgc) = x3 'corner 3x arrSG(12, arrSgc) = y3 'corner 3y arrSG(13, arrSgc) = x4 'corner 4x arrSG(14, arrSgc) = y4 'corner 4y arrSG(15, arrSgc) = x1a 'corner 1xa ,son in plan arrSG(16, arrSgc) = y1a 'corner 1ya arrSG(17, arrSgc) = x2a 'corner 2xa arrSG(18, arrSgc) = y2a 'corner 2ya arrSG(19, arrSgc) = x1b 'corner 1xb arrSG(20, arrSgc) = y1b 'corner 1yb arrSG(21, arrSgc) = x2b 'corner 2xb arrSG(22, arrSgc) = y2b 'corner 2yb arrSG(23, arrSgc) = ItemSelect 'Tag for selecting ,Boolean '''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Filling Report1 array : arrReport1 If OrientationI = 3 Then Orientation = "z-y,Side View" arrReport1(1, Rep1Counter) = Rep1Counter arrReport1(2, Rep1Counter) = arrS(2, arrSC) arrReport1(3, Rep1Counter) = arrS(3, arrSC) arrReport1(4, Rep1Counter) = Orientation arrReport1(5, Rep1Counter) = Int(Abs((arrS(7, arrSC) - arrS(5, arrSC))) / (DrawingScale)) '* 10) arrReport1(6, Rep1Counter) = Int(Abs((arrS(8, arrSC) - arrS(6, arrSC))) / (DrawingScale)) '* 10)

arrReport1(7, Rep1Counter) = FormatNumber(Abs(CDbl((arrS(7, arrSC) - arrS(5, arrSC)) * (arrS(8, arrSC) arrS(6, arrSC)))) / (DrawingScale * 1000) ^ 2, 2, vbTrue) 'ReportEnd: '''''''''''''''''''''''''''''''''''''' ItemIdS = ItemIdS + 1 arrEC = arrEC + 1 arrPC = arrPC + 1 arrSC = arrSC + 1 arrxyzC = arrxyzC + 1 arrEgc = arrEgc + 1 arrPgc = arrPgc + 1 arrSgc = arrSgc + 1 Rep1Counter = Rep1Counter + 1 LimitX = LimitX + Clearence 'LimitX = arrE(9, UBound(arrE)) + Clearence ' Limitx + Clearence errortrap: End Sub ''' ================================================================================= ==== Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button ' Case 4 ' Form1.FileNew End Select End Sub