# How to create an auxiliary view of a Model Element using the API?

**URL:** <https://forums.visual-paradigm.com/t/how-to-create-an-auxiliary-view-of-a-model-element-using-the-api/18475>\
**Category:** Plug-in & Open API\
**Created:** [March 27, 2024, 12:34am UTC](https://forums.visual-paradigm.com/t/how-to-create-an-auxiliary-view-of-a-model-element-using-the-api/18475 "2024-03-27T00:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabrielG](https://forums.visual-paradigm.com/user_avatar/forums.visual-paradigm.com/gabrielg/32/6584_2.png) [@GabrielG](https://forums.visual-paradigm.com/u/GabrielG)\
**Post date:** [March 27, 2024, 12:34am UTC](https://forums.visual-paradigm.com/t/how-to-create-an-auxiliary-view-of-a-model-element-using-the-api/18475/1 "2024-03-27T00:34:45Z")

</div>

Hi, I’m developing a plug-in and for a specific functionality I need to get an existing Model Element and create an auxiliary view in a specific diagram using the API methods, but I’m struggling to do that.  
One way of doing this on VP is by opening Model Explorer, right-click a Model Element \> Create View in Active Diagram.  
I tried to use the createDiagramElement() method from IDiagramUIModel and then change the name of the element to the same as the one I wanna replicate, but it didn’t work. I also tried to use addDiagramElement(), but I would need to pass the auxiliary view as an argument, and I just have the master view. Is there a method that creates an auxiliary view by passing the master view?  
Or is there any other way to solve this problem?

---

<div class="post-metadata">

**Author:** ![andreass](https://avatars.discourse-cdn.com/v2/letter/a/f17d59/32.png) [@andreass](https://forums.visual-paradigm.com/u/andreass)\
**Post date:** [March 27, 2024, 9:08am UTC](https://forums.visual-paradigm.com/t/how-to-create-an-auxiliary-view-of-a-model-element-using-the-api/18475/2 "2024-03-27T09:08:21Z")

</div>

Hi. You need to method createDiagramElement(IDiagramUIModel d,IModelElement m) in the DiagramManager Class. if IDiagramElement master is the Masterview you can create an auxilary view in IDiagramUIModel dia with the following code:  
IDiagramElement aux=DiagramManager.instance().createDiagramElement(dia,master.getModelElement());
