%if exists expressions in .pcf files

I am trying to create an expression in a .pcf file which looks to see if a folder exists and if it does, sets the project data variable to it.  If it fails to find the folder, th eproject data variable should be set to another folder.

I am using the _USTN_PROJECTNAME variable as our project folders are named after these and the expression I am trying to use is as follows:

%if exists (P:\3210\_CAD\$(_USTN_PROJECTNAME)\13-rit\)

_USTN_PROJECTDATA = P:\3210\_CAD\$(_USTN_PROJECTNAME)\13-rit\

%else

_USTN_PROJECTDATA = C:\3210\_CAD\$(_USTN_PROJECTNAME)\13-rit\

%endif

What is happening is that the expression fails to detect the folder in the %if statement even though it exists and goes instead to the folder on C:.  If I replace the %if statement with a hard coded location such as

%if exists (P:\3210\_CAD\ProjectXXX\13-rit\)

_USTN_PROJECTDATA = P:\3210\_CAD\$(_USTN_PROJECTNAME)\13-rit\

%else

_USTN_PROJECTDATA = C:\3210\_CAD\$(_USTN_PROJECTNAME)\13-rit\

%endif

Then it works perfectly but I lose the ability to change the folder location through the _USTN_PROJECTNAME variable!!

Has anyone any tips about what I could be doing wrong?

/James

AECOsim Building Designer Select Series 3

Parents
  • You are attempting to define this based off of a project that is not currently picked/defined, which is why it works if it is hard coded.
    I need a bit more information on why you are attempting to set this variable in this manner.

    Timothy Hickman

    CADD Manager | CADD Department

    timothy.hickman@colliersengineering.com

    Main: 877 627 3772| 

    1000 Waterview Drive Suite 201 | Hamilton, New Jersey 08691

  • A few years ago, we had a visit from a Bentley "expert" who suggested that we set up a template .pcf file containing following expressions to define the project description as well as the location of the project folder:

    _USTN_PROJECTDESCR = $(_USTN_PROJECTNAME)

    _USTN_PROJECTDATA = P:/3210/$(_USTN_PROJECTNAME)/000/13-rit/

    This way, whenever someone needs to create a new project, they simply copy the template .pcf file and then rename it with exactly the same name as the project folder ie. if the project folder is to be called Project1 then the template file is copied and renamed Project1.pcf.

    Up to now, this has worked quite well. Every project leader now simply has to rename the template file and the project appears in AECOsim ready for use.

    What I was wanting to do was to adjust the that file so that it would use the project folder on the project server whenever it was connected to it. If it wasn't available then it would use a mirrored copy of the project folder which was stored locally on the C: drive. Everything else would remain unchanged.

    There are probably far better ways to do this, but I was hoping for a quick and easy way of achieving it...
Reply
  • A few years ago, we had a visit from a Bentley "expert" who suggested that we set up a template .pcf file containing following expressions to define the project description as well as the location of the project folder:

    _USTN_PROJECTDESCR = $(_USTN_PROJECTNAME)

    _USTN_PROJECTDATA = P:/3210/$(_USTN_PROJECTNAME)/000/13-rit/

    This way, whenever someone needs to create a new project, they simply copy the template .pcf file and then rename it with exactly the same name as the project folder ie. if the project folder is to be called Project1 then the template file is copied and renamed Project1.pcf.

    Up to now, this has worked quite well. Every project leader now simply has to rename the template file and the project appears in AECOsim ready for use.

    What I was wanting to do was to adjust the that file so that it would use the project folder on the project server whenever it was connected to it. If it wasn't available then it would use a mirrored copy of the project folder which was stored locally on the C: drive. Everything else would remain unchanged.

    There are probably far better ways to do this, but I was hoping for a quick and easy way of achieving it...
Children