Sei sulla pagina 1di 28

VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX" Begin VB.

Form Form1 BackColor = &H00C0C0C0& Caption = "PlasmaCut by M. S. Roboworx" ClientHeight = 4980 ClientLeft = 3120 ClientTop = 2115 ClientWidth = 6975 ForeColor = &H00FF0000& Icon = "Form1.frx":0000 LinkTopic = "Form1" ScaleHeight = 3309.672 ScaleMode = 0 'Benutzerdefiniert ScaleWidth = 4998.91 WindowState = 2 'Maximiert Begin VB.TextBox Text5 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 3 Left = 10440 TabIndex = 46 Text = "2000" Top = 0 Width = 1215 End Begin VB.TextBox Text5 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 2 Left = 3720 TabIndex = 45 Text = "0" Top = 0 Width = 1215 End Begin VB.TextBox Text5 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 1 Left = 2400 TabIndex = 44 Text = "0" Top = 4320 Width = 1215

End Begin VB.TextBox Text5 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 0 Left = 2400 TabIndex = 43 Text = "1000" Top = 360 Width = 1215 End Begin VB.Frame Frame4 Caption = "Position [mm]" Height = 2655 Left = 3000 TabIndex = 30 Top = 4920 Width = 2415 Begin VB.TextBox Text4 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 5 Left = 960 TabIndex = 40 Text = "0" Top = 2040 Width = 1335 End Begin VB.TextBox Text4 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 4 Left = 960 TabIndex = 39 Text = "0" Top = 1680 Width = 1335 End Begin VB.TextBox Text4 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 3 Left = 960 TabIndex = 36 Text = "0" Top = 1320

Width = 1335 End Begin VB.TextBox Text4 Alignment = 1 'Rechts Enabled = 0 'False Height = 285 Index = 2 Left = 960 TabIndex = 35 Text = "0" Top = 960 Width = 1335 End Begin VB.TextBox Text4 Alignment = 1 'Rechts Height = 285 Index = 1 Left = 960 TabIndex = 32 Text = "0" Top = 600 Width = 1335 End Begin VB.TextBox Text4 Alignment = 1 'Rechts Height = 285 Index = 0 Left = 960 TabIndex = 31 Text = "0" Top = 240 Width = 1335 End Begin VB.Label Label5 Caption = "Ymax =" BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Index = 5 Left = 120 TabIndex = 42 Top = 1680 Width = 975

End Begin VB.Label Label5 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label Label5 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label Label5 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Index =

"Xmax =" = = = = = = = 375 4 120 41 960 975 "MS 12 0 400 0 0 0 Sans Serif"

'False 'False 'False

"Ymin =" = = = = = = = "MS 12 0 400 0 0 0 Sans Serif"

'False 'False 'False

255 3 120 38 2040 855

"Xmin =" = = = = = = = 255 2 "MS 12 0 400 0 0 0 Sans Serif"

'False 'False 'False

Left = TabIndex = Top = Width = End Begin VB.Label Label5 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Index = Left = TabIndex = Top = Width = End Begin VB.Label Label5 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Index = Left = TabIndex = Top = Width = End

120 37 1320 855

"Y =" = = = = = = = 255 1 240 34 600 615 "MS 12 0 700 0 0 0 Sans Serif"

'False 'False 'False

"X =" = = = = = = = 255 0 240 33 240 615 "MS 12 0 700 0 0 0 Sans Serif"

'False 'False 'False

End Begin MSComctlLib.StatusBar StatusBar1 Align = 2 'Unten ausrichten Height = 315 Left = 0 TabIndex = 29 Top = 4665 Width = 6975 _ExtentX = 12303

_ExtentY = 556 _Version = 393216 BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} NumPanels = 5 BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} Style = 5 TextSave = "9:47 PM" EndProperty BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} Style = 6 TextSave = "3/14/03" EndProperty BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} Text = "STATUS" TextSave = "STATUS" EndProperty BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} Text = "ERROR" TextSave = "ERROR" EndProperty BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} Object.Width = 10356 MinWidth = 10356 EndProperty EndProperty End Begin VB.Timer Timer3 Left = 1920 Top = 7920 End Begin VB.Timer Timer2 Left = 1320 Top = 7920 End Begin VB.Timer Timer1 Left = 720 Top = 7920 End Begin MSComCtl2.FlatScrollBar FlatScrollBar1 Height = 255 Left = 9120 TabIndex = 12 Top = 6600 Width = 1575 _ExtentX = 2778 _ExtentY = 450 _Version = 393216 Appearance = 0 Arrows = 65536 Min = 1

