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:

user created variable in post


Zoffen
 Share

Recommended Posts

hey all,

 

i've been really geeking out the past week or so and have gotten imersed in editing and tweaking posts.

so far i've figured most of it out but am stumped on something that i'm not sure is even possible in just the post alone.

 

here's what i'm trying to do:

 

I want to create a variable that i can write my own logic into the post to increment the value.

lets say i want to have a variable that i can write next to a "N" at the beginning of my subroutine and then use this same variable next to "GOTO" at the end so i can loop operaions if i want.

 

is there anyway to do this?

 

thanks a bunch!

Link to comment
Share on other sites

still can't get what i want.

 

here's what i did:

 

initialized the string for the variable(pretty sure this is what this does):

 

my_var : 0

 

counter_int # initialize variable

my_var=0

counter

my_var=my_var+1

*my_var, e$

 

 

 

I get no number output with this in my post.

what am i doing wrong?

Link to comment
Share on other sites

I have a counter in one of my posts...tcnt

here is how I set it up

 

fmt 	4   tcnt    	# operation counter per toolchange        	<<<<<<<<<<<<set it up


lsof$        	#Start of file for non-zero tool number, lathe
 	sav_cc_1013 = cc_1013$                               	# 1/17/03
 	#pbld, n$, *smetric, e$
 	tcnt = 1                                                                     	<<<<<<<<<<<<<<<start it as 1



ptcnt	#operation counter                                               	<<<<<<<<<<<<<<<this is where the output is generated
    	#if mi7$ = 0, "O", tcnt
    	if mi2$ = 0, "N", *tcnt



   	[                                                                            	<<<<<<<<<<<<<<this is in the ltlchg$ postblock
   	ptcnt, "(            	", *tcnt, "  	BEGIN )",e$
   	tcnt = tcnt + 1
   	tcntsp = 1
   	]

 

Here is what I get in the posted code

 

N1 ( 1 BEGIN )

 

 

Not sure if this is what your lookin for...hope it helps...

Link to comment
Share on other sites

When declaring numeric variables you have have ": #" to do so

I always use spaces between operators. The following will always make my_var = 1 since it resets to 0 at the top of post block

I wasn't sure what "counter" was doing. if its a call to a post block it needs to be pcounter as postblocks must start with letter p

 

 

my_var : 0
counter_int : 0 # initialize variable

p_some_post_block
  my_var = 0
  #counter    ----not sure what this is
  my_var = my_var + 1
  *my_var, e$

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...