sheetcam.com Forum Index sheetcam.com
SheetCam discussion board
 
 Forum SubscriptionsForum Subscriptions    FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help with settings and post processor

 
Post new topic   Reply to topic    sheetcam.com Forum Index -> Problems and questions (problems @forum.sheetcam.com)
View previous topic :: View next topic  
Author Message
ChandlerW



Joined: 08 Jun 2010
Posts: 16

PostPosted: Wed Jul 28, 2010 5:06 am    Post subject: Need help with settings and post processor Reply with quote

Bottom line up front: I am getting an extra F in my .tap file. There are some other errors that I tried to highlight in bold below.
I have a Heidehain 151 controller and the post file that I downloaded for the Heidehain 150 worked great when I was generating the code with sheetcam and then putting the code in manually. I just figured out how to upload the code with my laptop to the Heidenhain controller and thats when I found out some of the generated code is wrong.

Here is a snippet of what the post processor generates:
0 BEGIN PGM 0001 INCH
1 TOOL DEF 6 L+0.000 R+0.000
2 TOOL CALL 6 Z S1000
3 L Z+1.0000 F393.661 M <---.661 creates an error. If the decimal part is removed it works.
4 L X-1.2259 Y+0.7161 F M03
5 L Z+0.0197 F M08
6 L Z-0.1250 F0.25 M <-----this creates an error too. Decimal part causes the error
7 CC X-0.9072 Y+0.5940
8 C X-1.2456 Y+0.6383 F30 DR+ R0 F M <-- The F30 is extra. The 30 should be at the 2nd "F". The first F does not belong there at all


If I can get some help with fixing this I would really appreciate it. I am not sure what part is a setting with Sheetcam and what part might be coding in the .post processor. I posted the .post below.


function OnAbout(event)
ctrl = event:GetTextCtrl()
ctrl:AppendText("Heidenhain TNC150 conversational post\n")
ctrl:AppendText("\n")
ctrl:AppendText("Uses Heidenhain TNC150 conversational code\n")
end



-- Created 10/1/2009
-- based on mach2.post

--http://cnctrain.com/_wsn/page13.html

function OnInit()
post.SetCommentChars ("()", "[]") --make sure ( and ) characters do not appear in system text
post.Text(" BEGIN PGM 0001")

if(scale == metric) then
post.Text (" MM\n") --metric mode
numFormat = "+0.000"
else
post.Text (" INCH\n") --inch mode
numFormat = "+0.0000"
end
post.Text("\n\n")
bigarcs = 1 --stitch arc segments together
minArcSize = 0.05 --arcs smaller than this are converted to moves
ms = {nil,nil}
oldFeed = -1


end

function OnNewLine()
post.Number (lineNumber, "0")
lineNumber = lineNumber + 1
end


function OnFinish()
post.Text (" STOP M02\n")
post.Text(" END PGM 0001")
if(scale == metric) then
post.Text (" MM\n") --metric mode
else
post.Text (" INCH\n") --inch mode
end
end

function OnRapid()
post.Text (" L")
post.ModalNumber (" X", endX * scale, numFormat)
post.ModalNumber (" Y", endY * scale, numFormat)
post.ModalNumber (" Z", (endZ + toolOffset) * scale, numFormat)
CheckFeed (9999)
checkM()
post.Eol()
end

function OnMove()
post.Text (" L")
post.ModalNumber (" X", endX * scale, numFormat)
post.ModalNumber (" Y", endY * scale, numFormat)
post.ModalNumber (" Z", (endZ + toolOffset) * scale, numFormat)
CheckFeed(feedRate)
checkM()
post.Eol()
end