Max Orientation Value

= = =

100 8323073 10

End Begin VB.PictureBox Picture1 AutoRedraw = -1 'True ForeColor = &H00FF0000& Height = 4215 Left = 3720 MousePointer = 2 'Kreuz ScaleHeight = -9768.265 ScaleMode = 0 'Benutzerdefiniert ScaleTop = 10000 ScaleWidth = 20000 TabIndex = 0 Top = 360 Width = 7935 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 120 Top = 7920 _ExtentX = 847 _ExtentY = 847 _Version = 393216 FontName = "Arial" InitDir = "E:\" End Begin VB.Frame Frame1 Caption = "Schneidkopf-Bedienung" Height = 2655 Left = 240 TabIndex = 1 Top = 4920 Width = 2535 Begin VB.CommandButton Command1 Height = 615 Index = 8 Left = 240 Picture = "Form1.frx":0BC2 Style = 1 'Grafisch TabIndex = 10 Top = 1800 Width = 615 End Begin VB.CommandButton Command1 Height = 615 Index = 7 Left = 1680 Picture = "Form1.frx":1644 Style = 1 'Grafisch

TabIndex = Top = Width = End Begin VB.CommandButton Height = Index = Left = Picture = Style = TabIndex = Top = Width = End Begin VB.CommandButton Appearance = Height = Index = Left = Picture = Style = TabIndex = Top = Width = End Begin VB.CommandButton Height = Index = Left = Picture = Style = TabIndex = Top = Width = End Begin VB.CommandButton Height = Index = Left = Picture = Style = TabIndex = Top = Width = End Begin VB.CommandButton BackColor = Caption = Height = Index =

9 1800 615 Command1 615 6 1680 "Form1.frx":20C6 1 'Grafisch 8 360 615 Command1 0 '2D 615 5 240 "Form1.frx":2B48 1 'Grafisch 7 360 615 Command1 615 4 1680 "Form1.frx":35CA 1 'Grafisch 6 1080 615 Command1 615 3 240 "Form1.frx":404C 1 'Grafisch 5 1080 615 Command1 &H00E0E0E0& "Plasma AUS" 615 2

Left = MaskColor = Style = TabIndex = Top = Width = End Begin VB.CommandButton Height = Index = Left = Picture = Style = TabIndex = Top = Width = End Begin VB.CommandButton Height = Index = Left = Picture = Style = TabIndex = Top = Width = End

960 &H00FFC0C0& 1 'Grafisch 4 1080 615 Command1 615 1 960 "Form1.frx":4ACE 1 'Grafisch 3 1800 615 Command1 615 0 960 "Form1.frx":5550 1 'Grafisch 2 360 615

End Begin VB.Frame Frame2 Caption = "Parameter" Height = 2655 Left = 8880 TabIndex = 13 Top = 4920 Width = 2775 Begin VB.TextBox Text3 Enabled = 0 'False Height = 285 Left = 1920 TabIndex = 21 Text = "3" Top = 480 Width = 615 End Begin VB.TextBox Text2 Enabled = 0 'False Height = 285 Left = 1920 TabIndex = 20 Text = "50"

Top = 1080 Width = 615 End Begin VB.TextBox Text1 Enabled = 0 'False Height = 285 Left = 1920 TabIndex = 15 Text = "10" Top = 1680 Width = 615 End Begin MSComCtl2.FlatScrollBar FlatScrollBar2 Height = 255 Left = 240 TabIndex = 16 Top = 1080 Width = 1575 _ExtentX = 2778 _ExtentY = 450 _Version = 393216 Appearance = 0 Arrows = 65536 Max = 100 Orientation = 8323073 Value = 50 End Begin MSComCtl2.FlatScrollBar FlatScrollBar3 Height = 255 Left = 240 TabIndex = 17 Top = 480 Width = 1575 _ExtentX = 2778 _ExtentY = 450 _Version = 393216 Appearance = 0 Arrows = 65536 Max = 10 Orientation = 8323073 Value = 3 End Begin VB.Label Label4 Caption = "Schneidkopfabstand in mm" Height = 255 Left = 240 TabIndex = 19 Top = 240 Width = 2415 End

