MustafaMulla29/rp2040-bldc-motor-controller-new
73×72 mm 4-layer USB‑C PD (5/9/15/20 V) RP2040 controller PCB with protected power switching, MCT8329A sensorless BLDC three-phase MOSFET bridge, USB data/programming, onboard controls, and three motor outputs feeding a 2212 motor through rigid bullet adapters.
- Version
- 0.3.100
- License
- unset
- Stars
- 0
assembly/vendor/core-wire-path.patch
--- a/lib/components/primitive-components/assembly-cable-mating-props.ts
+++ b/lib/components/primitive-components/assembly-cable-mating-props.ts
@@ -25,6 +25,9 @@
export const assemblyCableMatingProps = assemblyCableProps.extend({
fromMatingPoint: assemblyCableMatingPoint.optional(),
toMatingPoint: assemblyCableMatingPoint.optional(),
+ /** Authored wire centreline in circuit-world mm, including both wire exits.
+ * Local extension for restrained harnesses; no automatic collision solving. */
+ wirePath: z.array(point3).min(2).max(4096).optional(),
})
export type AssemblyCableMatingPoint = z.infer<typeof assemblyCableMatingPoint>
export type AssemblyCableMatingPropsInput = z.input<
--- a/lib/components/primitive-components/resolve-assembly-cable.ts
+++ b/lib/components/primitive-components/resolve-assembly-cable.ts
@@ -84,6 +84,20 @@
to.direction,
wireExitDepth(definition.connectorB),
)
+ const authoredPath = cable._parsedProps.wirePath
+ if (authoredPath) {
+ const distance = (a: Point3, b: Point3) => Math.hypot(a.x-b.x,a.y-b.y,a.z-b.z)
+ if (distance(authoredPath[0]!, fromExit) > 0.001 || distance(authoredPath.at(-1)!, toExit) > 0.001)
+ throw new Error(`assembly.cable "${cable.name}" wirePath must terminate at its resolved connector wire exits`)
+ for (let i=1;i<authoredPath.length;i++)
+ if (distance(authoredPath[i-1]!,authoredPath[i]!) < 1e-6)
+ throw new Error(`assembly.cable "${cable.name}" wirePath contains a zero-length segment`)
+ const tangentMatches = (a: Point3,b: Point3,d: BoardDirectionVector) =>
+ ((b.x-a.x)*d.x+(b.y-a.y)*d.y+(b.z-a.z)*d.z)/distance(a,b) > 0.95
+ if (!tangentMatches(authoredPath[0]!,authoredPath[1]!,from.direction) ||
+ !tangentMatches(authoredPath.at(-1)!,authoredPath.at(-2)!,to.direction))
+ throw new Error(`assembly.cable "${cable.name}" wirePath must leave both connectors along their outward directions`)
+ }
return {
name: cable.name!,
from_source_component_id: from.sourceComponentId,
@@ -95,7 +109,7 @@
("pinCount" in definition.connectorA
? `${definition.standard}_pins${definition.connectorA.pinCount}`
: definition.standard),
- path: inferAssemblyCablePath({
+ path: authoredPath ?? inferAssemblyCablePath({
from: fromExit,
to: toExit,
fromDirection: from.direction,