Gmsh (Language Support & 3D Interactive Preview)
The definitive Visual Studio Code extension for Gmsh. Features • Getting Started • Configuration • Snippets • 日本語ドキュメント ✨ Features1. 🧠 Comprehensive Gmsh Language Support (IntelliSense)
2. ⚡ Real-Time 3D Geometry & Mesh Preview
🚀 Getting StartedInstallationOption A: Install from GitHub Releases (.vsix)
Option B: Build and Install from Source
Install the resulting Usage
Opening the 3D PreviewChoose any of these methods:
Automatic Gmsh CLI DetectionThe extension automatically searches common system paths,
⚙️ Configuration (
|
| Setting | Type | Default | Description |
|---|---|---|---|
gmsh.executablePath |
string |
"gmsh" |
Path to the Gmsh executable (e.g., gmsh or C:\gmsh\gmsh.exe) |
gmsh.meshDimension |
number |
2 |
Default mesh dimension (0: Geometry, 1: 1D, 2: 2D, 3: 3D) |
gmsh.debounceDelay |
number |
400 |
Delay (ms) after code edits before refreshing the preview |
⌨️ Snippets & Shortcuts
Type the prefix and press Tab or Enter to expand:
| Prefix | Expands To | Description |
|---|---|---|
Point |
Point(1) = {x, y, z, lc}; |
Point primitive |
Line |
Line(1) = {start, end}; |
Line segment |
Circle |
Circle(1) = {start, center, end}; |
Circular arc |
Curve Loop |
Curve Loop(1) = {c1, c2, ...}; |
Closed curve boundary |
Plane Surface |
Plane Surface(1) = {loop1}; |
Planar surface |
Surface Loop |
Surface Loop(1) = {s1, s2, ...}; |
Enclosed surface shell |
Volume |
Volume(1) = {loop1}; |
3D Volume |
Extrude |
Extrude {dx, dy, dz} { ... }; |
Translation extrusion |
Rotate |
Rotate { {ax,ay,az}, {px,py,pz}, angle } { ... } |
Rotation transform |
Box |
Box(1) = {x, y, z, dx, dy, dz}; |
OpenCASCADE 3D box |
Cylinder |
Cylinder(1) = {x, y, z, dx, dy, dz, r}; |
OpenCASCADE cylinder |
Sphere |
Sphere(1) = {x, y, z, r}; |
OpenCASCADE sphere |
BooleanDifference |
BooleanDifference(1) = { ... } { ... }; |
OpenCASCADE Boolean cut |
MeshSize |
MeshSize {points} = size; |
Prescribed element size |
Transfinite Curve |
Transfinite Curve {curves} = n; |
Structured 1D discretization |
For |
For i In {1:10} ... EndFor |
Loop iteration |
If |
If (cond) ... EndIf |
Conditional branch |
Printf |
Printf("value: %g", var); |
Formatted console output |
🇯🇵 日本語
Gmsh のジオメトリスクリプト(.geo)およびメッシュファイル(.msh)に対応した VS Code 拡張機能です。
構文ハイライト・入力補完・スニペット・ホバー解説といった言語サポートと、Three.js を用いたリアルタイム 3D プレビュー・双方向コードジャンプを1つの拡張機能に統合しています。
- IntelliSense 補完:
Point,Circle,Extrude,MeshSize等の主要コマンドおよびファイル内で定義した変数を自動補完。 - ホバー表示: コマンドの上にマウスを置くだけで構文仕様・引数の意味・使用例を表示。
- 3D プレビュー: コード編集時にミリ秒単位で再描画。3D 上の点・線・面をクリックするとコードの該当行へ即座にジャンプ。
- Gmsh 自動検出: お使いの PC 内の
gmsh.exeを自動検出するため、環境変数の事前設定が不要です。
インストール方法(日本語)
- GitHub Releases から最新の
gmsh-preview-0.2.0.vsixをダウンロードします。 - VS Code の拡張機能ビュー(
Ctrl+Shift+X)を開き、右上の「…」メニューから「VSIX からのインストール...」を選択してダウンロードしたファイルを選びます(または VS Code ウィンドウへファイルをドラッグ&ドロップ)。
🛠️ Development & Building
# Clone the repository
git clone https://github.com/Ringo3apples/gmshExtension.git
cd gmshExtension
# Install dependencies
npm install
# Build the extension and Webview bundle
npm run build
# Watch mode for rapid development
npm run watch
# Type-check TypeScript
npm run compile
Press F5 in VS Code to launch the Extension Development Host window for live debugging.
📄 License
This extension is licensed under the MIT License.