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:

Call SetLevelName not working in 2017


Recommended Posts

Has anybody had any issues with the scripting not working with the levels?

here is a script that worked fine in X9 but does not work in 2017. There are no errors generated but levels are not being created.

If askYesNo("Create a new file?") Then	LatheMill = AskString("Lathe or Mill?",LatheMill)		If InStr(UCase(LatheMill),"MILL") Then									SetLevelName 10, "Finished part"			SetLevelName 20, "Stock"			SetLevelName 30, "Fixtures"			SetLevelName 40, "Clamps"			SetLevelName 50, "Dimensions"		End If				If InStr(UCase(LatheMill),"LATHE") Then			SetLevelName 10, "Finished part"			SetLevelName 20, "Raw material- Stock"			SetLevelName 30, "Tail Stock"			SetLevelName 40, "Chuck Jaws"			SetLevelName 50, "Dimensions"		End If
Link to comment
Share on other sites

The VBScript API is no longer in active development as we encourage users to move to NET-Hooks, typically VB.NET as the syntax is very similiar to VBScript. Having said that there is a bug with the Levels Manager where it does not receive update notification when changes are made via the VBScript API even though your level names have actually been set they are just not visible.

 

I did create a simple VB.NET NET-Hook that you can call from your script to update the display, I have attached the release NET-Hook, NET-Hook source and a screen shot of the script I used to test.

 

vbs_zpshy7oi5db.png

 

 

Unzip the NET-Hook and FT file to a temp folder away from your Program Files folder, right click each file to make sure they are not blocked, then copy them both to your Mastercam chooks folder. Update you script as shown above to call into the NET-Hook and run the Level Manager refresh method.

 

Any issues just let me know.

 

 

 

EDIT:

 

The way the script knows what to call is set in the NET-Hooks FT file, the Application (needs to be unique), in this case "__LevelManagerRefresh__" and the function entry point to call (set to HIDDEN so that it does not show in customize) "RefreshLevelManager"

 

vbs2_zpsj5rxuunl.png

LevelManagerRefeshNETHook.zip

LevelManagerRefreshSource.zip

Edited by Mick from CNC Software Inc.
Link to comment
Share on other sites

You did copy both the DLL and FT to the chooks folder and edit your script to match the application name and function name? It should work.

 

Anyway, if you are looking into VB.NET NET-Hooks grab the free Visual Studio Community Edition and then the Intro doc and examples off Mastercam.

 

 

No Go - no error just nada. Level manager still does not show the levels and if I move geometry to a level it does not move either.

 

Thanks anyway Mick.

I think I'm going to force myself to move to the .net stuff. Too bad as the VBA is a real quick way for our shop to have a lot of little things automated.

Link to comment
Share on other sites

Karl,

 

Something’s going on here, as Mick’s stuff works fine for me in 2017.

 

Make sure that ->

Both the LevelManagerEx.DLL and LevelManagerEx.FT files are in the mcam2017\chooks folder,

and the “application” and "action" strings are spelled exactly as shown ->

(That’s two underscores characters on either end of the application string.)

 

Sub RefreshLevelManager

        Dim application, action

        application = "__LevelManagerRefresh__"

        action = "RefreshLevelManager"

        Call RunFTCommand(application, action)

End Sub

After I created some levels, I call RefreshLevelManager() and the levels now appear in the Level Manager.

After I did a SetEntityLevel 10, I called RefreshLevelManager() and the Entity Count in the Level Manager updated to reflect that change.

 
Link to comment
Share on other sites

I copied the FT and DLL both into the chooks folder. I was getting an error about the file being blocked but our IT took care of that.  I did NOT change anything in the FT file. Here are the sub and calling routine which run without errors:

Call RefreshLevelManager
Sub RefreshLevelManagerDim application, actionShowString("inside the refresh sub" )application = "_LevelManagerRefresh_"action = "RefreshLevelManager"Call RunFTCommand(application, action)End sub

I added the showstring just to verify that it was actually running the sub. Most likely just something small that I'm missing.

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