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:

opcode$


ahaslam
 Share

Recommended Posts

so I am really new to this and the information I have relating to posts is out of date. I am trying to put information about the operation being preformed into the program such as "(contour)" and found a value called opcode, the only problem that I have found is that when I try to out put opcode for Circle mill it doesn't have a number. I just get "( )" and there isn't much I can do with that. Can some one tell me what I am missing here.

 

 

Link to comment
Share on other sites
  • 2 weeks later...

okay, progress has been made. Now my issue is that it puts out (example) opcode every time the tool moves in z. Hard to explain, let me show you.

O4309 ( BA4309A )
G0 G90 G59 X0 Y0 
T1 M6
(  Facing  )
S6000 M3
G0 G54 X-5.9 Y4.3249
G43 H1 Z.25 T2 M8
Z.2
G1 Z0. F40.0
X5.9
G0 Z.25
X-5.9 Y3.2437
(  Facing  )
Z.2
G1 Z0.
X5.9
G0 Z.25
X-5.9 Y2.1625
(  Facing  )
Z.2

That is because I put it in my null tool change line. Now I just need to add some logic that says if tool_op is equal to the last tool_op then don't output tool op. I am so very new to this and only have a basic understanding of code but, think you're willing to give me this one?

Link to comment
Share on other sites
if op_id$ <> prv_op_id$,
  [
  if tool_op$ = 18, "(CIRCLE_MILL-OP)", e$
  ]

