Skip to main content
2-Explorer
March 15, 2018
Solved

Config.pro search path "relative" path

  • March 15, 2018
  • 2 replies
  • 8676 views

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

    Best answer by amejia

    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.

    2 replies

    amejia1-VisitorAnswer
    1-Visitor
    March 20, 2018

    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.

    21-Topaz II
    April 3, 2018

    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".

    mbonka2-ExplorerAuthor
    2-Explorer
    April 3, 2018

    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...

     

     

    21-Topaz II
    April 3, 2018

    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.