Mach Discussion => VB and the development of wizards => Topic started by: birillo1959 on July 08, 2022, 07:39:16 AM
Title: scan problem
Post by: birillo1959 on July 08, 2022, 07:39:16 AM
Good morning since I have no expertise on this, I ask if anyone can help me. my problem is this I run a scan and it generates a text file: 2.0467858519169e-009,4.7808654812798e-009,-9.2617585402426 15.000320522173,4.7808654812798e-009,-8.3624861271786 30.000641042299,4.7808654812798e-009,-7.4582315954826 45.000961562425,4.7808654812798e-009,-6.6112714280539 60.001282082551,4.7808654812798e-009,-5.853989396 75.001602602676,4.7808654812798e-009,-5.1664570247932 90.001923122802,4.7808654812798e-009,-4.65578986502 105.00224364293,4.7808654812798e-009,-4.3468985098401 120.00256416305,4.7808654812798e-009,-4.3419163912082 135.00288468318,4.7808654812798e-009,-4.6159329159645 150.00320520331,4.7808654812798e-009,-5.0867431266823 165.00352572343,4.7808654812798e-009,-5.7269453708857 180.00384624356,4.7808654812798e-009,-6.4692810470438 195.00416676368,4.7808654812798e-009,-7.2539647315734 210.00448728381,4.7808654812798e-009,-8.1183623142138 2.0467858519169e-009,14.998415467348,-9.3290171417737 15.000320522173,14.998415467348,-8.4172894321298 30.000641042299,14.998415467348,-7.5329633749616 45.000961562425,14.998415467348,-6.6536194364254 60.001282082551,14.998415467348,-5.8963374043715 75.001602602676,14.998415467348,-5.2137871517966 90.001923122802,14.998415467348,-4.7031199920234 105.00224364293,14.998415467348,-4.431594526583 120.00256416305,14.998415467348,-4.4166481706872 135.00288468318,14.998415467348,-4.6632630429679 150.00320520331,14.998415467348,-5.1241090164218 165.00352572343,14.998415467348,-5.7493649047294 180.00384624356,14.998415467348,-6.4917005808875 195.00416676368,14.998415467348,-7.2863485026809 210.00448728381,14.998415467348,-8.1681835005332 2.0467858519169e-009,29.996830929914,-9.3937846839888
to use the point cloud I have to remove "e-009" I don't know why it generates this, the second problem is: is it possible to reduce the numbers after the point? (15.000320522173, 29.996830929914, -8.477074855713) the macro I use is: Sub Main ()
Label0: Code "G31 Z" & Zmin & "F" & AvanzZgiu ' Avvia scansione fino a Zmin While IsMoving() ' Aspetto mentre si muove Wend
X = GetParam("XDRO") Y = GetParam("YDRO") Z = GetParam("ZDRO")
Write #1, X , Y, Z
Label1: Code "G91" Code "G1 Z" & StepZsu & "F" & AvanzZsu ' Salita Z dopo contatto tastatore While IsMoving() ' Aspetto mentre si muove Wend Code "G90" If GetOemLed (825)<>0 Then ' verifica se tastatore attivo GoTo Label1 End If Label3: Code "G91" Code "G1 X" & StepX & "F" & AvanzX While IsMoving() ' Aspetto mentre si muove Wend Code "G90"
If GetOemLed (825)<>0 Then ' verifica se tastatore attivo Code "G91" Code "G1 X-" & StepX & "F" & AvanzX While IsMoving() ' Aspetto mentre si muove Wend Code "G1 Z" & StepZsu & "F" & AvanzZsu While IsMoving() ' Aspetto mentre si muove Wend Code "G90" 'If Zdro < Zmax Then If GetVar(2002) < Zmax Then GoTo Label3 Else If GetOemLed (825)<>0 Then ' verifica se tastatore attivo MachMsg("Errore, asse Z max superato","ERRORE",0) End Else GoTo Label3 End If End If Else 'If Xdro < Xmax Then If GetVar(2000) < Xmax Then GoTo Label0 End If Code "G0 Z" & Zmax While IsMoving() ' Aspetto mentre si muove Wend Code "G0 X0" While IsMoving() ' Aspetto mentre si muove Wend Code "G91" Code "G1 Y" & StepY & "F" & AvanzY While IsMoving() ' Aspetto mentre si muove Wend Code "G90" 'If Ydro > Ymax Then If GetVar(2001) > Ymax Then End Else GoTo Label0 End If End If Close intNum End Sub
Title: Re: scan problem
Post by: TPS on July 09, 2022, 02:42:18 AM
Title: Re: scan problem
Post by: birillo1959 on July 10, 2022, 03:14:53 AM
good morning the modification " Print #1, nFmt(X,4) & "," & nFmt(Y,4) & "," & nFmt(Z,4)" works perfectly !!! thanks TPS once again for the help offered !! :)
Title: Re: scan problem
Post by: johnny4827 on June 12, 2023, 12:04:57 AM
Try removing the quotation marks. Hope it helps you to solve the problem.