Try adding some code to test 'op_id$', as that is a more reliable way to do what you are after. The 'Tool Op' value can be the same, from Operation to Operation, but 'op_id$' is a unique value for each specific tool path being processed. The 'op_id$' does not have to be in numeric order though, it only has to be a "unique" value. (This is because you can re-order ops, and you can also select ops independently (while leaving some "unselected") when you post.

Link to comment
Share on other sites

Try adding some code to test 'op_id$', as that is a more reliable way to do what you are after. The 'Tool Op' value can be the same, from Operation to Operation, but 'op_id$' is a unique value for each specific tool path being processed. The 'op_id$' does not have to be in numeric order though, it only has to be a "unique" value. (This is because you can re-order ops, and you can also select ops independently (while leaving some "unselected") when you post
 
First off, thanks for working with me on this. I think I understand what you are saying, using op id would let me identify each operation as a unique output. All that I am looking for in a way to tell the operators what tool path I am using. if it contours three time, each a different operation then that's okay, it's still just a contour. I could add both so it says (op1 contour) (op 2 contour). Is that how op id works?

Link to comment
Share on other sites
  • 1 year later...
On 9/11/2015 at 6:54 AM, Colin Gilchrist said:

Try 'tool_op$' instead. I think '18' is the 'tool_op$' for Circle Mill...

Hi Colin,
   is there away I can get a list of CONTOUR, POCKET, DRILL as OP_ID$ values so I can call them out by OP_ID$?

 

Thank you Colin.

Link to comment
Share on other sites

Steven,

The variable 'op_id$' has nothing to do with the operation type. It is simply a "tracking" variable that is used to determine "am I still processing the same operation, or is this a new operation. The 'op_id$' variables are assigned an integer value, as you create them. They are not necessarily in "sequential order", so you can't rely on them for that.

There are two variables for determining "what type" of Operation is being processed:

opcode$

tool_op$

The 'opcode$' variable is more general. It has values from 1 through 19, to list the "basic" type of operation.

The 'tool_op$' variable is more specific. It lists the actual "operation type", as listed in the Operations Manager. The 'tool_op$' variable has probably 100+ values, and each lists the specific type of operation you've used.

These codes are listed in the Post Documentation, which is available from your Reseller.

Link to comment
Share on other sites
21 hours ago, Colin Gilchrist said:

The 'tool_op$' variable has probably 100+ values, and each lists the specific type of operation you've used.

 

Because of this, I think CNC Software should think about a new string variable for MP. For example: sopdescr$.

For this kind of information I need to make calls to my own dll. I would like to get rid of this.

#-------------------------
# calls to gm.dll
#-------------------------
rvar:0
sDLL:""
sArgs:""
spost_arg_0$:""
spost_arg_1$:""
spost_arg_2$:""

# sArgs[0] = 1 = op_make_description(...)
# sArgs[1] = op_id
poptype
    sDLL=spathpst$ + "gm.dll"
    rvar=fexist(sDLL)
    if rvar,
		[
		  sArgs = '"1" "' + no2str(op_id$) + ' ""'
		  rvar=dll(sDLL, sArgs)
		  if rvar, soptype = spost_arg_0$		#operation description
		]
		else,
		[

 

OpDescription.PNG

  • Like 1
Link to comment
Share on other sites

Gunther,

I agree wholeheartedly with having a string variable that would contain the actual Operation name as a string. It's still impressive that you've written your own DLL to extract them from Mastercam. Writing C-Hooks is a skill I've always wanted to learn. Did you use the Mastercam SDK to write your function library, or did you code it in Assembly? Got any advice for me on coding languages to learn? I have been trying to decide between C++ and C#.

Thanks,

Colin

  • Like 1
Link to comment
Share on other sites
On 4/15/2017 at 1:51 PM, Colin Gilchrist said:

Gunther,

I agree wholeheartedly with having a string variable that would contain the actual Operation name as a string. It's still impressive that you've written your own DLL to extract them from Mastercam. Writing C-Hooks is a skill I've always wanted to learn. Did you use the Mastercam SDK to write your function library, or did you code it in Assembly? Got any advice for me on coding languages to learn? I have been trying to decide between C++ and C#.

Thanks,

Colin

Hi Colin,
   I would like to learn how to create C-HOOKs, do you have time to teach me in private lessons?  My needs is to create a c-hook that detects the Z-DEPTH is deeper than the TOOL STICK OUT.  

 

 

Thank you for your outstanding knowledge that you've tought me over the pass years.

Link to comment
Share on other sites
On 15.4.2017 at 10:51 PM, Colin Gilchrist said:

Gunther,

I agree wholeheartedly with having a string variable that would contain the actual Operation name as a string. It's still impressive that you've written your own DLL to extract them from Mastercam. Writing C-Hooks is a skill I've always wanted to learn. Did you use the Mastercam SDK to write your function library, or did you code it in Assembly? Got any advice for me on coding languages to learn? I have been trying to decide between C++ and C#.

Thanks,

Colin

Yes, I use Mastercams SDK.

With C++ you will probably get the best access to Mastercams API, but it might be a little bit harder to lern.

C# or VB might be easier to start with, but the API is limited as far as I know.

  • Like 1
Link to comment
Share on other sites

Something to note. You can use the C#/VB SDK in Visual Studio 2015 all for free. If you want access to the C++ SDK, you will need to have the paid version of Visual Studio.

In order to develop your own C-Hook for Mastercam X9 or Mastercam 2017 you will need Microsoft Visual Studio 2013 Professional or higher using the 'v120' Platform Toolset. The free edition of Microsoft Visual Studio 2013 Community Edition will also work just fine. If you are targeting Mastercam X8 you will need Microsoft Visual Studio Professional 2012 or higher using the 'v110' Platform Toolset. Note: You cannot use the free Express versions of Visual Studio as they do not have the required MFC support.

  • Like 1
Link to comment
Share on other sites

Here is a list of Tool_Op$ that I know...


 

pTool_Op 
           #0 = NOT USED
           #1 = NOT USED
           #2 = Contour 
           #3 = Drill 
           #4 = Pocket 
           #5 = Ruled 
           #6 = 2D swept 
           #7 = 3D swept 
           #8 = Revolution 
           #9 = Loft 
           #10 = Coons 
           #11 = NOT USED
		   #12 = NOT USED
           #13 = Surface finish 
           #14 = Surface rough 
           #15 = Face 
           #16 = Drill 5-axis 
           #17 = Curve 5-axis 
           #18 = Swarf 5-axis 
           #19 = Point 
           #20 = 5-axis multi-surface 
           #21 = 5-axis slice 
           #22 = 5-axis port 
           #23 = 5-axis circle 
		   #24 = NOT USED
           #25 = Probe 

           #101 = Lathe rough 
           #102 = Lathe finish 
           #103 = Groove 
           #104 = Thread 
           #105 = Lathe roughing 
           #106 = Lathe point 
           #107 = Stock transfer 
           #108 = Stock flip 
           #109 = Bar feed 
           #110 = Chuck clamp/unclamp 
           #111 = Tailstock position 
           #112 = Steady rest position 
           #113 = Custom operation with lathe tool 
           #114 = Turret park (values2xxareWireoperations) 
           #201 = 2D contour (no skim cuts, just single rough) 
           #202 = 3D contour 
           #203 = Canned (drill) 
           #204 = No core (pocket) 
           #205 = 4-axis taper, no skim 
           #206 = 2D reverse skim cut 
           #207 = Not used 
           #208 = 4-axis direct, reverse skim cuts 
           #209 = 4-axis direct, no skim cuts 
           #210 = 4-axis taper, reverse skim cuts 
           #211 = 4-axis taper, one-way skim cuts 
           #212 = 4-axis direct, one-way skim cuts 
           #213 = 2D one-way skim cuts 
           #214 = Point operation (always rapid) 
           #215 = 2-axis, one-way Agie collar skim cut
  • Like 2
Link to comment
Share on other sites
On 4/21/2017 at 0:25 AM, Günther Massimo - GMCCS said:

I'm using Visual Studio Community. It's free.;)

I stand corrected. This is what I read that confused me on this.

mastercam-chook-introduction.pdf

"In order to develop your own C-Hook for Mastercam X9 or Mastercam 2017 you will need Microsoft Visual Studio 2013 Professional or higher using the 'v120' Platform Toolset. The free edition of Microsoft Visual Studio 2013 Community Edition will also work just fine. If you are targeting Mastercam X8 you will need Microsoft Visual Studio Professional 2012 or higher using the 'v110' Platform Toolset. Note: You cannot use the free Express versions of Visual Studio as they do not have the required MFC support."   

  • Like 1
Link to comment
Share on other sites
  • 5 months later...
On 24.4.2017 at 11:13 PM, PcRobotic said:

Here is a list of Tool_Op$ that I know...


 


pTool_Op 
           #0 = NOT USED
           #1 = NOT USED
           #2 = Contour 
           #3 = Drill 
           #4 = Pocket 
           #5 = Ruled 
           #6 = 2D swept 
           #7 = 3D swept 
      
          

Hi!

In the download section at Mastercam you can download the Mastercam X5 NCI Parameter Reference.pdf and in that file it list the tool ops. I can not find any later edition than X5 of it. It maybe has migrated into other sections in the documentation or it's just the latest edition.

A late reply for this maybe, but i searched for the reference and got to this thread, learned more from this thread also, so if others looking for it they know where to look... 

Link to comment
Share on other sites

They have made some pretty massive changes to the ops list. The quick and easy method to look at a good list is to check out the mpmaster.pst from this site. They did a pretty good job of breaking it down. The changes are listed in the new pdf you can get from the reseller. The new list includes stuff for the new hsm surfacing and dynamic stuff. Glad to see this post is still relevant though. 

Cheers!

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