cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Config.pro search path "relative" path

mbonka
15-Moonstone

Config.pro search path "relative" path

Hello all,

 

 got some basic question about data management. Working in company without Windchill. System is based on chaotic subfolders structure and the same project is shifted between different workstations on external HDD Man Sad Everytime when project is shifted to other person so he has to find path to lost data and retrieve objects.

My question is: Does exists something like "relative path" for SEARCH_PATH config options:

Example: //project/main_frame/

 

l know is dumm question, but praxis is like l described...

Thx for any advice

best regards

@mbonka

1 ACCEPTED SOLUTION

Accepted Solutions
amejia
4-Participant
(To:mbonka)

I don't know how much this will answer your question, but this is what we do.

 

We have an in-house Creo configurator.  One of the steps it does is to create Windows environment variables through a batch file.  It adds some variables such as:

 

set LIB=C:\ptc\Libraries\

set COMMON=%PRO_ROOT%\Creo 4.0\M040\Common Files\

set PRO_ADMIN=\\10.188.201.13\pro_adm

 

Then it will declare the PATH variable like:

 

set PATH=%PRO_ROOT%;%PRO_ROOT%\%PROVER%;%PRO_ROOT%\%PROVER%\bin; ...

 

These variables can be referenced in the Config.pro.  Here is an example:

 

template_designasm $LIB\Templates\$CREO_VERSION\mm_basic.asm

 

I hope this helps.

View solution in original post

8 REPLIES 8
amejia
4-Participant
(To:mbonka)

I don't know how much this will answer your question, but this is what we do.

 

We have an in-house Creo configurator.  One of the steps it does is to create Windows environment variables through a batch file.  It adds some variables such as:

 

set LIB=C:\ptc\Libraries\

set COMMON=%PRO_ROOT%\Creo 4.0\M040\Common Files\

set PRO_ADMIN=\\10.188.201.13\pro_adm

 

Then it will declare the PATH variable like:

 

set PATH=%PRO_ROOT%;%PRO_ROOT%\%PROVER%;%PRO_ROOT%\%PROVER%\bin; ...

 

These variables can be referenced in the Config.pro.  Here is an example:

 

template_designasm $LIB\Templates\$CREO_VERSION\mm_basic.asm

 

I hope this helps.

KenFarley
20-Turquoise
(To:mbonka)

I don't know if this will help, but we had a similar problem. We don't have Windchill, either. We were working on a very large assembly with thousands of part, assembly, and drawing files and it was getting crazy trying to find a file in the listing (scrolling for a long time, etc.)

What we came up with was re-organizing the files into proper subdirectories, and then building a local search.pro file which you'd load when you wanted to work on the project. The trouble is, as more and more stuff was being done, sub-sub-directories and such would be created which were then not found, the search file needed to be manually updated, and on and on.

So, I wrote a batch file that would build the search file by searching down the directory structure, without all the horrible manual editing (and the mistakes that causes). Run the batch file in the top directory of the project, and it makes all the search file lines for you. Maybe this will help you. Here's the file:

::
:: Builds two files for use with Creo:
:: locconfg.pro = A short version of a config.pro file, which adds a
::                specification of a search path file to what is already
::                defined in the user's session.
:: locsrch.pro  = A list of directory specifications that are to be
::                appended to the user's already defined list of paths.
:: The purpos of these two files is to modify the search path for a specific
:: session so the user is able to find files that are in subdirectories of
:: a particular project directory.
::
:: Author: Kenneth J. Farley
:: Date:   2018-02-06
::

@ECHO OFF

setlocal EnableDelayedExpansion

::
:: Define the names of the files to be created.
::

set filConfg=locconfg.pro
set filPaths=locsrch.pro
set filExtra=external.pth

::
:: Determine if this batch file is being run on a local drive, or on a
:: network shared drive, and set a variable indicating as such.
::