Begin VB.Label Label3 Caption = Height = Left = TabIndex = Top = Width = End Begin VB.Label Label2 Caption = Height = Left = TabIndex = Top = Width = End

"max. Einschaltdauer Plasma in %" 255 240 18 840 2415

"Schnittgeschwindigkeit in mm/s" 255 240 14 1440 2415

End Begin VB.Frame Frame3 Caption = "Steuerung" Height = 2655 Left = 5640 TabIndex = 22 Top = 4920 Width = 3015 Begin VB.CommandButton Command2 BackColor = &H00E0E0E0& Caption = "Referenzpunkt anfahren" Enabled = 0 'False Height = 495 Index = 5 Left = 1560 Style = 1 'Grafisch TabIndex = 28 Top = 240 Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H00E0E0E0& Caption = "Einzelschritt zurck" Enabled = 0 'False Height = 495 Index = 4 Left = 1560 Style = 1 'Grafisch TabIndex = 27 Top = 1440 Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H000000FF&

Caption = "Stop" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Index = 3 Left = 120 Style = 1 'Grafisch TabIndex = 26 Top = 840 Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H0000FFFF& Caption = "Simulation" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Index = 2 Left = 120 Style = 1 'Grafisch TabIndex = 25 Top = 1440 Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H00E0E0E0& Caption = " Einzelschritt Enabled = 0 'False Height = 495 Index = 1 Left = 1560 Style = 1 'Grafisch TabIndex = 24 Top = 840

vor"

Width = 1335 End Begin VB.CommandButton Command2 BackColor = &H0000C000& Caption = "Start" Enabled = 0 'False BeginProperty Font Name = "MS Sans Serif" Size = 12 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 495 Index = 0 Left = 120 MaskColor = &H00000000& Style = 1 'Grafisch TabIndex = 23 Top = 240 UseMaskColor = -1 'True Width = 1335 End End Begin VB.Label Label7 Caption = BeginProperty Font Name Size Charset Weight Underline Italic Strikethrough EndProperty Height = Left = TabIndex = Top = Width = End Begin VB.Label Label6 Caption = BeginProperty Font Name Size Charset Weight

"- X +" = = = = = = = "MS 18 0 700 0 0 0 375 7440 48 -120 975 Sans Serif"

'False 'False 'False

"+ Y -" = = = = "MS Sans Serif" 18 0 700

Underline Italic Strikethrough EndProperty Height = Left = TabIndex = Top = Width =

= = =

0 0 0 1335 3360 47 1920 255

'False 'False 'False

End Begin VB.Label Label1 Caption = "1000 mm" Height = 255 Index = 1 Left = 3960 TabIndex = 11 Top = 3360 Width = 735 End Begin VB.Menu mnuDatei Caption = "&Datei" Begin VB.Menu mnuNeu Caption = "&Neu" End Begin VB.Menu mnuOeffnen Caption = "&ffnen" End Begin VB.Menu mnuSpeichern Caption = "&Speichern" End Begin VB.Menu mnuSchriftart Caption = "Schriftart" End Begin VB.Menu mnuDrucken Caption = "D&rucken" End Begin VB.Menu mnus Caption = "-" End Begin VB.Menu mnuPreferences Caption = "Voreinstellungen" End Begin VB.Menu mnuss Caption = "-" End Begin VB.Menu mnuBeenden Caption = "&Beenden" End End Begin VB.Menu mnuOptionen

Caption Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End Begin VB.Menu Caption End

= "&Optionen" mnuZoom = "AutoZoom" mnuUnZoom = "UnZoom" mnuRandom = "Randompath" mnuOptimierung = "Wegoptimierung" mnuBoundingBox = "BoundingBox" mnuInside = "CheckInside" mnuPath =

"ShortestPath"

mnuSimulation = "Simulation" mnuTrueType = "Schrift einfgen (Truetype)" mnuTransform = "Transformation"

End Begin VB.Menu mnuObject Caption = "Objekt" Begin VB.Menu mnuSelectObject Caption = "Auswhlen" End Begin VB.Menu mnuMoveObject Caption = "Bewegen" End Begin VB.Menu mnuDeleteObject Caption = "Lschen" End Begin VB.Menu mnuCopyObject Caption = "Kopieren" End Begin VB.Menu mnuRototeObject Caption = "Drehen" End Begin VB.Menu mnuScaleObject

