Hello Guest it is April 30, 2024, 02:06:52 AM

Author Topic: Wizard For Profiling Circle, With Lead-In Arc Function  (Read 3525 times)

0 Members and 1 Guest are viewing this topic.

Wizard For Profiling Circle, With Lead-In Arc Function
« on: April 04, 2007, 12:44:28 PM »
Hi everyone, i'm facing this problem now,this is my 1st time writing a wizard and I've no idea what i'm lacking of. Don't know where to trace the mistake, as it really makes me confusing. This VB wizard does the profiling of a circle, with a arc lead-in function, for a plasma cutting system. I've done the lead-in, and plan to do the lead-out after i've solved this problem. Can someone help me out?

there are 3 inputs, a lead in arc radius, the circle diameter, and a kerf nozzle width.

Dim LeadInArcRad, XLeadInCenter, YLeadInCenter, StartArcAngle, IncArcAngle, EndArcAngle, CircleDiameter, XStartPoint, YStartPoint, XCircleCenter, YCircleCenter, CircleRad, KerfNoz, KerfTool, KerfExtraCompensation

DoOEM Button (169)
PI = 3.1415926535898

Rem Lead-In Arc Circle 90 Degree Variable Radius
LeadInArcRad = Abs(GetOEMDRO (1050))
XLeadInCenter = -1 * (LeadInArcRad + KerfTool + KerfExtraCompensation)
YLeadInCenter = CircleRad
StartArcAngle = (PI / 180) * 0
IncArcAngle = (PI / 180) * 90
EndArcAngle = StartArcAngle + IncArcAngle

Rem Circle 360 Degree Variable Diameter
CircleDiameter=GetOEMDRO (1051)
XStartPoint = -1 * (KerfTool + KerfExtraCompensation)
YStartPoint = CircleRad
XCircleCentre = LeadInArcRad + KerfTool + KerfExtraCompensation
YCircleCentre = 0
CircleRad = CircleDiameter / 2

Rem Nozzle Kerf Compensation
KerfNoz=GetOEMDRO (1052)
KerfTool= KerfNoz / 2
KerfExtraCompensation= 0.05

If LeadInArcRad = 0 Then
setTicker 20, "How big do you want the lead-in radius arc to be?"
Exit Sub
End If

If CircleDiameter = 0 Then
setTicker 20, "I think you have forgotten to fill in the Circle Diameter!"
Exit Sub
End If

If KerfNoz = 0 Then
setTicker 20, "Hmm, what's the kerf nozzle width?"
Exit Sub
End If

Rem ******************End of If Here And If  There******************

StartX =  Round ((LeadInArcRad + KerfTool)*(Cos (StartArcAngle)) , 4)
StartY =  Round ((LeadInArcRad + KerfTool)*(Sin (StartArcAngle)) , 4)
EndX =  Round ((LeadInArcRad + KerfTool)*(Cos (EndArcAngle)) , 4)
EndY =  Round ((LeadInArcRad + KerfTool)*(Sin (EndArcAngle)) , 4)
If IncArcAngle > 0 Then
 G2_3 = "G3"
Else
 G2_3 = "G2"
End If

If GetIJMode() Then
ArcLeadInXCenterPOS= XLeadInCenter - (XLeadInCenter + StartX)
ArcLeadInYCenterPOS = YLeadInCenter - (YLeadInCenter + StartY)
Else
ArcLeadInXCenterPOS= XLeadInCenter
ArcLeadInYCenterPOS = YLeadInCenter
End If


OpenTeachFile "CutArc.tap"

If GetUserLED(1003) Then
Code "G20 (Inch)"
Else
Code "G21 (mm)"
End If
Code " G53 G90 G40 F3000 M04 "
Code " F25 "

Nc = 1

Counter = 1
Do
     
     CODE "M03"
     CODE " X" & XLeadInCenter + StartX & " Y" & YLeadInCenter + StartY
     CODE g2_3 & " X" & XLeadInCenter + EndX & " Y" & YLeadInCenter + EndY & " I" & ArcLeadInXCenterPOS  & " J" & ArcLeadInYCenterPOS
     CODE g2_3 & " X" & XStartPoint & " Y" & YStartPoint & " I" & XCircleCenter  & " J" & YCircleCenter
          Nc=Nc+1

Code "M05"
Code "G00 Z20"
Code "G00 X0.0000 Y0.0000"
Code "M30"

CloseTeachFile
Call LoadTeachFile()


Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Wizard For Profiling Circle, With Lead-In Arc Function
« Reply #1 on: April 04, 2007, 07:32:11 PM »
There is an errror in your code, see 3rd and 4th line down (copy of your code 1st then the correction below):

CODE "M03"
CODE " X" & XLeadInCenter + StartX & " Y" & YLeadInCenter + StartY
CODE g2_3 & " X" & XLeadInCenter + EndX & " Y" & YLeadInCenter + EndY & " I" & ArcLeadInXCenterPOS  & " J" & ArcLeadInYCenterPOS
CODE g2_3 & " X" & XStartPoint & " Y" & YStartPoint & " I" & XCircleCenter  & " J" & YCircleCenter
Nc=Nc+1



Corrections:

CODE "g" & g2_3 & " x" & XLeadInCenter + EndX & " Y" & YLeadInCenter + EndY & " I" & ArcLeadInXCenterPOS  & " J" & ArcLeadInYCenterPOS

CODE "g" & g2_3 & " X" & XStartPoint & " Y" & YStartPoint & " I" & XCircleCenter  & " J" & YCircleCenter
Nc=Nc+1

Possible Issues:

Where you have: g2_3 & " X" & XLeadInCenter + EndX    'It might be better to replace the "XLeadInCenter + EndX" with what they are = to as a singular variable.



Unless your Circle Wizard is a "Secreat project", post it up here with, what is what, and we can try and help you better, if we can see what it is your trying to do..........

Scott
fun times