SYNCHRO Scripts


Table of Contents

Getting Started

To get started, we can explore the model by moving Focus Time through the schedule.
  

You will see 3D Resources to be highlighted based on the on-going activities that they are assigned to. You can also find out: 

  1. The schedule is only a draft which needs improvements for Task Names.


  2. For all concrete tasks, Task UF ~Volume can be created and calculated as the sum of total volume of all assigned Resources. This is because the 3D-Resource-Task relationships are already established, i.e., this is a linked 4D model. 


  3. There are two main types of materials used in this model: steel and concrete.  

Rename Tasks by Concatenation

  1. Create a TXT file > Save your script in it;

    Script can be saved as a TXT file and then opened to be run later.
    TASK SET_PROPERTY (NAME, "Install " + UFV("Category") + " - " + "Level " + UFV("Level"))

    This script renames all the tasks to the concatenated string.  Here are some explanations: 

    The basic format of one line of script is <Object> (Condition) <Command>.
    In this script: 
    • Object: TASK - all tasks in the project; 
    • Command:  SET_PROPERTY (PROPERTY NAME, Value) - Changes all Task Names to the string concatenated with the strings "Install ", " - ", "Level " and task UFV Category, Level. 
  1. Select All Tasks > “Project Control” Ribbon >Script>Browse to open the script file;


    Our usual practice is to select open a saved script. You can edit it in the script window and click “Save” to save your changes. 
  2. Preview to Check > Run
       

    When we go back to the Gantt Chart we can see all the task names have been modified. 

Assign Task UFVs