function OnArc()
post.Text (" CC")
post.NonModalNumber(" X", arcCentreX * scale, numFormat)
post.NonModalNumber(" Y", arcCentreY * scale, numFormat)
post.Eol()
if (endZ == currentZ) then
post.Text (" C")
post.NonModalNumber (" X", endX * scale, numFormat)
post.NonModalNumber (" Y", endY * scale, numFormat)
post.ModalNumber (" Z", (endZ + toolOffset) * scale, numFormat)
CheckFeed(feedRate)
if (arcAngle <0) then
post.Text(" DR+")
else
post.Text(" DR-")
end
post.Text(" R0")
CheckFeed(feedRate)
checkM()
else
post.Text(" CP")
post.NonModalNumber(" IPA",arcAngle * 57.295779513082320876798154814105,numFormat)
if (arcAngle <0) then
post.Text(" DR+")
else
post.Text(" DR-")
end
end
post.Eol()
end

function CheckFeed(fd)
if(fd == oldFeed) then
post.Text(" F")
return
end
oldFeed = fd
post.NonModalNumber (" F", fd * scale, "0.###")
end

function checkM()
if ms[1] then
post.Text(" " .. ms[1])
ms[1] = nil
return
end
if ms[0] then
post.Text(" " .. ms[0])
ms[0] = nil
return
end
post.Text (" M")
end

function OnSpindleCW()
-- text (" M03\n")
-- modalnumber (" S", spindlespeed, "0.##")
-- eol()
ms[1] = "M03"
end

function OnSpindleCCW()
-- text (" M04")
-- modalnumber (" S", spindlespeed, "0.##")
-- eol()
ms[1] = "M04"
end

function OnSpindleOff()
-- text (" M05\n")
ms[1] = "M05"
end


function OnNewOperation()
-- text (" (Process: ", processname, ")\n")
if (plungeRate <= 0) then
post.Warning("WARNING: Plunge rate is zero")
end
if (feedRate <= 0) then
post.Warning("WARNING: Feed rate is zero")
end
end

function OnComment()
-- text(" (",commenttext,")\n")
end

function OnToolChange()
post.Text(" TOOL DEF ")
post.Number (tool, "0")
post.Text(" L+0.000 R+0.000\n")
post.Text(" TOOL CALL ")
post.Number (tool, "0")
post.Text(" Z")
post.ModalNumber (" S", spindleSpeed, "0.##")
post.Eol()
end

function OnSpindleChanged()
if (spindleSpeed <= 0) then
post.Warning("WARNING: Spindle speed is zero")
end
end

function OnNewPart()
end


function OnFloodOn()
-- text(" M08\n")
ms[0] = "M08"
end

function OnMistOn()
-- text(" M08\n")
ms[0] = "M08"
end

function OnCoolantOff()
-- text(" M09\n")
ms[0] = "M09"
end

function OnDrill()
OnRapid()
depth = drillStart
buffer = 0.5
if(drillRetract < buffer) then
buffer = drillRetract
end
while depth > drillZ do
endZ = depth + buffer
OnRapid()
depth = depth - drillPeck
if (depth < drillZ) then
depth = drillZ
end
endZ = depth
OnMove()
if (depth > drillZ) then --retract if we need to take another bite
endZ = endZ + drillRetract
if (endZ > safeZ) then
endZ = safeZ
end
OnRapid()
end
end
if (endZ < safeZ) then
endZ = safeZ
OnRapid()
end
end

function OnSetFeed()
end

function OnTapStart()
post.Text(" M49\n") --disable FRO
post.Text(" G95\n") --feed per rev
end

function OnAutoTap()
clearance = 1 --tapping clearance height

--move to hole X,Y coordinates
OnRapid()

--move to tapping clearance height
clearance = clearance + drillStart
endZ = clearance
OnRapid()

--feed to depth
feedRate = tapPitch * underFeed
OnSetFeed()
endZ = drillZ
OnMove()

--retract to engage reverse clutch
endZ = drillZ + tapTravel
feedRate = 10000
OnMove()

--feed out
feedRate = tapPitch * reverseMult * underFeed
endZ = tapTravel + clearance
OnMove()

--retract to clearance plane
endZ = safeZ
OnRapid()

end

