Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Misc int in .pst


CNC PRO
 Share

Recommended Posts

Hi all,

I am trying to use misc.int4 to output hood height adjustment to my router, however I can't get the second variable working.

 

This is what I did:

hood_adj : 0 #

fmt "E=" 4 hood_adj #

auto_hood : 0 #

fmt "TLLEN" 4 auto_hood #

'

'

'

'

if mi4$ = 1, hood_adj = auto_hood

if mi4$ > 1, hood_adj = mi4$

 

This only outputs the >1 command, and outputs nothing when mi4 is set to 1. banghead.gif

Can someone please point out what I am doing wrong here.

 

I would appreciate the help.

Link to comment
Share on other sites

Sorry I didn't get back here sooner, got side tracked with a spindle problem on one of my machine's.

 

Tony, that will only output a 2, the first variable didnt output at all.

 

Andre, I did tried that but the first variable only outputs E=0, not quite there yet headscratch.gif (I would like for the hood command to only show if I have a number in mi4 field)

 

Thanks for the suggestions so far.

 

Would there be another way to do this confused.gif

Link to comment
Share on other sites

"Would there be a better way to do this?"

 

Perhaps.

 

If it were me I would use the integer MI4 to control Auto/manual mode.

 

Then I would use Miscellanous Real Number 4 to control the output of your specific number.

 

So what do you want to happen in the end?

 

You've given us the logic blocks you are implementing for setting variables, but not the blocks that output to the NC file.

 

From what you've described, a "1" in the mi4$ field SHOULD give you "E=0" output. That is what you've told it to do.

 

My guess is that you are using your 'hood_adj' variable for output, something like:

 

n$, hood_adj, e$

 

This would output a line number, "E=0", then the end of block character.

 

You can use logic directly in the output line to control the output of a single output parameter if you wish. Or, you could create a logic branch that would skip an entire line of output if you wish.

 

Single parameter example:

if mi4$ > 1, hood_adj = mi4$

n$, [if mi4 > 1, hood_adj], t$, "M06", e$

 

This would output (theoretical example only):

 

N100 T2 M06 (when mi4$ is 1)

N100 E=8 T2 M06 (when mi4$ is 8)

 

 

To skip an entire output line:

 

if mi4$ > 1,

[

n$, pfxout, pfyout, "M12", hood_adj, e$

]

 

This line would only be output if mi4$ is greater than 1.

 

It would help a lot if you told us exactly what you are trying to accomplish. I know you want to control the height of the dust shield, but what do you want to output with "TLLEN" as the prefix?

 

HTH,

Link to comment
Share on other sites

You are right Colin, I did give you a lack of info.

 

"E" is the hood command, "TLLEN" sets it to auto adjustment(machine adjusts the dust shield according to tool length and depth of cut without input by the operator)

Or I can set "E" to a specified height, example: E=100 will set the hood to 100mm)

 

What I was trying to do was if mi4 was set to 1, the post would output:

XG0 X=21.6313 Y=28.7223 Z=-.76 E=TLLEN V=2540 S=18000 T=101 D=.5

 

Or if I wanted to run the hood at one height, I would enter any measurement greater then 1, to get E=100 or whatever.

 

Right now I get the specified height output, but I can't get it to output the "TLLEN" note.

When I set mi4 at 1...you are right Colin, all I get is E=0.

 

I hope I have explained it better.

Link to comment
Share on other sites

After a lot of trial and errors, I finally have it working the I want...except one thing;

 

Here is what I did:

fmt "E=TLLEN" 4 auto_hood

hood_adj : 0 #

fmt "E=" 4 hood_adj

'

'

n$, "XG0", pfxout, pfyout, pfzout, [if mi4$ = 2, *hood_adj | if mi4$ = 1, *auto_hood] , *feed, *speed, *t$, *zclear, strcantext, e$

'

'

pmiscint$ #Capture the top level absinc for subprograms

 

if mi4$ = 1, auto_hood = auto_hood

if mi4$ = 2, hood_adj = mr4$

 

Here are both examples of output code:

 

;TOOL#104 - .5 - RADIUS MILL - 1/2" ROUNDOVER

C=0

F=1

XG0 X=-2.7946 Y=-.5843 Z=0 E=300 V=2540 S=18000 T=104 D=.5

XL2P X=2.3373 Y=1.0237 V=15

;TOOL#109 - .25 - STRAIGHT - 1/4"ENDMILL

C=2

F=1

XG0 X=2.4121 Y=0 Z=-.7852 E=TLLEN0 V=2540 T=109

XL2P X=-2.7198 Z=.8229 V=20