Caption = "Skalieren" End Begin VB.Menu mnuCutObject Caption = "Plasmaschneiden" End End Begin VB.Menu mnuHilfe Caption = "&Hilfe" End Begin VB.Menu mnuInfo Caption = "&Info" End End Attribute Attribute Attribute Attribute Attribute VB_Name = "Form1" VB_GlobalNameSpace = False VB_Creatable = False VB_PredeclaredId = True VB_Exposed = False

' Manuelles Bedienfeld Private Sub Command1_Click(Index As Integer) v = CInt(Form1.Text1.Text) t = 0.271 / v * 1000 '0,271mm/Schritt und v z.B. 10mm/sek Timer3.Interval = t Timer3.Enabled = True Command2(3).Enabled = True 'Stop aktiv. ' Pfeil nach oben If Index = 0 Then dx = 0 dy = 1 ' Pfeil nach unten ElseIf Index = 1 Then dx = 0 dy = -1 ' Plasma ein/ aus ElseIf Index = 2 Then dx = 0 dy = 0 If Command1(2).BackColor = &HE0E0E0 Then Command1(2).BackColor = &HFF Command1(2).Caption = "Plasma EIN" ' Plasma einschalten (signalisiert durch rote Hintergrundfarbe) Plasma = True ElseIf Command1(2).BackColor = &HFF Then Command1(2).BackColor = &HE0E0E0 Command1(2).Caption = "Plasma AUS" ' Plasma ausschalten Plasma = False

End If ' Pfeil nach ElseIf Index dx = -1 dy = 0 ' Pfeil nach ElseIf Index dx = 1 dy = 0 ' Pfeil nach ElseIf Index dx = -1 dy = 1 ' Pfeil nach ElseIf Index dx = 1 dy = 1 ' Pfeil nach ElseIf Index dx = 1 dy = -1 ' Pfeil nach ElseIf Index dx = -1 dy = -1 End If End Sub

links = 3 Then

rechts = 4 Then

links oben = 5 Then

rechts oben = 6 Then

rechts unten = 7 Then

links unten = 8 Then

' Tastenfelder erst aktivieren nach laden einer Datei!!!! Private Sub Command2_Click(Index As Integer) ' Start-Taste gedrckt (benutzt Timer2) If Index = 0 Then 'wenn Start dann Simulation deaktivieren und umgekehrt Command2(0).Enabled = False Command2(2).Enabled = False Command2(3).Enabled = True Form1.Picture1.Cls Form1.Picture1.ForeColor = &HFF0000 Timer2.Interval = 1000 'entspricht 1000ms Timer2.Enabled = True Timer1.Enabled = False Aktuelle_Linie = 0 Anzahl_Linien = j ' Einzelschritt vor ... ElseIf Index = 1 Then If Aktuelle_Linie >= 0 And Aktuelle_Linie <= Anzahl_Linien Then Form1.Text4(0).Text = Linien(Aktuelle_Linie).xa / 10 Form1.Text4(1).Text = Linien(Aktuelle_Linie).ya / 10

Form1.Picture1.ForeColor = &HFF Form1.Picture1.Line (Linien(Aktuelle_Linie).xa, Linien (Aktuelle_Linie).ya)-(Linien(Aktuelle_Linie).xe, Linien(Aktuelle_Linie).ye) Form1.Picture1.ForeColor = &HFF0000 Aktuelle_Linie = Aktuelle_Linie + 1 Else Aktuelle_Linie = 0 Form1.Text4(0).Text = "Ende" Form1.Text4(1).Text = "Ende" End If ' Simulation (benutzt Timer1) ElseIf Index = 2 Then ' Stop deakt. Command2(0).Enabled = False Command2(2).Enabled = False Command2(3).Enabled = True Form1.Picture1.Cls Form1.Picture1.ForeColor = &HFF Timer1.Interval = 100 'entspricht 100ms Timer1.Enabled = True Timer2.Enabled = False Aktuelle_Linie = 0 Anzahl_Linien = j ' Stop ElseIf Index = 3 Then Command2(0).Enabled = True Command2(2).Enabled = True Timer1.Enabled = False Timer2.Enabled = False Timer3.Enabled = False ' Einzelschritt zurck ElseIf Index = 4 Then If Aktuelle_Linie >= 0 And Aktuelle_Linie <= Anzahl_Linien Then Form1.Text4(0).Text = Linien(Aktuelle_Linie).xa / 10 Form1.Text4(1).Text = Linien(Aktuelle_Linie).ya / 10 Form1.Picture1.ForeColor = &H80000000 Form1.Picture1.Line (Linien(Aktuelle_Linie).xa, Linien (Aktuelle_Linie).ya)-(Linien(Aktuelle_Linie).xe, Linien(Aktuelle_Linie).ye) Aktuelle_Linie = Aktuelle_Linie - 1 Else Form1.Text4(0).Text = "Ende" Form1.Text4(1).Text = "Ende" Aktuelle_Linie = 0 End If ' Referenzpunkt anfahren ElseIf Index = 5 Then

