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:

GetOpGroupDataInExternalFile


Recommended Posts

I'm having a bit of trouble getting 'GetOpGroupDataInExternalFile' to run with success.

 

Using X7, and attempting to read in an X7 file which contains Operations. The function always returns FALSE.

 

dropped the following code into my Run Function:

 

	 Dim FileSpec As String = "C:\TMP\TEST.MCX-7"
	 Dim success As Boolean = False
	 Dim OpData() As ExternalOpsFileData = Nothing
	 Dim GroupData() As ExternalGroupsFileData = Nothing
	 success = SearchManager.GetOpGroupDataInExternalFile(FileSpec, GroupData, OpData)

 

Any idea what I'm doing wrong ?

Link to comment
Share on other sites

Maybe the path to your file should be:

"C:\\TMP\\TEST.MCX-7"

 

or maybe:

Dim FileSpec As String = @"C:\TMP\TEST.MCX-7"

 

regards.

 

The double backslashes had no effect; Function still returns False, both arrays are still Nothing.

Vb.net wouldn't even allow the second variation. :(

Link to comment
Share on other sites

The GroupData and OpData varaibes are "out" variables, as the GetOpGroupDataInExternalFile method fills them in with data.

Here they are set to "nothing" (or null for you non VB programmers).

That's not going to work, as they need to be intialzied to "someting"

 

 

So instead of this -->

Dim FileSpec As String = "C:\TMP\TEST.MCX-7"
Dim success As Boolean = False
Dim OpData() As ExternalOpsFileData = nothing
Dim GroupData() As ExternalGroupsFileData = nothing
Success = SearchManager.GetOpGroupDataInExternalFile(FileSpec, GroupData, OpData)

 

You need to initialize them as "empty" ->

Dim FileSpec As String = "C:\TMP\TEST.MCX-7"
Dim success As Boolean = False
Dim OpData() As ExternalOpsFileData = {}
Dim GroupData() As ExternalGroupsFileData = {}
Success = SearchManager.GetOpGroupDataInExternalFile(FileSpec, GroupData, OpData)

 

A side note:

GetOpGroupDataInExternalFile allows one or the other to be nothing (null), which tells this method not to bother retrieve that (Group or Op) data.

 

If both are null, you've told it to not bother with either, so you get nothing in the (2) output variables and the return in False.

It should only return False, if…

• The supplied file name “bad” (does not exist).

• Both of the supplied GroupData and OpData variables are null.

• Mastercam is not in a Machine Mode (it will not work if only in ‘Design’).

• Something horribly unexpected has gone wrong.

 

If you really need to use the GetOpGroupDataInExternalFile method in X7 - please contact me -> SDK <at> mastercam >dot> com

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