ZCAD File Format

Is the ZCAD file format fully shattered? i.e. Separate files for each part and assembly, like most CAD file formats, e.g. Solidworks .sldprt & .sldasm.

Hi raffdp, no, the zcad file is like a step file. It includes everything, however when we load a zcad file, we attach it to a tree. The scene tree can be of any complexity and could be generated from some kind of assembly file. Then zcad files loaded into it for each part. I have seen this done already, where the zcad was used only as a ‘sldprt’ file and the assembly was built from a json file.

So the question is how you would get the ability to build a bigger CAD assembly from many zcad part files.

  • Would you like to load a .sldasm/CATProduct/step and export one assembly file(json) and for each part export a zcad?

We could certainly look at exporting a assembly json + part zcad files while processing a large CAD assembly.

Putting this here as a reference

JT (visualization format) - Wikipedia

You can build a custom tree structure that loads zcad files for each part. ``

const model = new TreeItem("Model")
const assembly = new CADAssembly("Assembly")
model.addChild(assembly)

const part0 = new CADAsset("Part0")
part0.load('./data/part0.zcad')
assembly.addChild(part0)

const part1 = new CADAsset("Part1")
part1.load('./data/part1.zcad')
assembly.addChild(part1)

So defining your own JSON structure which loads an assembly is quite easy. You could define a JSON strutre like this.

{
   root: {
      type: 'TreeItem'
      name: 'Root'
      children: [
         {  
            type: 'CADAsset'
            name: 'Part0',
            url: '...'
         }
         {  
            type: 'CADAsset'
            name: 'Part1',
            url: '...'
         }
      ]
}

Then parse this data structure and build the assembly. There are a few things you can do. If a part is referenced multiple times, you can simply clone an existing part. This actually causes all the geometries to be instanced automatically.

So while the zcad file is opaque, when loaded it simply builds a tree that you can then inspect. You can also build a tree yourself and add CADAssets into the tree for each part.

One improvement we have started working on is that ability for zcad files to reference each other, allowing a root assembly zcad file to load a collection of smaller ‘part’ files to build a single tree. We hope to have this update published within the next few weeks.