使用PlantUml VSCode 快速生成UML

1.PlantUML

https://plantuml.com/zh/

一个UML的DSL语言, 网站有快速的显示地方, 语法也很简单. 

https://plantuml.com/zh/running

有各种工具 

目前推荐VS Code打开 

 

2.GraphViz 

绘图的

http://www.graphviz.org/Download_windows.php

需要设置一个路径 

GRAPHVIZ_DOT

xxx\Graphviz\bin\dot.exe

 

3.VSCode 需要安装两个插件: PlantUML 和 Graphviz Preview

点击 VSCode 左下角齿轮按钮进入设置,在用户设置脚本中添加 "graphviz-preview.dotPath": "D:/program files/Graphviz/bin/dot.exe" 并保存设置:

 

到这里如果你是想在VSCode 里面想自己写PlantUML,  预览, 导出都是可以的.

 

之后的是c# 自动导出的.

4.netCore 3.0

下面的工具需要用到这个, 

https://dotnet.microsoft.com/download/dotnet-core/3.0

5. c#代码生成UML 

https://github.com/pierre3/PlantUmlClassDiagramGenerator

windows 命令行中安装

dotnet tool install --global PlantUmlClassDiagramGenerator --version 1.2.0

之后就可以通过命令来吧C#代码生成plantUML

 

puml-gen InputPath [OutputPath] [-dir] [-public | -ignore IgnoreAccessibilities] [-excludePaths ExcludePathList] [-createAssociation]
  • InputPath: (Required) Sets a input source file or directory name.
  • OutputPath: (Optional) Sets a output file or directory name.
    If you omit this option, plantuml files are outputted to same directory as the input files.
  • -dir: (Optional) Specify when InputPath and OutputPath are directory names.
  • -public: (Optional) If specified, only public accessibility members are output.
  • -ignore: (Optional) Specify the accessibility of members to ignore, with a comma separated list.
  • -excludePaths: (Optional) Specify the exclude file and directory.
    Specifies a relative path from the "InputPath", with a comma separated list.
  • -createAssociation: (Optional) Create object associations from references of fields and properites.
  • -allInOne: (Optional) Only if -dir is set: copy the output of all diagrams to file include.puml (this allows a PlanUMLServer to render it).

examples

puml-gen C:\Source\App1\ClassA.cs -public
puml-gen C:\Source\App1 C:\PlantUml\App1 -dir -ignore Private,Protected -createAssociation -allInOne
puml-gen C:\Source\App1 C:\PlantUml\App1 -dir -excludePaths bin,obj,Properties

现在就可以很方便的使用啦.

 

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值