Dim objMegaRoot Set objMegaRoot = GetRoot Dim ocOP, oOP Dim objContainerDrawItem Dim oNewParticipant Dim ocEventType, oEventType, oGeneric Dim ocEventNature, oEventNature, oSNature, oENature Dim oNewStart, oNewEnd 'Object drawing Function DiagramDrawObjectAdd(objRoot, objDrawingDiagramDraw, mgObject, left, top, width, height, mgs) Dim objNewDrwItem Set objNewDrwItem = objDrawingDiagramDraw.MegaObjectInsert(mgObject) if mgs <> "" then Dim StrShapeDiagram Dim StrShape StrShapeDiagram = objRoot.CurrentEnvironment.Site.StandardPath &_ "\Pictures.7220\Method\" StrShape = StrShapeDiagram & mgs objNewDrwItem.ItemProperty("ModeOcc_Shape") = StrShape end if 'SetPos left, top, right, bottom objNewDrwItem.SetPos left, top, left + width, top + height Set DiagramDrawObjectAdd = objNewDrwItem End Function 'Organizational Process '--For testing purposes only '--Set oOP = objMegaRoot.GetObjectFromId("...") 'Loop Set ocOP = objMegaRoot.GetSelection("Select [Organizational Process]", "Shortname") For Each oOP in ocOP 'CREATE OP DIAGRAM Set colDescription = oOP.GetCollection("Description") If colDescription.Count = 0 Then Set oNewDiagram = colDescription.Add("My new diagram") oNewDiagram.SetProp("Nature") = "BPMNFLOWCHART" 'Set oNewDiagram = oOrgProcess.GetCollection("Description").Create("Nature", "BPMNFLOWCHART") oNewDiagram.Shortname = "Organizational Process Diagram" Set oDrawing = oNewDiagram.Drawing("RW") 'Add OP to diagram Set objContainerDrawItem = DiagramDrawObjectAdd(objMegaRoot, oDrawing, oOP, 8000, 1000, 22000, 40000, "proc_subprocessorg_container.mgs") 'Add Swimlane to diagram Set vSwimlane = oDrawing.CreateDrawingItem("DrwLanePool", "vertical") vSwimlane.SetPos 12000, 3000, 14000, 7000 'ELEMENT IN DIAGRAM 'Get Event Type Set ocEventType = objMegaRoot.GetSelection("Select [Event Type] Where [Owner Packager].[Name] Like '#MEGA (EN) ::BPMN (EN)#' And [Name] Like '#MEGA (EN) ::BPMN (EN) ::Generic (EN)#'") 'Get Event Nature Set ocStartNature = objMegaRoot.GetSelection("Select [Event Nature] Where [Owner Packager].[Name] Like '#BPMN (EN)#' And [Name] Like '#Start (EN)#'") Set ocEndNature = objMegaRoot.GetSelection("Select [Event Nature] Where [Owner Packager].[Name] Like '#BPMN (EN)#' And [Name] Like '#End (EN)#'") 'Add Participant to diagram Set oParticipant = [Participant].Create("My Participant") 'Add OP as owner Set oNewPOwner = oParticipant.GetCollection("Owner Element").Add(oOP) Set oNewParticipant = DiagramDrawObjectAdd(objMegaRoot, oDrawing, oParticipant, 12000, 3000, 2000, 4000, "Participant.mgs") 'Add Start Event to diagram Set oStart = [Event].Create("My Start") Set oNewSType = oStart.GetCollection("Event Type").Add(ocEventType(1)) Set oNewSNature = oStart.GetCollection("Event Nature").Add(ocStartNature(1)) 'Add OP as owner Set oNewSOwner = oStart.GetCollection("Owner Element").Add(oOP) Set oNewStart = DiagramDrawObjectAdd(objMegaRoot, oDrawing, oStart, 8500, 3000, 50, 50, "bpmn_event_generic_start.mgs") 'Add End Event to diagram Set oEnd = [Event].Create("My End") Set oNewEType = oEnd.GetCollection("Event Type").Add(ocEventType(1)) Set oNewENature = oEnd.GetCollection("Event Nature").Add(ocEndNature(1)) 'Add OP as owner Set oNewEOwner = oEnd.GetCollection("Owner Element").Add(oOP) Set oNewEnd = DiagramDrawObjectAdd(objMegaRoot, oDrawing, oEnd, 29000, 40000, 50, 50, "bpmn_event_generic_end.mgs") oDrawing.Flush Set oDrawing = Nothing End If Next