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:

.ge3 to mcx


Charlie Pierson
 Share

Recommended Posts

Mcam9 will not convert .ge3 to .mc9 by directory.

McamX will not read .ge3

I have a bunch of .ge3 files used for archival purposes.

 

My Plan is :

1).Mcam9:file->converters->iges-> read directory

2). McamX: File-> import directory -> iges

 

or use dwg, dxf or such

 

Mcam9 is still running, anybody have a better way of getting from .ge3 to .mc9 or .mcx

 

?????????????? headscratch.gif ??????????

 

cp

Link to comment
Share on other sites

quote:

Mcam9 will not convert .ge3 to .mc9 by directory.


You don't convert GE3 files into V9+ headscratch.gif

Select; File/ Get/ Under Files of Type scroll down to Pre-V7 Mastercam Files(*.GE3) and open the file...

My X isn't here yet so I don't know...

Link to comment
Share on other sites

Try this script to mass convert GE3 files to MC9. I whipped it up quickly and can't test it since I don't have any GE3 files.

 

code:

' ******************************************************************************

' * Source Code : GE3_2_MC9.vbs *

' * Description : Convert GE3 files to MC9 format *

' * Date : 08/11/2005 2:37 PM *

' * Version : 0.0.1 *

' * Programmer : Christopher V. Bellini *

' * *

' * ---------------- *

' * | REVISION LOG | *

' *----------------------------------------------------------------------------*

' * Programmers Notes: *

