| 206 | properties: DocumentProperties = field(default_factory=DocumentProperties) |
| 207 | |
| 208 | def to_json(self) -> str: |
| 209 | data = { |
| 210 | "components": [ |
| 211 | { |
| 212 | "symbol_name": c.symbol_name, |
| 213 | "instance_id": c.instance_id, |
| 214 | "x": c.x, |
| 215 | "y": c.y, |
| 216 | "rotation": c.rotation, |
| 217 | "h_flip": c.h_flip, |
| 218 | "v_flip": c.v_flip, |
| 219 | "params": c.params, |
| 220 | "model": c.model, |
| 221 | "refs": c.refs, |
| 222 | "prop_display": c.prop_display, |
| 223 | "prop_offsets": c.prop_offsets, |
| 224 | } |
| 225 | for c in self.components |
| 226 | ], |
| 227 | "wires": [ |
| 228 | { |
| 229 | "points": list(w.points), |
| 230 | "net_name": w.net_name, |
| 231 | "display_name": w.display_name, |
| 232 | "label_offset": list(w.label_offset), |
| 233 | "net_locked": w.net_locked, |
| 234 | "user_net_name": w.user_net_name, |
| 235 | } |
| 236 | for w in self.wires |
| 237 | ], |
| 238 | "junctions": [ |
| 239 | {"x": j.x, "y": j.y} |
| 240 | for j in self.junctions |
| 241 | ], |
| 242 | "free_texts": [ |
| 243 | {"x": t.x, "y": t.y, "text": t.text} |
| 244 | for t in self.free_texts |
| 245 | ], |
| 246 | "hyperlinks": [ |
| 247 | {"x": h.x, "y": h.y, "url": h.url, "label": h.label} |
| 248 | for h in self.hyperlinks |
| 249 | ], |
| 250 | "commands": [ |
| 251 | {"x": c.x, "y": c.y, "text": c.text} |
| 252 | for c in self.commands |
| 253 | ], |
| 254 | "libs": [ |
| 255 | { |
| 256 | "x": l.x, "y": l.y, "file_path": l.file_path, |
| 257 | "directive": l.directive, "simulator": l.simulator, |
| 258 | "corner": l.corner, |
| 259 | } |
| 260 | for l in self.libs |
| 261 | ], |
| 262 | "images": [ |
| 263 | { |
| 264 | "x": i.x, "y": i.y, |
| 265 | "file_path": i.file_path, |