In this part we would like to calculate the total concrete volume of each task, summarizing the “Volume” User Field of all assigned resources.  

  1. Create a newTXT file> Save your script in it;
    TASK(SELECTED) ASSIGN_UF("Total Volume", FLOAT, SUM(RESOURCE(TYPE==ENUM:MATERIAL).UFV("Volume"))

    This script sums the values of Resource User Field "Volume" for all Resources assigned to the task and assigns it to the Task UF "Total Volume". Here are some explanations:

    The basic format of one line of script is <Object> (Condition) <Command>.
    In this script: 
    • Object:
      TASK/RESOURCE/3D OBJECT - Perform the operation for all tasks that satisfy the conditions; 

    • Condition:
      SELECTED - Returns True if the Task or Resource is selected;
      TYPE==ENUM:MATERIAL - TYPE returns the Resource Type as a number: UNKNOWN = 0, EQUIPMENT=1, HUMAN=2, LOCATION=3, MATERIAL=4; ENUM:MATERIAL returns the Material Resource Type as an integer; 

    • Command:
      TASK/RESOURCE/3D OBJECT.UFV("UserField Name") - Return the value of the specified user field as the appropriate data type (Time, Duration, String, Number, Boolean);
      SUM() - Return the sum of all valid elements from the argument;
      ASSIGN_UF( "UF Name", UF_TYPE, Value) - Assign value for UF if it does not exist when the command is 'running' or change the existing current UFV; 
  1. Select All Tasks>Project Control>Script>Browse to open:
      
  1. Preview to Check > Run;
         

    When we go back to the User Field panel we can see a new User Field “Total Volume” is created under Task UF. We can customize columns to check.
    If you see the following window after you click “Preview” where the “Run” button is greyed out, please go back to the Gantt chart to make sure the tasks that you need are selected. 

 

Setting Resource Appearance Profiles

  1. Create a TXT file save your scriptin it ;

    TASK.ASSIGNMENT (RESOURCE.UFV("Structural Material")>="Concrete" OR RESOURCE.UFV("Type")>="Concrete" OR RESOURCE.UFV("Material")>="Concrete" ) SET_PROPERTY ( PROPERTY("Appearance Profile"), ALL_USE_PROFILE( NAME == "Concrete" ))

    The basic format of one line of script is <Object> (Condition) <Command>.
    In this script: 
    • Object: 
      TASK.ASSIGNMENT - When applied to a Task, returns all the assigned Resources with access to the assignment properties.  

    • Condition:
      RESOURCE.UFV("Structural Material")>="Concrete" OR RESOURCE.UFV("Type")>="Concrete" OR RESOURCE.UFV("Material")>="Concrete";
      >= - returns TRUE if the second string is contained inside of first (Case-senstive);
      OR - Returns TRUE if any (at least one) arguments are true, or FALSE if all arguments are false.
      NAME == "Concrete": == - Returns TRUE if two statements are equal. 

    • Command: 
      TASK/RESOURCE/3D OBJECT.UFV("UserField Name") - Return the value of the specified user field as the appropriate data type (Time, Duration, String, Number, Boolean);
      SET_PROPERTY (PROPERTY NAME, Value) - Changes all (Appearance Profile in this case) properties to the appearance profile that satisfies the conditions you set. 
  1. Create Appearance Profile “Concrete”
    Be aware that if you do not create an appearance profile here, the script will not be run. 
  1. Preview to Check > Run; 
       

 

Resource Statusing

  1. Create status categories, status set and statuses in 4D
    1. To create new categories, go to Navigator -> Resource Statuses; this will open up resource statuses panel
    2. If any resource statuses are already created they will appear in the top window


      In the above screenshot, “Field Status” and “Task Progress” are examples of the status categories. Expanding “Task Progress” will display sub-category and the values.


      The status set is “Task Progress Status” and the statuses are “Not Started”, “Started” and “Completed”

    3. To add a new category, right-click anywhere in the blank space in the top section of the panel and select Add
    4. Then right-click on the category just created and add a status set
    5. Then right-click on the status set and add new status value


      You can rename these to something more meaningful as in the screenshot below.


      Each status can be assigned a color. Go to the bottom panel in the Resource Statuss window to select a color. This color will be applied to all resources assigned the corresponding status when user selects “Resources Statuses” for the color model under 3D view properties.
        

  2. Assign statuses to resources

    Once the statuses are created, you can one one of two things:
    1. Assign a status set to resources – this will assign the status set but will not have any value associated with it
    2. Assign a status to resources – this will assign the a status value to the resource. Following things will happen:
      1. For that resource:
        1. Status value will be recorded
        2. The date when this status became applicable as per the user
        3. The recorded date (that is when the user updated the status)

      2. The above information can be viewed by selecting the resource, then navigating to the “Status” tab in the resource properties panel
      3. If a color is associated with the status then whenever user selects to see the model in resource statuses color mode, the resource will be shown in the color of the latest status assigned to it



      4. Since Synchro 4D keeps a trail of all the statuses associated with a specific resource, user can move the focus line through the timeline to see the model changing colors as per the recorded status date and the status value 

  3. Update status value for a resource
    1. Via manual update in 4D
      To update a status value for a resource, the status set needs to be assigned to the resource. Then, follow these steps:
      1. select the resource, go to Status tab under resource properties panel
      2. select the category and the status set
      3. right-click in the blank space under History and select add – a row with today’s date as the applicable date and a status value (that is not yet assigned to this resource) and a recorded date will be created
      4. change the applicable date and the value to something else if needed; note: the recorded date CANNOT be changed.


    2. Bulk update via spreasheet in 4D
      To bulk update statuses via spreadsheet, you must make sure that the status set have been assigned to the resources that you want to bulk update. Then follow these steps:
      1. Export list of Resources with the ResourceID to Microsoft excel
        1. Go to File -> Export -> Microsoft Excel


        2. Follow the prompts until you see the window with list of all object types; select Export for Resources. Rest can be skipped by selecting the down arrown on the right side of each row under Command column. Then click Export
        3. Select “Yes” to the prompt for unique IDs
        4. Once the data is exported, copy the ResourceID and ResourceName into another excel sheet. Add status information to that sheet. Refer to the screenshot below for the correct template needed to bulk import resource statuses.


        5. An example


        6. Them go to Synchro 4D, and click on File -> Import -> Microsoft Excel
        7. Browse to the excel sheet with the updated status information
        8. Follow the prompts and select “Integrate” option for Resource status


        9. At the end of the update process, a summary is provided


        10. The update can be viewed by selecting the resource, and checking the “status” tab in the resource properties panel


          A few points to note regarding bulk import via spreadsheet:
          • Reimporting without any changes to spreadsheet doesn’t change anything in Synchro 4D
          • Reimporting with only the RecordDate changed updates an existing status row
          • Reimporting with only the StatusDate changed creates a new status row in Synchro 4D 
          • Importing additional statuses on the same Resource needs to have different StatusDate and RecordDate  

  1. Via Synchro Field app
    To input status via the Synchro Field app, refer to the video: Managing Resource Statuses

 

  1. View Status in Synchro Control
    1. Go to construction.bentley.com
    2. After logging in, select the Control project
    3. Go to the Schedule icon
    4. Selete “Status” tab
    5. Select a task or a resource to view the status
      1. Note: status set up in Synchro 4D can ONLY be viewed in Control. To edit the status, use either Synchro 4D or Synchro Field.
         
  1. Updating Task progress from the assigned Resource Statuses

    For projects that track resource status, Project Controls>Recalculate Task Progress can be used to calculate Task % Complete, Actual Start, and Actual Finish from the resource status of resources assigned to the task using a set of user-defined rules.
    1. To add a new rule, right-click in the rules list panel on the left side of the window and select Add to create a new rule and rename the rule as desired
    2. Choose which tasks to process when running the rule
    3. Choose how Tasks with multiple assigned Resources should be handled using Calculate % Complete as
    4. Choose whether Actual Dates should be set from Resources Status dates. When Set Actual Start/Finish dates from Resource Status Dates is enabled, Actual dates will be calculated from Resource Status dates; when disabled, the tool will update only Status and % Complete and Actual dates will be the same as Planned dates
    5. From the list of Resource Statuses in the project, enable a check box next to each Status you wish to include in the rule. Each of the selected Statuses will be added as a new row in the table in the order selected
    6. For each Status Name in the table, enter a % progress to be used in % Complete calculation for all Resources with that current Status
    7. Press Analyze to see the List of Tasks to update the "% complete" and the calculated % progress and calculated Actual Start and Actual Finish dates for each Task. Analyze shows a preview of the values but does not update the Task Properties. If it looks incorrect, modify the rule
    8. Press Run to update the Task Status, % Complete Actual Start and Actual Finish dates.

      Below is an example of task progress calculated using the task progress status resource set. The steps stated above are marked on the screenshot to help with the configuration.


SYNCHRO Scripts (Video)