Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.
I'm using r2001 so you will need to record your mapkeys in WF as they will more than likely be a little different.
you needto mapkey abatch file to run from the systems window all it needs in it is one line
cd > workdir.txt
then mapkey the "note from file " to place the text that the batch file writes.
so in r2001 it looks something like this, I put the batch in a new folder and it overwrites the workdir.tx each time, but you can place it in your working directory doesn't really matter as long as you setup your mapkeys
this will insert the path, you can chain the 2 mapkeys together and call it something else or run one at a time, this only gives path, if you want to include the drawing name then you have to modify the batch file to
cd > workdir.txt
copy workdir.txt+C:\proe2001\batch\dwgname.txt workdir.txt
andcreate the dwgname.txt file , all it has in it is below, batch files don't like the slash and & symbol so you append it to the first file, it comes in as two lines, so you have to live with it that way or edit the note
\&dwg_name
this is only parametric for the dwg name if you reanme the drawing it will change the note , but if you move it to another folder you have to rerun
thanks for the procedure, before this I had put a parameter in the format and when I insert the format it ask for path so we put the path manually. Now we will try this
I'd like use the file gererated by batch program in a part parameter, as information of part in order to export this data to a repeat region in a drawing table.
From 3D Logix_configpro_mentor, a handy as heck program btw
<H1 style="MARGIN: 12pt 0in 3pt">display_full_object_pathpath<?:NAMESPACE PREFIX = O /><O> </O></H1> yes, *no<O> </O>
Controls the display of the object
Great job Wsylvester. Your batch/mapkey has lots of promise for date and time in a drawing also.
set prompt=$d $t will give you date and time in your prompt to be output and input into Pro/E.
Follow day edit
I spent some time attempting to get the prompt date/time into an environmental variable so I can output it to a text file to import with a mapkey. Right now, unless someone can figure that out, a shareware date utility should do what is necessary to get the job done.
Also, open a DOS Command Prompt and type in "set" to see what environment variables you may have. Others have asked toautomateadding theuser name, a variable set where I work. Edited by: donha
Didn't realize the date and time was something needed. I knew you could get date from...&todays_date... didn't think about the time part... but yes I can see that as something that can be used in the never ending battle of documentation.
I know that by getting the file path or directory has opened up a good deal of automation processes to configuring other programs to where is Pro-E now for me.
I was just happy to get ms WORD to follow Pro around so I wouldn't have to do the dir surfing to the active working directory to insert pics and files into a doc. But find now that since word knows where I am with ProE . I can use the VBA in Word to do quite a number of things for me, with the tree file,inf files etc.
I didn't have much luck using a batch file to get the date and time written to a file by redirection.
So I have different method to do this, you have to have wscript.exe on your puter which is a gimme nowdays.. if not, it's available at microsoft's website
vbs routine location needs to relate to the mapkey location..your choice
vbs routine .... datetime.vbs
dim fso, myfile
set fso = createobject("scripting.FileSystemObject")
set myfile = fso.opentextfile("c:\datetime.txt",2,true)
myfile.writeline now()
myfile.close
you can use notepad and paste in the code... rename to datetime.vbs or whatever you want to call it... and also you can change the "c:\datetime.txt" to whatever you prefer..
So it's pretty much the same as the path name deal...just uses vbs ..now the date and time can be insert as note like the other... it will not update like &todays_date
only if you gorun againwill it be current and reinsert note
Happy Stamping!!.. special thanks to Don and Brian_Adkins for getting me to think of different ways to skin a cat
I want a parameter to be equal the file path of the part.
When you use the main menu, Info:Model you get an information window
called "INFORMATION WINDOW(prt0001.inf)" On the first line it has
the part name and the full file path. I want a Parameter to be
set to this file path whenever the part is opened.
This way I can see what path it was pulled from. (has more detailed benifits)
I understand that it was a simple system varible that went away after 2000i.
One thing I have never cared for is the way ProE outputs these files. Depends on how many times you do a Info>Model as to what the ending extension is.... .inf.3,inf.4 and so on. Unless you config windows to open all the different numbers with your editor, it's a pain. Then to top it off you don't seem to be able to copy and paste from Pro's Information window..say to a note. So then you have torename the inf.? file to .txt so you can copy and paste from that... another pain.
It's great that ProE outputs this Info. I just wish they had made it a little easier to use the info.If I have my config.pro file set to "display_full_object_path yes", it will output those paths in the inf file even if I am pulling a model for a drawing from another directory...it's there... I like the option to use that info without too much trouble.
So, with a little VBS here is a way, you have to make sure there in only one set of inf file in your work dir..doesn't matter if its the same with all the .2,.3,.4 etc.it will purge those away ... and my purge.bat is on my path so it's a one liner on code. The mapkey wd will output a file so VBS will know what folder you are in, then the script runs and renames the inf file to a txt file.... then this is set to grab the maodel name for a drawing.. trims out the extra info and returns just the modelmname with full path.
With a little bit of tweaking, you could set this to get all the paths-model names of a assy.
So any questions let me know, but here is the code, naming and locations can be changed to suit your setup
script is named vbsinf.vbs and the path it gets is called
from c:\workdir.txt
Additonal mapkeys can be added in to automate the Info>model and create note from file... but you have to edit the note key, by dropping the last couple of lines or it just sticks in the same text value each time
Happy inf'ing
-------------------------------------------------------
dim wdir,mypath
dim dirpath
set wdir=createobject("scripting.filesystemobject")
set mypath=wdir.opentextfile("c:\workdir.txt",1,true)
dirpath=mypath.readline
mypath.close
Dim FSO, oFile, oFolder, strFolder
Set FSO = CreateObject("Scripting.FileSystemObject")
strFolder = dirpath
For Each oFile in FSO.GetFolder(strFolder).Files
If InStr(oFile.Name, "inf.") Then
If FSO.FileExists(FSO.GetParentFolderName(oFile) & "\fileinfo.txt") Then
FSO.DeleteFile FSO.GetParentFolderName(oFile) & "\fileinfo.txt"
End If
FSO.MoveFile oFile, FSO.GetParentFolderName(oFile) & "\fileinfo.txt"
Exit For
End If
Next
set mypath=wdir.opentextfile("fileinfo.txt",1,true)
dirpath=mypath.readline
dirpath=mypath.readline
trim(dirpath)
dirpath = mid(dirpath,instr(dirpath,"C:\"))
mypath.close
set mypath=wdir.opentextfile("triminfo.txt",2,true)
mypath.writeline dirpath
mypath.close
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.