cadcamguy
Industrial
- Feb 23, 2005
- 348
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 to rename 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
mapkey wd @SYSTEM cd>c:\\workdir.txt;
mapkey vb @SYSTEM purge;@SYSTEMwscript c:\\proe2001\\batch\\vbsinf.vbs;
mapkey av %wd;%vb;
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
mapkey wd @SYSTEM cd>c:\\workdir.txt;
mapkey vb @SYSTEM purge;@SYSTEMwscript c:\\proe2001\\batch\\vbsinf.vbs;
mapkey av %wd;%vb;