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:

VBS- GetNciMinZFromOperationID


Recommended Posts

I cut code to narrow it done and works fine if there is only one op but gives wrong value if more than one op.. if anyone want to gibe a try here is the script

--------------------------------------

 

' -- Start Script

Call Main()

 

 

Sub Main()

 

 

Dim intOperations, intOpCount, ToolNumber

 

 

' -- Get current files operation count

 

intOpCount = GetOperationCount(vbNullString)

 

 

' -- Iterate all operations

 

For intOperations = 1 To intOpCount

 

' -- Get our tool number

ToolNumber = GetToolNumberFromOperationID("",intOperations)

 

 

ShowString("tool# " & ToolNumber & " oper # " & intOperations & " zmin " & _

GetNciMinZFromOperationID("",intOperations))

ShowString("tool# " & ToolNumber & " oper # " & intOperations & " zmax " & _

GetNciMaxZFromOperationID("",intOperations))

 

Next

 

End Sub

Link to comment
Share on other sites

Your problem is in your FOR loop. Operations are not internally stored as 1, 2, opcount -1, opcount. They're given an ID, a database pointer (in VB? [GASP] wink.gif ), that can be anything, really. Try this DO loop instead:

 

code:

' -- Start Script

Call Main()

 

Sub Main()

Dim intOperations, intOpCount, ToolNumber

Dim nOpID ' <-- added by Bullines

 

 

' get the id of the first operation

nOpID = GetFirstOperationID("") ' <-- added by Bullines

 

Do

' get the tool number using the current operation

ToolNumber = GetToolNumberFromOperationID("", nOpID) ' <--changed by Bullines

 

ShowString("tool# " & ToolNumber & " oper # " & intOperations & " zmin " & _

GetNciMinZFromOperationID("",intOperations))

ShowString("tool# " & ToolNumber & " oper # " & intOperations & " zmax " & _

GetNciMaxZFromOperationID("",intOperations))

 

' get the next operation's id

nOpID = GetNextOperationID() ' <-- added by Bullines

Loop While(nOpID <> -1)

End Sub

You get the ID of the first operation and keep looping until you can't get a valid ID returned from the GetNextOperationID() function.

 

HTH

Link to comment
Share on other sites

First, I'm not familiar with the function and this may or may not be relevant. But the minimum Z inside a NCI file may not be the same as the min z as set in an operation. With a drill op or contour op it's probably going to be the same. With a surface operation it's possible the cutter won't go as deep (or worse yet may go deeper) as set in the operation for many reasons.

 

Bryan smile.gif

Link to comment
Share on other sites

Well the do loop gets the toolnumber fine

 

it doesn't return the zmax like before..picking up the r or initial plane

 

and the zmin kicks out a 16 place number to the negative umpteenth power smile.gif

 

the for-next got all the other info ..

tlo, tdia, tlen, op type, tool comment,op comment

 

just weirded out when there is more than one op on the zmin

 

this is from the vbs script called getjobinformation that creates the html report

that came with the vbs update..I believe smile.gif

Link to comment
Share on other sites

I can give you example ,when toolpath can be deeper than setted depth ,like surface-parallel with gap settings tangental line lenght setted to 3 mm

and even if you have depth limits ,say from 0 to -10 if in some point tangency wil have direction z- it will add 3 mm to the depth ,teh tool will go z-13 !.

This is one example ,I can give more

So better scan NCI {safer)

 

HTH

Link to comment
Share on other sites
  • 6 years later...

Has anyone figured this out? I have been searching all over and finding no answers. Sorry to dredge up an old topic, but it seems that this has been asked many times without any simple replies that answer the question.

 

I really need to simply read the 'depth' paramater of an operation from the the linking parameters section. Is there a way to do this with VBScript?

Link to comment
Share on other sites

From what I'm seeing - There doesn't appear to be an "accurate" way.

Some of the values reported for my test operations are right on, but others...

 

Are you trying to gather this info for a Setup Sheet ?

If so, use the Active Reports stuff -> much better solution.

 