Form1.Text4(0).Text = 0 Form1.Text4(1).Text = 0 End If Form1.Picture1.ForeColor = &HFF0000 End Sub

Private Sub FlatScrollBar1_Change() Form1.Text1.Text = FlatScrollBar1.Value End Sub Private Sub FlatScrollBar2_Change() Form1.Text2.Text = FlatScrollBar2.Value End Sub Private Sub FlatScrollBar3_Change() Form1.Text3.Text = FlatScrollBar3.Value End Sub Private Sub Form_Load() step_min = 2.71 'entspricht 0.271mm/Schritt StatusBar1.Panels(5).Text = "DXF oder HPGL-Datei laden!" ' hier Startposition eingeben oder auslesen xpos = 0 ypos = 0 End Sub Private Sub mnuBeenden_Click() ' Vorher Daten sichern Unload Form1 Unload Form2 Unload Form3 Unload Form4 End Sub Private Sub mnuBoundingBox_Click() Call BoundingBox End Sub Private Sub mnuCopyObject_Click() CopyFlag = True End Sub Private Sub mnuCutObject_Click() ' Objekte auswhlen um spter Methode anzuwenden (Copy, Delete, ...) ' Objektschneiden nur mglich, wenn ein Objekt selektiert Call CutObject End Sub Private Sub mnuDeleteObject_Click()

' Objekte auswhlen um spter Methode anzuwenden (Copy, Delete, ...) Call DeleteObject End Sub Private Sub mnuDrucken_Click() ' PrinterDialogfeld anzeigen CommonDialog1.ShowPrinter ' Form1.PrintForm wrde PlasmaCut-Fenster drucken End Sub Private Sub mnuHilfe_Click() ' Themenverzeichnis der ' Visual Basic-Hilfedatei anzeigen. CommonDialog1.HelpFile = "Plasma.hlp" CommonDialog1.HelpCommand = cdlHelpContents CommonDialog1.ShowHelp End Sub Private Sub mnuInfo_Click() ' Info ber Autor und Programm anzeigen ' ShowInfo !!!!! End Sub Private Sub mnuInside_Click() ' prft ob sich objekte innerhalb anderer Objekte befinden Call Inside End Sub Private Sub mnuMoveObject_Click() ' Objekte auswhlen um spter Methode anzuwenden (Copy, Delete, ...) MoveFlag = True End Sub Private Sub mnuNeu_Click() ' Zeichnung lschen Form1.Picture1.Cls ' Variable Linien noch lschen!!! Aktuelle_Linie = 0 StatusBar1.Panels(5).Text = "DXF oder HPGL-Datei laden!" End Sub Private Sub mnuOeffnen_Click() ' Zeichnung lschen Form1.Picture1.Cls ' Variable Linien noch lschen!!! Aktuelle_Linie = 0 ' CancelError ist auf True gesetzt. On Error GoTo ErrHandler ' Filter setzen. CommonDialog1.Filter = "Alle Dateien (*.*)" & _