function OnRigidTap()
clearance = 1 --tapping clearance height

spindlecache = spindleSpeed

--spindle forwards
if(spindleDir == 1) then
OnSpindleCW()
else
OnSpindleCCW()
end


--move to hole X,Y coordinates
OnRapid()

--move to tapping clearance height
endZ = clearance + drillStart
OnRapid()

--tap to depth, correcting for underfeed
feedRate = tapPitch * underFeed
OnSetFeed()
depthfix = (drillStart - drillZ) * (1 - underFeed)
endZ = drillZ + depthfix
OnMove()

--reverse spindle
OnSpindleOff()
spindleSpeed = spindlecache * reverseMult
if(spindleDir == -1) then
OnSpindleCW()
else
OnSpindleCCW()
end

--feed out
feedRate = tapPitch * reverseMult * underFeed
OnSetFeed()
endZ = clearance + drillStart
OnMove()

--stop spindle and restore speed to tapping speed
OnSpindleOff()
spindleSpeed = spindlecache


--retract to clearance plane
endZ = safeZ
OnRapid() --retract to clearance plane

end


function OnTapEnd()
post.Text(" M48\n") --enable FRO
post.Text(" G94\n") --feed per min
end

[/b]
Back to top
View user's profile Send private message
Les Newell
Site Admin


Joined: 11 May 2006
Posts: 391

PostPosted: Wed Jul 28, 2010 11:06 am    Post subject: Reply with quote

Try this version. It should fix the problems. Feed rates are now always rounded up. If this results in a feed rate of 0, it is set to 1 instead.


Heidenhain TNC150 conversational.scpost
 Description:

Download
 Filename:  Heidenhain TNC150 conversational.scpost
 Filesize:  6.71 KB
 Downloaded:  10 Time(s)

Back to top
View user's profile Send private message
ChandlerW



Joined: 08 Jun 2010
Posts: 16

PostPosted: Wed Jul 28, 2010 2:20 pm    Post subject: Reply with quote

Great support! It works as described.
There is only one little thing and its the decimal point after the feedrate.

3 L Z+1.0000 F393.661 M <---.661 creates an error. If the decimal part is removed it works

I ran the new post processor and still get the above problem with the z movement. Is it a calculation?
Back to top
View user's profile Send private message
ChandlerW



Joined: 08 Jun 2010
Posts: 16

PostPosted: Wed Jul 28, 2010 2:25 pm    Post subject: Reply with quote

I changed this:
function CheckFeed(fd)
if(fd == oldFeed) then
post.Text(" F")
return
end
oldFeed = fd
fd = math.toint(fd + 0.5)
if(fd == 0) then
fd = 1
end
post.NonModalNumber (" F", fd * scale, "0.###") <---offending format?
end

to this:

function CheckFeed(fd)
if(fd == oldFeed) then
post.Text(" F")
return
end
oldFeed = fd
fd = math.toint(fd + 0.5)
if(fd == 0) then
fd = 1
end
post.NonModalNumber (" F", fd * scale, "0") <---removed ###
end

It worked but is it the right solution? Or do you think it will break something else?
Back to top
View user's profile Send private message
Les Newell
Site Admin


Joined: 11 May 2006
Posts: 391

PostPosted: Wed Jul 28, 2010 3:17 pm    Post subject: Reply with quote

That will work but you should not have had to change it. I'll see if I can find out why you were getting fractions.
Back to top
View user's profile Send private message
Les Newell
Site Admin


Joined: 11 May 2006
Posts: 391

PostPosted: Thu Jul 29, 2010 12:51 pm    Post subject: Reply with quote

I found the problem. Here is the fixed post.


Heidenhain TNC150 conversational.scpost
 Description:

Download
 Filename:  Heidenhain TNC150 conversational.scpost
 Filesize:  6.71 KB
 Downloaded:  15 Time(s)

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    sheetcam.com Forum Index -> Problems and questions (problems @forum.sheetcam.com) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group