Re: %if

MicroStation - all pre-V8 versions

This is where you can find and contribute to discussions, ideas, and other information about all pre-V8 releases of MicroStation.

%if

  • rated by 0 members
  • This post has 12 Replies |
  • 2 Followers
  • Hello Christina - Perhaps you posted this in error.  In any event, please start a new thread/post with your issue rather than piggybacking on one that's three years old and not related to your specific issue.  This ensures that posts are easy to find and keeps posts discussing single issues intact.  With thanks!      

  • %if $(_USTN_USER) == "L:/V8i_Stds/WorkSpace/Users/"

        _USTN_CAPABILITY <-CAPABILITY_LEVELS_CREATE

    %elseif $(_USTN_USER) != "L:/V8i_Stds/WorkSpace/Users/"

       _USTN_CAPABILITY <+CAPABILITY_LEVELS_CREATE

    %endif

    I'm trying to get certain people the ability to create levels... and I wanted to put this in our site config file instead of separate ucf files. This doesn't seem to work for the first part, which disables, but it seems to work for the second part. I tried

    _USTN_CAPABILITY =  -CAPABILITY_LEVELS_CREATE

    %if $(USERNAME)==ME

    _USTN_CAPABILITY =  +CAPABILITY_LEVELS_CREATE

    but it just gave me errors. Any ideas?

    Thanks,

    Christina

  • Hi John,

    The reason for this was I needed a way to set a version config in the PDS cmd file so that I could then use a network location to add some custom tools for PDS users. Pain in the ............. with this product, evn though it sits on MS\J.

     The final config actually sits in it's own version build location, this was just a test for me.

     I'll give it a go, hope it works as it's a very handy addition.

     Ta,

  • Some small syntax changes but this may work better for you.

    %if $(MDL_COMP)=="PDS8"
          %include H:/Site/workSMART/Workspace_Intergraph/PDS8.cfg
    %elif $(MDL_COMP)=="PDS72"
          %include H:/Site/workSMART/Workspace_Intergraph/PDS72.cfg
    %else
          'Use PlantSpace :)
    %endif

    I understand the advantage to test what a variable is set to but in the case above I do not see the advantage (please help).  To me it appears you are using the same path and the same variable is being used, which is equal to your file name.  So why not just read the variable as the file name.

    Here is a place I have used the test variable value before.

    _USTN_CAPABILITY =  -CAPABILITY_LEVELS_CREATE
    %if $(USERNAME)==ME
    _USTN_CAPABILITY =  +CAPABILITY_LEVELS_CREATE

    or

    %if $(MSTN)=="v8"
          %include $(v8_workspace_path)mycfg.cfg
    %elif $(MSTN)=="v7"
          %include $(v7_workspace_path)mycfg.cfg
    %else
          'Use PlantSpace :)
    %endif


    %endif

    later,
    ~john.

  • Maybe I'm missing something obvious, but what happens if you apply what was in the last reply with what you had originally? As in:

    %if $(MDL_COMP)=="PDS8"
          %include H:/Site/workSMART/Workspace_Intergraph/PDS8.cfg
    %elseif $(MDL_COMP)=="PDS72"
          %include H:/Site/workSMART/Workspace_Intergraph/PDS72.cfg
    %elseif
          'Use PlantSpace :)
    %endif

    (BTW, I noticed that your original post had a space between the first % and include...)
  • Hi Phil,

    What I was hoping to do is use the one config to set different version numbers to run our PDS build. The only other way, I suppose, is to simply use a '%if defined' statement and use a unique config for each version. Was just looking into the option of having one config that can be set for different versions.

     Thanks,

  • Not sure if this is what you might be looking for, but have you tried the following:

    %if $(DevDir(MY_FILE)) == "c:\work\"
          #do something
    %elseif $(devdir(MY_FILE)) == "c:\temp\"
          #do something else
    %endif

    (note the '==' double equal signs)

  • The idea would be to use different settings for this, or any other defined config, so that it would trigger certain config paths. I don't want to tp be picked up as defined or not defined, but pick up what it is being set to. This sort of function would be a LOT of help.
  • Why not just;

    Path = H:/Site/workSMART/Workspace_Intergraph/ 

    %if defined (MDL_COMP)

    %   if exists ($(PATH)$(MDL_COMP).cfg)

    %      include $(PATH)$(MDL_COMP).cfg

     %   endif

    %endif

     Does that work for you?

     

    Later,

    ~john.

  • Does your debug=4 show an error on that line?

    Something like this:

    [C:\Program Files\Bentley\Program\MicroStation\config\msconfig.cfg], line 52, depth = 0.

  • Tried that as well and still nothing. Have been told by BSP that %if on it's own is not a valid config.

    Pity, it would be helpful with some things I'm doing coming up.

  • Dude,

    I noticed you wrote spaces in the preprocessor directives. Not sure if it was intentional?

    My understanding is that there's an error created if you put a space after the %.

    So it should probably read <with spaces removed>:

    %if ($(MDL_COMP)="PDS8")
    %include H:/Site/workSMART/Workspace_Intergraph/PDS8.cfg

    %elif

    %if ($(MDL_COMP)="PDS72")
    %include H:/Site/workSMART/Workspace_Intergraph/PDS72.cfg

    %endif

    %endif

    %endif

     

    Does that work for you now?

    Cheers

    /Rob

     

  • One config I haven't had to use before is using %if to link a defined config.

    As an example,

    %if  $(MDL_COMP)="PDS8"

    %include <cfg file>

     

    From what I've been able to fine this looks right. The include statement work, but if I expand the statement to pick up different possabilities for  $(MDL_COMP) then the include statement works as if the %if statement is ignored.

     

    As in:


    % if ($(MDL_COMP)="PDS8")
    % include H:/Site/workSMART/Workspace_Intergraph/PDS8.cfg

    %elif

    % if ($(MDL_COMP)="PDS72")
    %include H:/Site/workSMART/Workspace_Intergraph/PDS72.cfg

    %endif

    %endif

    %endif

     

    Any thoughts on why this is a problem or a better way to do this?

    Thanks,

Page 1 of 1 (13 items)