"|*.*| AutoCAD-Dateien (*.dxf)|*.dxf|" & _ "HPGL-Dateien (*.plt)|*.plt" CommonDialog1.FilterIndex = 2 ' Dialogfeld ffnen anzeigen. CommonDialog1.ShowOpen ' *.* If CommonDialog1.FilterIndex = 1 Then ' check extension If Right(CommonDialog1.FileName, 4) = ".plt" Then HpglRead (CommonDialog1.FileName) StatusBar1.Panels(5).Text = CommonDialog1.FileName ElseIf Right(CommonDialog1.FileName, 4) = ".dxf" Then DxfRead (CommonDialog1.FileName) StatusBar1.Panels(5).Text = CommonDialog1.FileName Else StatusBar1.Panels(5).Text = "Es knnen nur DXF oder HPGLDateien geladen werden!" End If End If ' Prozedur zum ffnen der DXF-Datei aufrufen. If CommonDialog1.FilterIndex = 2 Then DxfRead (CommonDialog1.FileName) StatusBar1.Panels(5).Text = CommonDialog1.FileName End If ' Prozedur zum ffnen der HPGL-Datei If CommonDialog1.FilterIndex = 3 Then HpglRead (CommonDialog1.FileName) StatusBar1.Panels(5).Text = CommonDialog1.FileName End If ' Buttons aktivieren Command2(0).Enabled = True Command2(1).Enabled = True Command2(2).Enabled = True Command2(3).Enabled = True Command2(4).Enabled = True Call Optimierung Call BoundingBox Call Inside Call AutoZoom ' Ab jetzt steht List zur Verfgung!!! Exit Sub ErrHandler: ' Benutzer hat auf Abbrechen-Schaltflche geklickt. (alle geffnete Dateien werden geschlossen) Reset Exit Sub End Sub Private Sub mnuOptimierung_Click()

' alle Linien checken, falls Linien definiert Call Optimierung End Sub Private Sub mnuPath_Click() ' krzesten Weg berechnen vom Startpunkt aus Call ShortestPath(0, 0) End Sub Private Sub mnuPreferences_Click() Form4.Show End Sub Private Sub mnuRandom_Click() ' alle Linien vermischen, zum Testen Call Random End Sub Private Sub mnuRototeObject_Click() RotateFlag = True End Sub Private Sub mnuScaleObject_Click() ' Objekte auswhlen um spter Methode anzuwenden (Copy, Delete, ...) ScaleFlag = True End Sub Private Sub mnuSelectObject_Click() ' Objekte auswhlen um spter Methode anzuwenden (Copy, Delete, ...) SelectFlag = True End Sub Private Sub mnuSimulation_Click() Call Simulation End Sub Private Sub mnuSpeichern_Click() Dim i As Integer ' Filter setzen CommonDialog1.Filter = "Alle Dateien (*.*)|*.*|" & _ "HPGL-Dateien (*.plt)|*.plt|" & _ "AutoCAD-Dateien (*.dxf)|*.dxf|" ' Standarddialogfeld Speichern ffnen CommonDialog1.FilterIndex = 3 CommonDialog1.ShowSave ' als PLOT speichern If CommonDialog1.FilterIndex = 2 Then

' Check Filename CommonDialog1.FileName = Left(CommonDialog1.FileName, InStr (CommonDialog1.FileName, ".")) + "plt" Call List2LineArray Open CommonDialog1.FileName For Output As #2 ' Datei zur Ausgabe ffnen. 'For i = 0 To j - 1 For i = 0 To UBound(Linien) PlotCommand$ = "PU" + CStr(CInt(Linien(i).xa)) + "," + CStr (CInt(Linien(i).ya)) + ";PD" + CStr(CInt(Linien(i).xe)) + "," + CStr(CInt (Linien(i).ye)) + ";" Print #2, PlotCommand$ Next i Close #2 End If ' als DXF speichern If CommonDialog1.FilterIndex = 3 Then ' Check Filename CommonDialog1.FileName = Left(CommonDialog1.FileName, InStr (CommonDialog1.FileName, ".")) + "dxf" Call List2LineArray Open CommonDialog1.FileName For Output As #2 ' Datei zur Ausgabe ffnen. Print #2, " 0" Print #2, "SECTION" Print #2, " 2" Print #2, "ENTITIES" For i = 0 To UBound(Linien) Print #2, " 0" Print #2, "LINE" Print #2, " 8" Print #2, "0" Print #2, " 10" Print #2, CStr(Linien(i).xa) Print #2, " 20" Print #2, CStr(Linien(i).ya) Print #2, " 11" Print #2, CStr(Linien(i).xe) Print #2, " 21" Print #2, CStr(Linien(i).ye) Next i Print #2, " 0" Print #2, "ENDSEC" Print #2, " 0" Print #2, "EOF" Close #2 End If End Sub