XN X=0

 

The problem is that it sticks a zero at the end of "E=TLLEN", any ides's on how to get rid of the zero...I am a little worried that this might not be possible (as my thinking is that it has something to do with the declaration statement), if not possible I would have to go thru the posted program and delete them banghead.gif

 

Thanks in advance smile.gif

 

BTW, Thank you Colin for your post, I used a couple of your Ideas to make this work...as you can tell I now use misc real4, for my specified height smile.gif

Link to comment
Share on other sites

Thank you Paul, you've made my weekend...that worked great smile.gif

Only thing is I don't want "E=0" posted when no value is entered in mi4, so I changed it to this:

 

hood_adj = mr4$

n$, "G03D", pfxout, pfyout, pfzout, [if mi4$ = 1, "E=TLLEN" | if mi4$ = 2, *hood_adj], *cg80, *ag80, *feed, *speed, *t$, strcantext, e$[/b]

Now "E" doesn't post at all when mi4 is left at 0...perfect! biggrin.gif

 

 

I am slowly learning smile.gif

cheers.gif

Link to comment
Share on other sites

If you don't want 0 to output anything, I would go with:

 

code:

hood_adj : 0 #Hood Adjustment Value

fmt "E=" 4 hood_adj

Then in the psof$ and ptlchg$ postblocks:

 

code:

     hood_adj = mi4$

n$, "XG0", pfxout, pfyout, pfzout, [if hood_adj = 1, "E=TLLEN"], [if hood_adj > 1, *hood_adj], *feed, *speed, *t$, *zclear, strcantext, e$

No need to use an additional misc real value. With the above, mi4$ = 0 results in nothing being output, mi4$ = 1 results in E=TLLEN being output and mi4$ > 1 results in E=whatever value was entered in mi4$.

Link to comment
Share on other sites

By the way, the use of the user defined variable as I have it above is really just optional. You could do the same thing by simply formatting mi4$ for output which would reduce this to 2 lines:

 

fmt "E=" 4 mi4$ #Programmed Hood Height

 

and then

 

n$, "XG0", pfxout, pfyout, pfzout, [if mi4$ = 1, "E=TLLEN"], [if mi4$ > 1, *mi4$], *feed, *speed, *t$, *zclear, strcantext, e$

 

I tend to load the values into user defined variables by habit as this allows you to get back to the raw value if you ever needed it but in this case, the above would likely be just fine.

 

Hope this helps smile.gif

Link to comment
Share on other sites

I would like to thank all who participated in this thread. This information is invaluable. Post guides are not very or extensive enough for non-gurus.

 

I sincerely take my hat to you all.

 

Thank you

 

John

 

 

==================

Link to comment
Share on other sites

Sometimes, writing out the post line like this can make for a cumbersome logic and also not permit to re-use the info in some other location in the post.

 

I would prefer to create a new post block alltogether and call it up on the outputted post line ... something like this:

 

phood #Hood Adjustement Height

if mi4$ = 1, "E=TLLEN" #Auto height adjustement

if mi4$ > 1, *mi4$ #Custom height

 

And access this information in the posted line as Paul had it before:

 

n$, "XG0", pfxout, pfyout, pfzout, phood, *feed, *speed, *t$, *zclear, strcantext, e$

 

It makes it much easier to read, easier to re-use the "phood" post block somewhere else and also isolates the programming logic in one area.

 

Also, if needed, easier to copy from 1 post to another.

 

This also allows commenting the new post block for futur reference (we do forget things years down the road!)

 

Hope this helps!

Link to comment
Share on other sites

Thank you very much Luc, although I ended up changing your code to this:

 

fmt "E=" 4 hood_adj ---------------< added this

'

phood #Hood Adjustement Height

hood_adj = mi4$ -------------< added this

if hood_adj = 1, "E=TLLEN" #Auto height adjustement

if hood_adj > 1, *hood_adj #Custom height

 

Reason being, doing it like you have it shown won't output "E=", and for some reason it added "mi4$" and the number I had in the mi4 field.

The way I have it shown above works exactly the way I wanted it too, so Thank you and...

quote:

I would like to thank all who participated in this thread.

cheers.gif

Link to comment
Share on other sites

quote:

...and for some reason it added "mi4$" and the number I had in the mi4 field.

If do not have a fmt assigned to a variable that is output...

This is (an always has been) "standard" behavior.

MP defaults to using 'fmt 1' with no assigned prefix text.

(What is meant by "prefix text" -> fmt "E=" 4 hood_adj)

And since there is no prefix text the 'name' of the variable is output for the prefix, which in this case is -> mi4$.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...