Skip to content

How load/save a CadDocument to disk using Python API? #771

@asmith26

Description

@asmith26

Hi there, I'm trying to create an MCP server for JupyterCAD for controlling it with natural language.

I'm creating MCP tools by essentially wrapping the JupyterCAD Python API. Unfortunately I can't seem to figure out how to save/serialize any updates to my CadDocument to disk (possibly related #752):

doc = CadDocument("new_design.jcad")
doc.add_box()  # this would be called by the MCP server
doc.save()  # Does a method exist?

I'm also struggling to load an existing design, e.g. if I create a .jcad file through JupyterLab and then try:

doc = CadDocument("existing_design.jcad")  # I thought this would load it 
doc.objects  # Returns and empty list []?

Many thanks for any help! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions