jacekd's picture

Dear Community,
I'm trying to copy LaneAttributeModellingProperties from one lane to another, but after execution of the code listed below, error message appears: "Error during script execution: Lane.setLaneAttributeModellingProperties", with no further explanation.

What is wrong here? Unfortunately there is almost no documentation on setting LaneAttributeModellingProperties and time dependant models. (ARIS 7.2).

<code>

function main(){
    
    var locale = Context.getSelectedLanguage();
    var database = ArisData.getActiveDatabase();
    var template_model_GUID = "9d63eb10-****-11e7-576e-0a0027000000";
    var newModel_group_GUID = "731b9760-****-11e7-576e-0a0027000000";
    var template_model = database.FindGUID(template_model_GUID);
    var template_lane = template_model.GetLanes(Constants.LANE_VERTICAL)[0];
    var template_laneProperties = template_lane.getLaneAttributeModellingProperties();

    //create new model
    var group = database.FindGUID(newModel_group_GUID);
    var newModel = group.CreateModel(Constants.MT_PROJECT_SCHEDULE, "Roadmap", locale);
    
    //delete any horizontal or vertical lanes in the new model (because they are created automatically in previous step)
    var horizontalLanes = newModel.GetLanes(Constants.LANE_HORIZONTAL);
    for (var h in horizontalLanes){
        newModel.deleteLane(horizontalLanes[h]);
    }
    var verticalLanes = newModel.GetLanes(Constants.LANE_VERTICAL);
    for (var v in verticalLanes){
        newModel.deleteLane(verticalLanes[v]);
    }
    
    //create single new lane and setLaneAttributeModellingProperties
    var newLane = newModel.createLane(9999,Constants.LANE_VERTICAL);
    newLane.setLaneAttributeModellingProperties(template_laneProperties,true);
}

main();

</code>

Greetings,
Jacek

Tags: ARIS script