No, we got a new machine and I have about 2000 files to process that need changed from bottom of stock 'zero' to top of stock 'zero'. So I would like to modify all the current depth values by the stock thickness...for instance:

 

for a 1/2" sheet:

 

current: (all absolute)

retract = .6

top of stock = .5

depth = .375

 

new: (all absolute)

retract = .1

top of stock = 0

depth = -.125

Link to comment
Share on other sites

GetNciMinZFromOperation isn't going to work for what I think you're looking to do.

 

You want to retrieve from the existing operation(s)in the file ->

1> Retract

2> Top of Stock

3> Depth

 

* Are these just Contour Ops, or...?

 

Then "adjust" them all by a certain value

then update the operation with these altered values.

 

*I don't see a way to do that using the VBScript,

as I'm not seeing anyway to retrieve these values from an operation.

 

I do think this would be possible with a NETHook (VB or C#).

Link to comment
Share on other sites

GetNciMinZFromOperation isn't going to work for what I think you're looking to do.

 

You want to retrieve from the existing operation(s)in the file ->

1> Retract

2> Top of Stock

3> Depth

 

* Are these just Contour Ops, or...?

 

Then "adjust" them all by a certain value

then update the operation with these altered values.

 

*I don't see a way to do that using the VBScript,

as I'm not seeing anyway to retrieve these values from an operation.

 

I do think this would be possible with a NETHook (VB or C#).

 

Yes, that is exactly what I would like to do... I have done some VBA programming and a little bit of VB, but am unfamiliar with C#. I could probably muddle through learning it, but I haven't found a good tutorial for the preliminary setup steps to create a nethook or chook to work with mastercam. If you know of one, that would be great.

Link to comment
Share on other sites

You actually need/want to alter all of the 'Z' axis Linking Parameters on the Contour & Drill operations.

 

For a Contour Operation this would be ->

1> Clearance (it might by enabled!)

1> Retract

2> Feed Plane

3> Top of Stock

4> Depth

 

For a Drill Operation this would be ->

1> Clearance (it might by enabled!)

2> Retract

3> Top of Stock

4> Depth

 

 

Details are needed...

 

Whenever embarking on such a project you really want to plan out the required workflow,

as coming back and changing it - again and again is a royal pain and waste of time!

The devil is in the details! :D

 

How would you need to process these MCX-5 files (are the MCX-5 files)?

All MCX-5 files in the specified folder using the same 'Z' adjustment?

Or... ?

Just some of the files in a folder with this 'Z' adjustment and others with a different 'Z" adjustment?

Are these Linking Parameters always set to Absolute in your files>

Etc, etc...

Link to comment
Share on other sites

You actually need/want to alter all of the 'Z' axis Linking Parameters on the Contour & Drill operations.

 

For a Contour Operation this would be ->

1> Clearance (it might by enabled!)

1> Retract

2> Feed Plane

3> Top of Stock

4> Depth

 

For a Drill Operation this would be ->

1> Clearance (it might by enabled!)

2> Retract

3> Top of Stock

4> Depth

 

 

Details are needed...

 

Whenever embarking on such a project you really want to plan out the required workflow,

as coming back and changing it - again and again is a royal pain and waste of time!

The devil is in the details! :D

 

How would you need to process these MCX-5 files (are the MCX-5 files)?

All MCX-5 files in the specified folder using the same 'Z' adjustment?

Or... ?

Just some of the files in a folder with this 'Z' adjustment and others with a different 'Z" adjustment?

Are these Linking Parameters always set to Absolute in your files>

Etc, etc...

 

I realize all of that, it is going from one router to another both with vaccuum table, stock size varies, tools used varies, op type varies, need to adjust Z by 'stock thickness' and set values accordingly to change from bottom of stock zero to top of stock zero. the new machine uses funky parametric gcode and lots of incremental moves and isnt happy with anything other than top of stock zero. Also have to change the xy location of the geometry since the new machine cuts in +x and -y vs the old which is -x and +y. We move the geomtery to maintain consistency because some files are a full sheet of various parts and others are just one small part. Clearance is not enabled in any of these files. I may just use vbs to iterate through the ops using editparameters and set the values manually...not as fast, but may be less hassle.

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