' * - cvb (08/11/2005): V0.0.1 completed but not tested...no GE3 files
:(
*

' * *

' * ///////////////////////////////////////////////////////////////////////////*

' * This library is free software; you can redistribute it and/or modify it *

' * under the terms of the GNU Lesser General Public License as published by *

' * the Free Software Foundation; either version 2.1 of the License, *

' * or (at your option) any later version. This library is distributed in the*

' * hope that it will be useful, but WITHOUT ANY WARRANTY; without even the *

' * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *

' * See the GNU Lesser General Public License for more details. *

' * *

' * You should have received a copy of the GNU Lesser General Public *

' * License along with this library; if not, visit: *

' *
or write to the Free Software *

' * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA*

' * ///////////////////////////////////////////////////////////////////////////*

' *----------------------------------------------------------------------------*

 

Const DEF_GE3_EXT = "GE3"

 

Dim g_iDicIdx ' index for the dictionary object

 

Call Main()

 

' Purpose: the main subroutine

Sub Main()

Dim strSourceDir ' source directory with MC9 files to post

Dim strDestDir ' destination directory for posted NC code

Dim dicGE3 ' GE3 files to be converted

Dim objDicItem ' Dictionary item

Dim strMC9Fname ' MC9 filename of the current GE3

Dim iX ' counter

 

 

' prompt user for source directory containing MC9 files to be posted

Call ClearPromptLines()

Call WriteString("Select the source directory.")

strSourceDir = BrowseForFolder("Select the source directory containing GE3 files.", "")

If (strSourceDir = vbNullString) Then

ShowString "Source directory for GE3 files was not selected. Exiting..."

Exit Sub

End If

 

' prompt user for source directory containing MC9 files to be posted

Call ClearPromptLines()

Call WriteString("Select the destination directory.")

strDestDir = BrowseForFolder("Select the destination directory to put the MC9 files.", "")

If (strDestDir = vbNullString) Then

ShowString "Destination directory for MC9 files was not selected. Exiting..."

Exit Sub

End If

 

' init

g_iDicIdx = 0

 

' create a Dictionary object

Set dicGE3 = CreateObject("Scripting.Dictionary")

 

' get all of the GE3 files from the selected directory and its subdirectories

Call RetrieveGE3FilePaths(strSourceDir, dicGE3)

 

' loop through dictionary

objDicItem = dicGE3.Items

If (dicFiles.Count <> 0) Then

For iX = 0 To dicGE3.Count - 1

If (OpenMC(objDicItem(iX)) = False) Then ' can't open GE3 file

ShowString "Can't open " & objDicItem(iX)

Else

' Clear the current geometry and save the newly imported file

' as an MC9.

Call NewMC(False)

 

Call ImportFile(objDicItem(iX))

 

If (IsDrawing()) Then

strMC9Fname = Replace(objDicItem(iX), ".GE3", ".MC9")

 

If (SaveMCAs(strMC9Fname, True) = False) Then

ShowString "Unable to save: " & strMC9Fname

End If

Else

ShowString "No geometry in file: " & objDicItem(iX)

End If

End If

Next

Else

ShowString "No GE3 files found."

Exit Sub

End If

 

End Sub

 

 

' Purpose: display a BrowseForFolder dialog from the Shell

' I: prompt message on the dialog

' I: path to start browsing in

' O: selected path, or vbNullString if no folder selected

Function BrowseForFolder(strPrompt, sFolder)

On Error Resume Next

 

Dim objShell, objFolder, intColonPos, objWshShell

Dim FSO, varTemp

 

' -- Create our all important objects

Set objWshShell = CreateObject("WScript.Shell")

Set objShell = CreateObject("Shell.Application")

Set FSO = CreateObject("Scripting.FileSystemObject")

 

Set objFolder = objShell.BrowseForFolder(&H0&, strPrompt, &H1&, sFolder)

 

' -- Initialize to failure

BrowseForFolder = vbNullString

 

' -- Did the user Cancel?

If Not objFolder Is Nothing Then

Select Case objFolder.Title

' -- Did the user select Desktop?

Case "Desktop"

BrowseForFolder = objWshShell.SpecialFolders("Desktop")

 

Case Else

' -- Get the folder selected

varTemp = objFolder.ParentFolder.ParseName(objFolder.Title).Path

 

' -- If the user does not select a folder or cancels out an error is raised

If Err Then

Select Case Err.Number

' -- Probably root drive selected e.g. (C:)

Case 91, 424

' -- Check for Root

intColonPos = InStr(objFolder.Title, ":")

 

If intColonPos > 0 Then

BrowseForFolder = Mid(objFolder.Title, intColonPos - 1, 2) & ""

End If

 

Case Else

End Select

 

Err.Clear

 

Else

' -- If we get this far make sure the folder exists

' -- selecting a network folder may result in an invalid folder

If FSO.FolderExists(varTemp) Then BrowseForFolder = varTemp

End If

End Select

End If

 

' -- Check for an error of any kind

If Err Then

BrowseForFolder = vbNullString

MsgBox "Error selecting folder: " & Err.Description, vbExclamation, "BrowseForFolder"

Exit Function

End If

 

' -- Clean up

Set objWshShell = Nothing

Set objShell = Nothing

Set objFolder = Nothing

Set FSO = Nothing

End Function

 

 

' Purpose Retreives full path of all files in a directory and optionally in sub

' directories as well

' I: directory of files

' I/O: Dictionary object containing full paths of all files

Sub RetrieveGE3FilePaths(ByVal strDir, ByRef objDic)

Dim objFSO

Dim objFolder

Dim objFileCollection

Dim objFolderCollection

Dim objItem

Dim objSubFolder

 

 

' create an FSO object

Set objFSO = CreateObject("Scripting.FileSystemObject")

 

On Error Resume Next

Err.Clear

 

Set objFolder = objFSO.GetFolder(strDir)

 

If Err.Number = 0 Then

On Error GoTo 0

Set objFileCollection = objFolder.Files

 

' Determine maximum length of a filename

For Each objItem In objFileCollection

' only add MC9 files to our dictionary

If (objFSO.GetExtensionName(objItem.Name) = DEF_GE3_EXT) Then

g_iDicIdx = g_iDicIdx + 1

objDic.Add g_iDicIdx, strDir & "" & objItem.Name

End If

Next

 

' comment this out if we don't need to go into sub dirs

Set objFolderCollection = objFolder.SubFolders

' process each subdirectory within the current directory

For Each objSubFolder In objFolderCollection

' recursive call to process a subdirectory

Call RetreiveFilePaths(objSubFolder.Path, objDic)

Next

 

' cleanup

Set objItem = Nothing

Set objFileCollection = Nothing

Set objSubFolder = Nothing

Set objFolderCollection = Nothing

Else

MsgBox "GetFolder Error" & vbLf & _

Err.Description & "(" & Err.Number & ")" & vbLf & _

strDir, vbCritical

On Error GoTo 0

End If

 

' cleanup

Set objSubFolder = Nothing

Set objFolder = Nothing

Set objFSO = Nothing

End Sub

 

 

' Purpose: determine if the current file contains something...anything

' I: (none)

' O: True=yes, False=no

Function IsDrawing()

Dim bRet

 

bRet = StartDBSearch(mc_alive, -1)

 

UnselectAll

 

IsDrawing = bRet

End Function

HTH

Link to comment
Share on other sites

Well, I am kind of glad that you found that out for me. I was hoping that the ImportFile() subroutine would be able to bring in a GE3 file. According to its description in the documentation:

 

// Import ANY file type (IGES, STEP, DWG, DXF, Pro/E, Inventor, etc)

// into the current Mastercam session

Void ImportFile(String (Input: the file name) )

 

I guess "ANY" doesn't include GE3 frown.gif

 

As a last-ditch effort, you could try replacing this line:

 

code:

Call ImportFile(objDicItem(iX))

with this:

 

code:

If Not OpenMC(objDicItem(iX)) Then ShowString "Can't open the file: " & objDicItem(iX)

No guarantees but it's worth a shot.

Link to comment
Share on other sites

I found some time to fix a few bugs. You can find the script on the FTP site in the VB_Scripts folder and it's called GE3_2_MC9.vbs. I've also uploaded another one for all to play around with called MC9_2_MCX.vbs...I wonder what it does wink.gif

 

Of course, you really don't need these scripts since a simple DOS command could take care of it. For example:

 

code:

C:your_directory_of_files>rename *.mc9 *.mcx

The major difference is that the DOS command method doesn't actually convert the file to the updated format; it merely renames it and its file format will be updated the next time it's opened and saved. The scripts actually open each file and save them in the updated file format.

 

HTH.

Link to comment
Share on other sites

Bullines,

 

I admit that I haven't tried your script yet, but I tried using rename to turn GE3 files into MC9 and MCX files; in both cases X spat them out saying that they are corrupt files. I also tried renaming a "true" MC9 file to MCX, but got the same problem.

 

---------

 

There is another option for people who for some reason chose not to use the VB Script. Using the DOS command you first rename all of your GE3 files to MC7 (or MC8), and here's why....

In V9 you can press File, Browse and this shows each file in a certain directory one at a time. By default it looks for MC9 files, but if you change the extension to look for MC7/8 files, a checkbox appears that says "save as MC9 file". So this feature will now show each MC7 file it finds, and saves it as an MC9 file (not relpacing the originals, which can be set back to GE3 afterwards if you prefer).

 

The only problems I found with this method is 1) you get a "corrupt or invalid file" message each time. It doesn't seem to matter though as I can still read an MC9 file into X afterwards without a problem. So during the conversion I just hold down the enter key biggrin.gif

2) I had a file on my screen before I started the Browse process, so all of the new MC9 files have that file as a bitmap in the File, Get window. So either start with a blank screen, or maybe put a note on the screen saying "old GE3 files"!

 

Finally, you should be able to use Import Directory in X to convert these MC9 files into MCX. But I will admit that I have tried that three times but X didn't convert all of the files before crashing. It was a fault in MSVCR71.DLL which I guess is a Microsoft file. The best it managed was to convert 142 out of 167 files confused.gif

 

[ 08-18-2005, 06:33 AM: Message edited by: Rich Thomas ]

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