locked
Generate Class Diagram RRS feed

  • Question

  • Not sure if this belongs here.

    I want to generate class diagrams using the diagrams i have in VMSDK using T4. However, .cd will creates the .cs files which i don't need. .classdiagrams can only work in a modeling project. Is there any way out ?

     

    Thanks

    Friday, September 30, 2011 11:03 AM

Answers

  • It sounds like you want to be able to create and manipulate instances of another DSL model (your own class diagram implementation), in which case you can achieve this using the Modelbus.

     

    See Integrating Models by using Visual Studio Modelbus, specifically the section entitled "Creating, opening and editing a model"

     

    Regards

    Blair

    • Marked as answer by ZwodahS Friday, October 14, 2011 3:14 AM
    Wednesday, October 12, 2011 10:32 AM

All replies

  • So there is really no way ? =(
    Thursday, October 6, 2011 6:26 AM
  • Sorry for the slow reply.

    UML .classdiagrams can only exist in a modeling project.  .cd diagrams are quite different things - they aren't UML and aren't part of a model.

    If you want to generate UML class diagrams (in a UML modeling project), T4 would be difficult - you would have to create both the model file and the classdiagram file, and the relationship between them is quite complex. It would be better to use the API - see for example How to Create UML Elements and Relationships and its neighbors.

    (If you wanted to generate class diagrams from code, you'd install the VS2010 Feature Pack. But I think that isn't what you want to do.)

    An alternative - and perhaps the simplest case for what you want - is to create your own class diagrams using the VMSDK. One of the starting templates for domain-specific language projects is called "Class Diagrams". The resulting diagram isn't integrated with other UML diagrams, but it looks like a class diagram.

     


    - Alan -MSFT
    Tuesday, October 11, 2011 10:35 AM
  • Hi Alan,

    Thanks for replying. What I have currently is my own diagramming language coded in VMSDK. Using the diagramming language, the user is able to select stuffs and i want to generate a class diagrams based on the stuffs selected by the user. By creating my own class diagrams using vmsdk(I suppose that it is in a different project), how can i "create" such a class diagram from my current language?

    I am thinking of editing the file directly, since most of them are just xml. I can't think of another way to do this.

    Thanks in advance.

     

     

    Wednesday, October 12, 2011 6:39 AM
  • It sounds like you want to be able to create and manipulate instances of another DSL model (your own class diagram implementation), in which case you can achieve this using the Modelbus.

     

    See Integrating Models by using Visual Studio Modelbus, specifically the section entitled "Creating, opening and editing a model"

     

    Regards

    Blair

    • Marked as answer by ZwodahS Friday, October 14, 2011 3:14 AM
    Wednesday, October 12, 2011 10:32 AM
  • if i wish to use .classdiagram, is there an API to using code to generate the diagram ?
    Friday, October 14, 2011 3:14 AM
  • You can only generate a .classdiagram as part of a UML modeling project. Details in How to Create UML Elements and Relationships and its neighboring topics.
    - Alan -MSFT
    Friday, October 14, 2011 9:03 AM
  • Is there a way i can create new diagram using code ?
    Wednesday, October 19, 2011 5:54 AM
  • If you create a .classdiagram outside a UML model, you can't display it; and you can't add it to a model, because the principal information is actually in the .uml and .package files in the model project. So your options are either to create a new DSL that looks like a class diagram, or to use the UML API to add classes and a diagram to a UML model. You could use the EnvDTE API to create a modeling project.


    - Alan -MSFT
    Wednesday, October 19, 2011 10:49 AM
  • As my current project is a VMSDK project , i am thinking of describing the class diagram in the same .dsl. So by not providing any tool in the editor to add those class diagrams, i can hide it from the user. Now i just need the API to to create a new model in my language and add it to the current solution. May i know where i can get resources to such stuffs ?

     

    Thursday, October 20, 2011 9:57 AM
  • Why do you want to create a class diagram but hide it from the user?
    - Alan -MSFT
    Thursday, October 20, 2011 10:31 AM
  • I think i am not clear with what i want to do :P. Here is the detail.

     

    I created a VMSDK project that is use to describe class diagram with variants. So in the diagrams, the user can create say 10 classes. However, i want to be able to generate "concrete" class diagram as output. This means that the user can choose what classes he wants in the output diagram. So what I need is to be able to 

    1) create a class diagram(which can also be defined in my own .dsl project)
    2) create the class in the diagram

    Not sure if i am clear with what i need :P

     

    Thanks alot ! 

    Thursday, October 20, 2011 12:16 PM