cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Diagram generating problem with Participant object

RBalazs
Super Contributor

I would like to write a macro in VB that generates an Organizational Process Diagram (BPMNFLOWCHART) that contains a Participant type of element, and implements a Shape from c:\program files (x86)\mega\mega 2009 sp5\Mega_Std\Pictures.7220\Method\proc_subprocessorg_container.mgs

 

My problem is that by adding a new element to the collection of Element in Diagram of the diagram, it requests the definition of the element type (Participant)

 

Set colDescription = oOrgProcess.GetCollection("Description")

Set oNewDiagram = colDescription.Add("My new diagram")

Set colElement = oNewDiagram.GetCollection("Element in Diagram")

Set oNewParticipant = colElement.Add("My new participant")

 

How can I define the type in this command?

 

The other question is how can I edit the appearance of the objects in a diagram? I've tried another way to insert my objects and in a BPMNFLOWCHART type of diagram the SetPos method doesn't seem to work.

 

Set oNewDiagram = oOrgProcess.GetCollection("Description").Create("Nature", "BPMNFLOWCHART")
oNewDiagram.shortname = "Organizational Process"
Set oDrawing = oNewDiagram.Drawing("RW")
Dim oNewOP
Set oNewOP = oDrawing.MegaObjectInsert(oOrgProcess)
oNewOP.SetPos 1000, 100, 2000, 1000

 

The object doesn't change its size or its position, while in other types of diagrams (e.g. ARBRE-APPLICATIF) it works fine.

 

Thank you.

2 Replies

RBalazs
Super Contributor

Dear Jerome,

 

Thanks for your reply, meanwile we found the solution that works. To obtain the desired appearance we implemented existing style Shapes and by adding the following two lines at the end of our script the SetPos method also worked:

 

oDrawing.Flush

Set oDrawing = Nothing

 

To add a certain type of element we first created the element and then inserted it into the diagram. I attached the code.

jhorber
MEGA
MEGA

Hello RBalazs

 

You should use the function GetType

 

Example

From a collection based upon an abstract MetaClass, get a sub collection for a concrete MetaClass

 

Set cBE = GetCollection("~JW7j6VRt9H40[BPMN Element]")
Print "Number of BPMN Element objects: " & cBE.count()
Set cOP = cBE.GetType("~gsUiU9B5iiR0[Organizational Process]")
Print "Number of Organizational Process objects: " & cOP.count()

 

See MEGA documentation regarding API script functions

 

Note: please create a specific poste for each question

Jerome