Sign in to follow this  
SlaveCam

How do you parse NCI line using opinfo?

Recommended Posts

A NCI file has the following lines:

1031
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
1032
3000 0 0 0 0 0 0 0 0 0

These are transform operation's custom parameters, where 3000 is the value of trans_mi1$ (or actually in case of nested transform, it is not, thus my attempt at opinfo)

The following code outputs the following string Test:3000 0 0 0 0 0 0 0 0 0

stest         : ""

pheader$         #Call before start of file
      stest = opinfo(1032, 0)
      "Test:", *stest, e$

However, I don't know how to capture the "3000" part of the NCI line; if I change the code to

test         : 0

pheader$         #Call before start of file
      test = opinfo(1032, 0)
      "Test:", *test, e$

the result is always 0 or -99999, no matter what I enter into the second and third parameter.

How Do I Use Opinfo Correctly?

Share this post


Link to post
Share on other sites

Got it:

atest         : 0.0
stest         : ""

pheader$         #Call before start of file
      stest = opinfo(1032, 0)
      atest = rparsngl(stest, 1)
      "Test:", *atest, e$

 

Share this post


Link to post
Share on other sites

Just so you are aware, this is not an ideal use for opinfo.  When you tell opinfo to query an NCI line it searches the NCI file that’s on disc.

I’m almost positive you can get the value you are looking from a traditional parameter in memory, have you done a parameter dump?

Using opinfo on an NCI line should only be done if the data isn’t available in memory.

Share this post


Link to post
Share on other sites
15 minutes ago, Zaffin_D said:

Just so you are aware, this is not an ideal use for opinfo.  When you tell opinfo to query an NCI line it searches the NCI file that’s on disc.

I’m almost positive you can get the value you are looking from a traditional parameter in memory, have you done a parameter dump?

Using opinfo on an NCI line should only be done if the data isn’t available in memory.

Hi,

This hack is due to this problem

Program numbers are not written at all to NCI for transform operations, so I have to use a transform operations's misc integer. Furthermore, trans_mi$ does not contain the "latest" mi-value in case of nested operation. If you know a better way, I am all ears 🙃

Share this post


Link to post
Share on other sites
31 minutes ago, SlaveCam said:

Hi,

This hack is due to this problem

Program numbers are not written at all to NCI for transform operations, so I have to use a transform operations's misc integer. Furthermore, trans_mi$ does not contain the "latest" mi-value in case of nested operation. If you know a better way, I am all ears 🙃

Are you sure the values aren't written to the NCI? There is a switch inside the Control Definition, that controls which parameters; Original Op or Transform or Both, that actually get written. Is that switch set to "Transform" or "Both"?

I'm honestly not sure either way, but I do know that switch exists in the CD.

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, Colin Gilchrist said:

Are you sure the values aren't written to the NCI? There is a switch inside the Control Definition, that controls which parameters; Original Op or Transform or Both, that actually get written. Is that switch set to "Transform" or "Both"?

I'm honestly not sure either way, but I do know that switch exists in the CD.

No, I'm not sure. Didn't even think about the existence of such a switch. I'm going to check it out tomorrow, thank you for this tip!

Share this post


Link to post
Share on other sites

Check on the "Files" page. This actual "Parameter Setting" (Radio Button) would be a zero-based index. Meaning "Option 1 = 0", Option 2 = 1, and Option 3 = 2.

I think you either want "Option 1" (Parameter output as "0", for the 1st option in the list), or "Option 3" (Both) [Option 3 would output as "2" for this parameter, being the 3rd item in the list.]

Technically, you won't be querying the value of the Radio Button. All you really care about is "are my Transform Operation Misc Values being written to the NCI File"?

Transform Source Parameter Settings - CD.PNG

Share this post


Link to post
Share on other sites

I did some testing and it seems no matter what's selected in the abovementioned setting, the program number of a transform operation that uses another transform operation as source does not have its program number written to NCI. So in this case program number seems to be kind of a special case.

In 4 axis work it's common that I use the same source operations for different tombstones and the fixture positions may wary as well, so there is no avoiding nested transforms, unless you love useless extra repetitive work. G54.2 would be a huge help, so maybe I'll get it one day.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 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