Private Sub mnuTransform_Click() Form2.Show End Sub Private Sub mnuTrueType_Click() On Error GoTo ErrHandler ' Schriftart vorhe auswhlen -> Men SaveDir = CommonDialog1.InitDir CommonDialog1.InitDir = "C:\Windows\Fonts\" CommonDialog1.Filter = "TrueTypeFont (*.ttf)|*.ttf" CommonDialog1.Flags = &H1000& CommonDialog1.Action = 1 TTFFileName = CommonDialog1.FileName CommonDialog1.InitDir = SaveDir Form3.Show Exit Sub ErrHandler: ' Benutzer hat auf Abbrechen-Schaltflche geklickt. Exit Sub End Sub

Private Sub mnuSchriftart_Click() On Error GoTo Ente CommonDialog1.InitDir = "C:\Windows\Fonts\" CommonDialog1.Flags = cdlCFBoth CommonDialog1.CancelError = True CommonDialog1.FontName = Schriftname CommonDialog1.Action = 4 Schriftname = CommonDialog1.FontName Schriftgroesse = CInt(stdDialog1.FontSize) Exit Sub Ente: Resume Raus Raus: End Sub

Private Sub mnuUnZoom_Click() ' Zoomstandard wiederherstellen Form1.Picture1.ScaleWidth = 20000 Form1.Picture1.ScaleHeight = -10000 Form1.Picture1.ScaleTop = 10000 Form1.Picture1.ScaleLeft = 0 Text5(0).Text = "1000" Text5(1).Text = "0"

Text5(2).Text = "0" Text5(3).Text = "2000" If j <> 0 Then Form1.Picture1.Cls For ii = 0 To UBound(List) For i = 0 To UBound(List(ii).Lines) Form1.Picture1.Line (List(ii).Lines(i).xa, List(ii).Lines (i).ya)-(List(ii).Lines(i).xe, List(ii).Lines(i).ye) Next i Next ii End If End Sub Private Sub mnuZoom_Click() Call AutoZoom End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If SelectFlag Then 'Check welches Objekt ausgewhlt wurde SelectFlag = False Call ObjectSelect(x, y) ElseIf MoveFlag Or CopyFlag Or RotateFlag Or ScaleFlag Then movex = x movey = y ElseIf DeleteFlag Then Else If Button = 1 Then Form1.Text4(0).Text = x / 10 Form1.Text4(1).Text = y / 10 End If ' rechte Maustaste fr Zoom If Button = 2 Then zoomx = x zoomy = y End If End If End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) ' rechte Maustaste fr Zoom If MoveFlag Then MoveFlag = False dx = movex - x dy = movey - y Call MoveObject((dx), (dy)) ElseIf CopyFlag Then CopyFlag = False

dx = movex - x dy = movey - y Call CopyObject((dx), (dy)) ElseIf RotateFlag Then RotateFlag = False ' Drehwinkel berechnen ( wird durch Winkel alpha des Dreieck ABC bestimmt ' mit A ist das Objektzentrum; B der Maus-Down-Klick (movex...) und C der Maus-Up-Klick (x..) Call RotateObject((movex), (movey), (x), (y)) ElseIf ScaleFlag Then ScaleFlag = False ' Skalierung wird durch 3 Punkte definiert (A: Zentrum; B:Mouse-Up) Call ScaleObject((movex), (movey), (x), (y)) Else If Button = 2 Then zoomx1 = x zoomy1 = y ' Zoom darstellen If zoomx > zoomx1 Then xmax = zoomx xmin = zoomx1 Else xmax = zoomx1 xmin = zoomx End If If zoomy > zoomy1 Then ymax = zoomy ymin = zoomy1 Else ymax = zoomy1 ymin = zoomy End If ' Zoombereich begrenzen 0.01 mm If Abs(xmax - xmin) > 0.01 Or Abs(ymax - ymin) > 0.01 Then Form1.Text4(2).Text = xmax / 10 ' da sonst in 1/10mm angegeben Form1.Text4(3).Text = xmin / 10 Form1.Text4(4).Text = ymax / 10 Form1.Text4(5).Text = ymin / 10 Form1.Picture1.Cls If (xmax - xmin) > 2 * (ymax - ymin) Then Form1.Picture1.ScaleWidth = xmax - xmin Form1.Picture1.ScaleHeight = -(xmax - xmin) / 2 Else Form1.Picture1.ScaleHeight = -(ymax - ymin) Form1.Picture1.ScaleWidth = (ymax - ymin) * 2 End If Form1.Picture1.ScaleTop = ymax Form1.Picture1.ScaleLeft = xmin

