Automating the use of Label Display in Bentley Facilities Planner

Hello everyone! I'm currently trying to automate the use of the Label Display tool in Bentley Facilities Planner. My goal is to create a script that I could batch run in several files to achieve the mentioned labelling.

I'm using Microstation CONNECT Edition.

I have experience with VBA Macros in Office and LISP in AutoCAD but I'm knew to programming in Microstation so any kind of guidance would be much aprecciated.

Should I use VBA Macros or something else?

How can I find the right commands to automate the use of this tool?

Thank you in advance.

Best Regards

Allow me to explain a bit further what I want to accomplish.

I wish to create a script to label the rooms of several files according to a template. The general goal is to have each room in each of the files labelled with a room stamp (Microstation Cell/AutoCAD Block) cointaing information of the rooms. This files I will later convert into DWG files.

I have created a script to take text files inside polygons in AutoCAD (AutoLISP) and create the room stamps (AutoCAD Blocks with attributes), but for this I need to import the information for each room via labelling as text objects inside the polygons before DWG conversion.

Once I achieve this I was also thinking about creating the room stamps entirely in BFP to avoid the use of AutoCAD.

What are your thoughts on this? Am I on the right track? Any help would be much aprecciated.

Parents Reply Children
  • Thank you for your answer Jan. I recorded a Macro when trying to use the mentioned tool. I basically opened the tool and opened a labelling template and run it and only got the following line at the VBA code:

    '   Send a keyin that can be a command string
        CadInputQueue.SendKeyin "DMSG ACTIVATETOOLBYPATH Display\Label Display"

    What do you think? How could I continue?

  • Hello Federico,

    Label Display tool allows to create a label definition file with your selected settings in ProjectWise. If you will enable to use this file as autodisplay, then it will always load your selected labels after file is open. This tool is always loading the latest label information directly from database so we can call that those labels are dynamic, but those labels are never saved inside the model.

    Could you please tell us more about your requirement?

    I understand that you wish to create a script file which could label all required files for you. Does it mean you need all those labels saved inside DGN model as text objects? Do you need a different labels for different files?

    We can figure out how to help for you, but we need more details about your requirement.

    Best Regards,
    Kestutis Mitkus

    Application Engineer, Building, Structural & Plant

     

  • Hello Kestutis,

    Thank you for your reply and your intention to help Slight smile. Allow me to explain a bit further what I want to accomplish.

    Indeed I wish to create a script to label the rooms of several files according to a template. The general goal is to have each room in each of the files labelled with a room stamp (Microstation Cell/AutoCAD Block) cointaing information of the rooms. This files I will later convert into DWG files.

    I have created a script to take text files inside polygons in AutoCAD (AutoLISP) and create the room stamps (AutoCAD Blocks with attributes), but for this I need to import the information for each room via labelling as text objects inside the polygons before DWG conversion.

    Once I achieve this I was also thinking about creating the room stamps entirely in BFP to avoid the use of AutoCAD.

    What are your thoughts on this? Am I on the right track? Any help would be much aprecciated.

    Thanks!

  • Hi Federico,

    Labeling tool is always loading labels in _Facilities WorkModel, which is automatically referenced to Default model. So if you would like to get all required labels, then you need to copy them from reference model.

    All this can be automated with mvba script. Even you can use same room stamp cell and move all labels inside this stamp. All Labels can be loaded using required text style in which you can configure justification and add more other settings for your labels. After saving labels inside your model you can use other Macros, which can help you put your stamp cell or move those saved labels to required position.

    AutoCAD, as I understood, is required only for those stamps? If so, then I recommend you to create mvba, which could get all required labels and then place them in your stamp cells. Regarding mvba for labeling and saving we can help you, because my colleague Ken Mills wrote similar one some time ago.

    To test our suggestion you can test below key-in and verify if it is what you are searching.
       bf display label display /C1102,/L1118 - This key in is loading Room labels using ClassID(1102-can be different on your configuration) and AttributeID(1118-can be different on your configuration)
    Further you can move those saved labels inside your stamp. I have seen how our users using MicroStation tools, key-ins and macros where able easily move all labels to their stamp cells.

    One possible key-ins combination:
    Setting Active level to Level1
       LV=Level1
    Fitting view
       fit view extended
    Clearing all labels and other facilities loaded items
       bf command clearalltmpgr
    Opening desing file
       filedesign
    Setting active textstyle
       textstyle active Style1
    Creating new level for Labels
       level create Level1
    Setting active level for labels
       active level BF_Labels_Surface
    Loading Room labels using ClassID(1102) and AttributeID(1118)
       bf display label display /C1102,/L1118
    Merging reference model to design file
       reference merge "_Facilities WorkModel_2D"
    Deleting reference model
       model delete "_Facilities WorkModel_2D"

    You can save this combination to .txt document and then call it using @[...File-Path...]  Key-in


    Or Create Ribbon button.

    Best Regards,
    Kestutis Mitkus

    Application Engineer, Building, Structural & Plant

     

  • Thanks a lot Kestutis, I will go through your explanation. Any idea on how to get the classes' and attributes' ID for the things I want  to label?