🤖 New in SPACE GASS 14.51 — the MCP server lets your AI agent build, analyse and design your models. Get started →
SpaceGass API
Guides

File Handling

The API provides endpoints for managing SPACE GASS .sg project files — opening, saving, closing, and checking file status before operations.

Opening a File

using SpaceGassApi.Models; await client.Job.Open.PostAsync( new OpenJobRequest { FilePath = @"C:\Projects\MyStructure.sg" });

Checking File Status

Before opening a file, you can check its status to determine if it is locked by another process or has unsaved changes:

var status = await client.File.Status.GetAsync(config => config.QueryParameters.FilePath = @"C:\Projects\MyStructure.sg"); // status contains CanOpenSafely, Description, RecommendedAction

Saving

The save endpoint handles both saving to the current path and saving to a new path. Pass a filePath to save as a new file, or omit it to save in place.

// Save to current file await client.Job.Save.PostAsync(new SaveJobRequest()); // Save to a new file path await client.Job.Save.PostAsync( new SaveJobRequest { FilePath = @"C:\Projects\MyStructure_Copy.sg" });

Creating a New Job

await client.Job.New.PostAsync();

Creating a New Job From a Template

Upload a .sgbase template file to seed a new job. The template data is loaded but the new job has no file path — use Job.Save with a FilePath (see Saving) to write it to disk.

The body is a multipart/form-data upload with one part named template. Both SDKs expose a NewFromTemplateRequest you construct from a file path.

using SpaceGassApi; await client.Job.NewFromTemplate.PostAsync( new NewFromTemplateRequest(@"C:\Templates\my-template.sgbase"));

Closing

await client.Job.Close.PostAsync();
Last modified on