Text5(0).Text = Form1.Picture1.ScaleTop / 10 Text5(1).Text = (Form1.Picture1.ScaleTop + Form1.Picture1.ScaleHeight) / 10 Text5(2).Text = Form1.Picture1.ScaleLeft / 10 Text5(3).Text = (Form1.Picture1.ScaleLeft + Form1.Picture1.ScaleWidth) / 10 For ii = 0 To UBound(List) For i = 0 To UBound(List(ii).Lines) 'Form1.Picture1.Line (Linien(i).xa, Linien(i).ya)(Linien(i).xe, Linien(i).ye) Form1.Picture1.Line (List(ii).Lines(i).xa, List (ii).Lines(i).ya)-(List(ii).Lines(i).xe, List(ii).Lines(i).ye) Next i Next ii End If End If End If End Sub

Private Sub Timer1_Timer() ' Wird zur Simulation bentigt Form1.Picture1.ForeColor = &HFF 'rot Form1.Picture1.Line (Linien(Aktuelle_Linie).xa, Linien (Aktuelle_Linie).ya)-(Linien(Aktuelle_Linie).xe, Linien(Aktuelle_Linie).ye) Form1.Text4(0).Text = Linien(Aktuelle_Linie).xa / 10 Form1.Text4(1).Text = Linien(Aktuelle_Linie).ya / 10 Aktuelle_Linie = Aktuelle_Linie + 1 If Aktuelle_Linie > Anzahl_Linien Then Timer1.Enabled = False Form1.Picture1.ForeColor = &HFF0000 'blau Command2(3).Enabled = False 'Stop deakt. End If End Sub Private Sub Timer2_Timer() ' Wird fr Start (Plasma-Schnitt) bentigt Form1.Picture1.ForeColor = &HFF0000 'blau Form1.Picture1.Line (Linien(Aktuelle_Linie).xa, Linien (Aktuelle_Linie).ya)-(Linien(Aktuelle_Linie).xe, Linien(Aktuelle_Linie).ye) Form1.Text4(0).Text = Linien(Aktuelle_Linie).xa / 10 Form1.Text4(1).Text = Linien(Aktuelle_Linie).ya / 10 ' hier Schritte an LPT ausgeben -> mit Go_to und Schritt 'Anfangspunkt anfahren (Plasma aus) v = CInt(Form1.Text1.Text) Plasma = False Call Go_to(CInt(Linien(Aktuelle_Linie).xa), CInt(Linien

(Aktuelle_Linie).ya), (v)) 'und zum Endpunkt schneiden Plasma = True Call Go_to(CInt(Linien(Aktuelle_Linie).xe), CInt(Linien (Aktuelle_Linie).ye), (v)) Aktuelle_Linie = Aktuelle_Linie + 1 If Aktuelle_Linie > Anzahl_Linien Then Timer2.Enabled = False Form1.Picture1.ForeColor = &HFF0000 'blau Command2(3).Enabled = False 'Stop deakt. End If End Sub Private Sub Timer3_Timer() v = CInt(Form1.Text1.Text) t = 0.271 / v * 1000 '0,271mm/Schritt und v z.B. 10mm/sek Timer3.Interval = t xpos = xpos + dx * step_min ypos = ypos + dy * step_min Form1.Text4(0).Text = xpos / 10 Form1.Text4(1).Text = ypos / 10 ' Endschalterabfragen (Software) If xpos < 0 Or xpos > 20000 Or ypos < 0 Or ypos > 10000 Then ' falls Endabmeesungen erreicht Plasma und XY-Tisch abschalten Timer3.Enabled = False Command1(2).BackColor = &HE0E0E0 Command1(2).Caption = "Plasma AUS" Plasma = False End If If Plasma = True Then Form1.Picture1.ForeColor = &HFF Else Form1.Picture1.ForeColor = &HFF0000 End If Form1.Picture1.Line (xpos, ypos)-(xpos + dx * step_min, ypos + dy * step_min) Call Schritt((dx), (dy), 1) ' d.h. einen Schritt in dx und dy -Richtung End Sub

Potrebbero piacerti anche