Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trail File and Pro/Program woes 2

Status
Not open for further replies.

dagarber

Mechanical
Mar 24, 2006
16
Hi again guys,

I have created a trail file and am running it from the command line with the following input:
proe.exe -g:no_graphics mytrailfile.txt
(I use the full filepath to proe.exe and mytrailfile.txt, just abbreviating it here for clarity).

The purpose of the trail file is to open ProE, regenerate an assembly from a text file (Edit -> Regnerate -> From File), save the assembly and exit. To make the trail file, I opened ProE, set the working directory, opened an assembly, Edit -> Regenerate -> From File, specified the file, saved the assembly, and exited ProE. I then went and grabbed the trail file and renamed it to mytrailfile.txt.

So far, so good.

In my assembly, the only thing added to the Program file is this:

INPUT
CARGO_RADIUS NUMBER
CARGO_LENGTH NUMBER
HOLEPATTERN_NUMOFHOLES NUMBER
SPACEBTWNHOLES_INNER NUMBER
END INPUT

The quirky thing is this: I'm opening ProE using a Visual Basic command in an Excel file. Sometimes ProE opens with the default working directory as the location of this Excel file. When it does that, everything works fine; ProE runs and closes, and the model is updated just like I asked it to. But other times, ProE will open with a different directory as the default working directory. When it does this, even though it reads the trail file, it doesn't update the model.

My self-diagnosis is that either:
1) I just need to set ProE to open with the correct directory set as the default working directory. I bet I can do this with a config file? So I could save a config file that sets the default working directory, and then force ProE to open using this config file with a command line argument? or,
2) I need to edit my Pro/Program file to include an Execute section, ala thread554-100817

Of course, I'm just guessing on those things ;)

thanks,
David
 
Replies continue below

Recommended for you

David,

I go about things like that in a different manner, not sure if it will work networked...more than likely

I have a mapkey run a batch file that writes my current working directory path to a file. i read that file with my VB apps and in vba macros on startup....so the other stuff follows ProE along as far as the current work dir

works good for me

 
Try setting the config.pro option

file_open_default_folder working_directory
 
Hi JohnAndrews,

That config.pro option makes it so that when you go to File -> Open, the folder that pops up is your working directory. What I want to do is change what that working directory is.
 
Sorry if I'm overposting in this thread...

I figured out how to set the default working directory. It's actually really easy. If you're running ProE from the command line, it will open with the default working being the prompt you were at, ie:

C:\My Documents> P:\TheFolderWhereProELives\proe.exe

The above will start ProE with the default directory being C:\My Documents.

You can do the same thing in Visual Basic using the ChDir command. See this post in Google groups.

My problem now is that I can't get the trail file to work. It works fine if I open ProE and choose Tools -> Play Trail File. But when I run ProE in no graphics mode, it doesn't work! Any ideas on this? This might need to be a new thread topic...
 
Just wanted to let everyone here (and any future posters who might come across this thread while searching...) know that I got this to work. So far I have tried it on one other computer as well and it worked there, so the trail file is at least somewhat portable (both computers were PCs running Windows XP and Wildfire 2.0, I don't know yet what would happen if you try to use the same trail file on a different platform or a different version of ProE).

The key steps in setting up ProE for automation through an Excel file are:

1. Create the model in ProE.
2. Name dimensions.
3. Edit the Pro/Program to include the dimensions named above.
4. Create a tab-delimited text file with the dimensions named above.
5. Create a trail file that regenerates the ProE model from the text file.
6. Create an excel macro to run ProE using the trail file.

In ProE:
1) Create the model.
2) Name the dimensions you want to change (by right-clicking a dimension and going to Properties).
3) Edit the Pro/Program (in Wildfire 2.0 it is under Tools -> Program -> Edit Design):
INPUT
dimensionname1 number
dimensionname2 number
dimensionname3 number
END INPUT
See thread554-144905 for a more thorough discussion of this.

In Excel:
4) Create a macro to save a tab-delimited text file with the names of the dimensions on your ProE model that you want to modify (check out the excellent Profiles Magazine article on the entire process: Drive Your Pro/ENGINEER Model with a Spreadsheet). Enter values for the dimensions and save a tab-delimited file ("mydata.txt").

In ProE:
5) If you have ProEngineer open, close it. Open it again, open the file you want to modify and perform all of the actions that you would like to automate (including Edit -> Regnerate -> From File, and select the text file you generated from Excel). End by closing the file and exiting ProEngineer. Open windows explorer, find the trail file that was created, and rename it to "mytrailfile.txt" or something similar.

In Excel:
6) Open the spreadsheet you created earlier. Create another macro (using the Visual Basic editor) that opens ProE in no graphics mode and run it from the trail file you created earlier. You are going to want to use the Visual Basic "Shell" command with the following:
proe.exe -g:no_graphics mytrailfile.txt
You can also set the relative path using Visual Basic "ChDir". Whatever relative path you set will determine the directory that ProE opens with as the default working directory. ProE will save trail files, etc, to this directory even if you change the working directory during your session.
If the relative path is not the location of proe.exe, you will need to use the full filepath name to proe.exe (and possibly also to mytrailfile.txt, although it is easiest just to put the trail file wherever you will be setting the relative path to).

There are some more tricks to it that you run into as you go along, but that is pretty much the jist of it. You can't use the 'save' command in the ProE trail file sequence, because if you overwrite a file that was opened, it is going to give you an error next time you run the trail file (I could be wrong on this one). So if you need to save you will need to save a copy instead.

In my implementation of this, I am not saving the ProE file, I just save an eDrawing instead. If you don't have eDrawings installed, it is definitely worth a look, it is a very well-made program.

Ok, good luck ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor