From 0106963ff41ad661d8d4217bcbc5113a044f26e9 Mon Sep 17 00:00:00 2001 From: Rishabh Gupta Date: Fri, 6 Sep 2024 23:59:52 +0530 Subject: [PATCH] added keepout --- lib/transform-soup-elements.ts | 13 +++++++++++-- package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/transform-soup-elements.ts b/lib/transform-soup-elements.ts index 3ff065d..58f7ec8 100644 --- a/lib/transform-soup-elements.ts +++ b/lib/transform-soup-elements.ts @@ -1,10 +1,10 @@ import type { AnySoupElement } from "@tscircuit/soup" +import { type Matrix, applyToPoint, decomposeTSR } from "transformation-matrix" import { directionToVec, rotateDirection, vecToDirection, } from "./direction-to-vec" -import { type Matrix, applyToPoint, decomposeTSR } from "transformation-matrix" export const transformSchematicElement = ( elm: AnySoupElement, @@ -60,7 +60,16 @@ export const transformPCBElement = (elm: AnySoupElement, matrix: Matrix) => { const { x, y } = applyToPoint(matrix, { x: elm.x, y: elm.y }) elm.x = x elm.y = y - } else if ( + } else if (elm.type === "pcb_keepout") { + if(elm.shape === "rect") { + const { x, y } = applyToPoint(matrix, { x: elm.x, y: elm.y }) + elm.x = x + elm.y = y + } else if (elm.shape === "circle") { + elm.center = applyToPoint(matrix, elm.center) + } + } + else if ( elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" ) { diff --git a/package-lock.json b/package-lock.json index 50f2d48..12c03f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@tscircuit/soup-util", - "version": "0.0.20", + "version": "0.0.21", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tscircuit/soup-util", - "version": "0.0.20", + "version": "0.0.21", "license": "ISC", "dependencies": { - "@tscircuit/soup": "0.0.66", + "@tscircuit/soup": "^0.0.66", "parsel-js": "^1.1.2" }, "devDependencies": { diff --git a/package.json b/package.json index d39229d..a0f0a70 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "zod": "^3.23.6" }, "dependencies": { - "@tscircuit/soup": "*", + "@tscircuit/soup": "^0.0.66", "parsel-js": "^1.1.2" } }