set drvIsNet=0
IF "%~d0" == "\\" (
  set drvIsNet=1
) ELSE (
  FOR /F "tokens=2" %%a IN ('net use ^| findstr /r /c:" [A-Z]: "') DO (
    IF "%%a" == "%~d0" SET drvIsNet=1
  )
)

::
:: Build the local search path file so it reflects the current directory
:: structure, overwriting any existing file. Note that double quotes
:: are output around each path specification to allow for the possibility of
:: spaces or other characters that Creo doesn't handle well.
::
:: If there are other paths that the user wishes to include that are not
:: subdirectories of the current directory, they may be listed in file
:: named by the variable filExtra. The contents of this file will be
:: appended onto the end of the local search file. The format of the
:: contents of this file is not checked for validity.
::

ECHO. >NUL 2> %filPaths%
call :doPath "%CD%"
ECHO "!absName!" >> %filPaths%
FOR /R /D %%d IN ("*") DO (
  call :doPath "%%d"
  ECHO "!absName!" >> %filPaths%
)
IF EXIST "%filExtra%" TYPE "%filExtra%" >> %filPaths%

::
:: Build the config file, including the user's name, the current date, some
:: comments explaining the usage, and the one search path setting.
::

ECHO. >NUL 2> %filConfg%
ECHO ^^! > %filConfg%
ECHO ^^! Local version of config.pro, built automatically. Load >> %filConfg%
ECHO ^^! this file into your Creo session via the following: >> %filConfg%
ECHO ^^!     File-^>Options-^>Configuration Editor-^>Import/Export >> %filConfg%
ECHO ^^! >> %filConfg%
ECHO ^^! Author : %username% >> %filConfg%
ECHO ^^! Date :   %date% >> %filConfg%
ECHO ^^! >> %filConfg%
CALL :doPath "%CD%"
set absName=%absName:"=%
::"
ECHO search_path_file !absName!\%filPaths% >> %filConfg%
exit /b

::
:: The variable "drvIsNet", set at the beginning of this batch file,
:: indicates if this is a mapped network drive or not. If it is, we
:: want to expand the <letter>: expression to the absolute network
:: path, so the search and config files will be universal, working the
:: same for anyone using them. For example, user A might have a particular
:: drive mapped to "Q:", while user B has "P:". Using an absolute path
:: eliminates any concerns about this mapping difference.
::

:doPath
set "dirName=%1"
IF !drvIsNet! == 1 (
  set mapName=%dirName:~1,2%
  set dirName=%dirName:~3,-1%
  FOR /f "tokens=3" %%a in ('net use !mapName! ^| Find "Remote name"') DO set uncPath=%%a
  set "absName=!uncPath!!dirName!"
) ELSE (
  set absName=%dirName:"=%
)
exit /b

You can copy the text and save it into a file, I call mine "bldsrch.bat".

mbonka
15-Moonstone
(To:KenFarley)

Looks interesting. Can´t start it.

What l did:

1) copy text into txt file

2) renamed txt file extension to *.bat

 

Question is: When should l run this *.bat file? Before starting creo? or like auxiliary aplication?

 

Thanks for your advice...

 

 

KenFarley
20-Turquoise
(To:mbonka)

When I'm going to work on a project that I need this for, I do the following:

(1) If I haven't already, I copy the batch file (bldsrch.bat) to the top directory of the project.

(2) I run the batch file, usually in a command window, but I think it will work fine with double clicking in windows.

(3) Start Creo

(4) Change my working directory to the top directory of the project.

(5) Load the "locconfg.pro" file by following the menu picks:

File->Options->Configuration Editor->Import/Export->Import Configuration File

(These are the english picks, I hope they are easy to figure for your setup)

This will add the directories listed in "locsrch.pro" to your current search paths. It should make it so you can load assemblies in the project without having to "find" any "missing" parts/assemblies. The added search path entries are only applicable to the current Creo session. If you exit the program and later want to work on the same project, you will have to repeat Step (5) again. As long as no changes are made to the directory structure, you don't need to run the batch file again.

mbonka
15-Moonstone
(To:KenFarley)

