Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>CGA.js — CGA 编译与3D预览New to Visual Studio Code? Get it now.
CGA.js — CGA 编译与3D预览

CGA.js — CGA 编译与3D预览

CityVistion

|
1 install
| (0) | Free
CGA language support with online compile and interactive 3D preview, powered by cgajs.com.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

CGA.js — CGA 编译与 3D 预览

在 VS Code 里编写 CGA 规则,一键调用 cgajs.com 在线编译,并在编辑器侧边以可交互 3D 视口预览生成的几何。

功能

  • CGA 语言支持:.cga 语法高亮、括号/注释配置、常用代码片段(地块拉伸、楼层切分、立面、参数声明等)
  • 编译并 3D 预览(CGA.js: 编译并3D预览):将当前文件/选区提交 cgajs.com /api/v1/compile,返回 GLB 后在 Webview 中拖动旋转、滚轮缩放查看
  • 在线校验(CGA.js: 校验当前文件):编译错误/警告直接写入「问题」面板并定位到行
  • API Key 安全存储(CGA.js: 设置 API Key):保存在 VS Code Secrets 中,不落明文

使用

  1. 打开或新建 .cga 文件(片段前缀:lotextrude、splitfloors、facade、attrrange)
  2. 首次编译时按提示设置 API Key(cgajs.com 控制台免费申请)
  3. 编辑器右上角或右键菜单执行「CGA.js: 编译并3D预览」

配置

配置 默认 说明
cgajs.endpoint https://www.cgajs.com API 基地址
cgajs.lotSize { "width": 12, "depth": 8 } 预览用初始地块(米)

说明

  • 编译在 cgajs.com 服务端完成,需要网络与有效 API Key(含免费额度)
  • 初始地形为矩形地块(box),尺寸可通过 cgajs.lotSize 调整
  • 姊妹插件:NL2CGA(自然语言生成 CGA)、CityEngine 工具箱(官方案例库与函数速查)

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft