Quantcast
Viewing all articles
Browse latest Browse all 11712

Batch file that runs same trail file on multiple parts

Hi!

I registered here to ask this question. I've been working on it off and on for a week and can't quite figure out where I'm going wrong.

 

I'm going to have about 100 parts coming through that I need to populate parameters, recreate layers, and rename datums for (and a couple other tasks). So I recorded a trail file that will do the tasks. I tested it independently and it works no problem.

 

I then wrote a .BAT file that will go through the directory I give it (where the parts are located), it will export the list of parts to a text file.

Using this list, I set up a FOR loop to replace the part number in the trail file at each iteration.

 

The problem I'm running into is that when the batch file directs Creo to open a file, I get this message:

 

Cannot find C:\Users\%username%\Desktop\AutoCreo\Backup\PA.txa C:\Users\%username%\Desktop\AutoCreo\Backup\Test_Folder\%%a

 

Is Creo trying to open that as a single file, instead of opening %%a (Part from list) and running PA.txa (Trail File)?

I tried inserting pro_wait as well, as it was a separate command I ran across that may or may not help Image may be NSFW.
Clik here to view.

 

Here is my code:

 

CODE:

@ECHO OFF

ECHO Brought to you by: ME

::  Prompts user for the directory

set /p pathName=Enter the File Path of the folder:

set /p username=Enter your username:

 

::  1. Change to the location set above

::  2. List all files in that directory and store in a text file desktop

cd %pathName%

dir /s /b *.* > c:\users\%username%\desktop\list.txt

 

::  3. Opens Creo then runs 'for loop' to run script against each file in list.txt

::     This sets and populate parameters

::  4. Add -g:no_graphics to run in non windows mode

for /f "delims=" %%a in (c:\users\%username%\desktop\list.txt) do ("c:\Program Files\PTC\Creo 2.0\Parametric\bin\parametric.bat" pro_wait "C:\Users\%username%\Desktop\PA.txa %%a")

 

Pause

 

In summary, the .bat file works up to a point. It stops when Creo is open/running and the OPEN FILE window is there asking for which part to open. The .bat file inputs (what looks to me to be the correct filepath) and then gives me that error.

I read something about a protk.dat file? Is this necesarry to get the .bat to communicate directly with Pro/E ?

 

I would really appreciate any help I can get. I've tried asking a few other places as well and haven't had much luck.

Thank you for your time!


Viewing all articles
Browse latest Browse all 11712

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>