Thanks for detailed manual.

l will test it and let you know the result.

-----

Has been tested ... and 100% success Smiley Happy

 

Great applaud for you... do not understand syntax, but mainly it works Smiley Very Happy

Much easier than local editing config.pro search paths...

 

Best regards

@mbonka

KenFarley
20-Turquoise
(To:mbonka)

Thanks.

The syntax for batch files is really hard to read. Every time I need to do anything with them I end up searching all over the internet for tips and tricks. It's 70% programming and 30% archeology. Plus lots and lots of experimentation. It's something that's not fun to do, the best part of it is having it done.

mbonka
15-Moonstone
(To:KenFarley)

This batch file works correct, but it doesn´t include "relative paths". Don´t wanna dive in programming...

My idea:

- put batch file in highest directory

- run batch file

- output in locsrch file will looks like:  "relative path/highest directory..."

Something like:

%~dp0

Was googling a little bit and l think it´s possible with some syntax.

You don´t have to solve it, just wanna your opinion, if is it possible?

 

Regards

@mbonka

KenFarley
20-Turquoise
(To:mbonka)

I think what you want is to see paths that just branch off the current directory, without the network or drive specification? For example, if I'm in "C:\PTC Files\Models\Project X" with directories "A Files", "B Files", I just want the locsrch.pro to contain:

"A Files"

"B Files"

If that's correct, then we need to use the output from a simplified DIR command for the lines. The batch file for this simplified operation is as follows:

::
:: Builds two files for use with Creo:
:: locconfg.pro = A short version of a config.pro file, which adds a
::                specification of a search path file to what is already
::                defined in the user's session.
:: locsrch.pro  = A list of directory specifications that are to be
::                appended to the user's already defined list of paths.
:: The purpose of these two files is to modify the search path for a specific
:: session so the user is able to find files that are in subdirectories of
:: a particular project directory.
::
:: Author: Kenneth J. Farley
:: Date:   2018-04-05
::

@ECHO OFF

setlocal EnableDelayedExpansion

::
:: Define the names of the files to be used.
::

set filConfg=locconfg.pro
set filPaths=locsrch.pro
set filExtra=external.pth

::
:: Build the local search path file so it reflects the current directory
:: structure, overwriting any existing file. Note that double quotes
:: are output around each path specification to allow for the possibility of
:: spaces or other characters that Creo doesn't handle well.
::
:: If there are other paths that the user wishes to include that are not
:: subdirectories of the current directory, they may be listed in file
:: named by the variable filExtra. The contents of this file will be
:: appended onto the end of the local search file. The format of the
:: contents of this file is not checked for validity.
::

ECHO. >NUL 2> %filPaths%
FOR /F "tokens=*" %%d IN ('DIR /AD /B') DO (
  call :doPath "%%d"
  ECHO !absName! >> %filPaths%
)
IF EXIST "%filExtra%" TYPE "%filExtra%" >> %filPaths%

::
:: Build the config file, including the user's name, the current date, some
:: comments explaining the usage, and the one search path setting.
::

ECHO. >NUL 2> %filConfg%
ECHO ^^! > %filConfg%
ECHO ^^! Local version of config.pro, built automatically. Load >> %filConfg%
ECHO ^^! this file into your Creo session via the following: >> %filConfg%
ECHO ^^!     File-^>Options-^>Configuration Editor-^>Import/Export >> %filConfg%
ECHO ^^! >> %filConfg%
ECHO ^^! Author : %username% >> %filConfg%
ECHO ^^! Date :   %date% >> %filConfg%
ECHO ^^! >> %filConfg%
CALL :doPath "%CD%"
set absName=%absName:"=%
::"
ECHO search_path_file !absName!\%filPaths% >> %filConfg%
exit /b

::
:: For this local version, the drive info is omitted from the search
:: file entries.
::

:doPath
set "dirName=%1"
set "absName=!dirName!"
exit /b

I've tried this out a bit, without spending too much time on it. Seems to work okay.

Announcements