@@ -10,6 +10,10 @@ export const generateFootprintTsx = (
1010 const smtPads = su ( circuitJson ) . pcb_smtpad . list ( )
1111 const silkscreenPaths = su ( circuitJson ) . pcb_silkscreen_path . list ( )
1212 const fabricationNotePaths = su ( circuitJson ) . pcb_fabrication_note_path . list ( )
13+ const fabricationNoteTexts = su ( circuitJson ) . pcb_fabrication_note_text . list ( )
14+ const fabricationNoteRects = su ( circuitJson ) . pcb_fabrication_note_rect . list ( )
15+ const fabricationNoteDimensions =
16+ su ( circuitJson ) . pcb_fabrication_note_dimension . list ( )
1317 const silkscreenTexts = su ( circuitJson ) . pcb_silkscreen_text . list ( )
1418 const pcbCutouts = su ( circuitJson ) . pcb_cutout . list ( )
1519 const noteTexts = su ( circuitJson ) . pcb_note_text . list ( )
@@ -75,10 +79,115 @@ export const generateFootprintTsx = (
7579 if ( "color" in fabPath && fabPath . color !== undefined ) {
7680 attrs . push ( `color="${ fabPath . color } "` )
7781 }
82+ if ( "layer" in fabPath && fabPath . layer === "bottom" ) {
83+ attrs . push ( `layer="bottom"` )
84+ }
7885
7986 elementStrings . push ( `<fabricationnotepath ${ attrs . join ( " " ) } />` )
8087 }
8188
89+ for ( const fabText of fabricationNoteTexts ) {
90+ const anchorPosition = fabText . anchor_position ?? { x : 0 , y : 0 }
91+ const anchorAlignment = fabText . anchor_alignment ?? "center"
92+ const rawText = String ( fabText . text ?? "" )
93+ const escapedText = rawText . replace ( / " / g, '\\"' )
94+
95+ const attrs = [
96+ `pcbX={${ anchorPosition . x } }` ,
97+ `pcbY={${ anchorPosition . y } }` ,
98+ `anchorAlignment="${ anchorAlignment } "` ,
99+ `text="${ escapedText } "` ,
100+ ]
101+
102+ if ( fabText . font !== undefined ) {
103+ attrs . push ( `font="${ fabText . font } "` )
104+ }
105+ if ( fabText . font_size !== undefined ) {
106+ attrs . push ( `fontSize={${ fabText . font_size } }` )
107+ }
108+ if ( fabText . color !== undefined ) {
109+ attrs . push ( `color="${ fabText . color } "` )
110+ }
111+ if ( fabText . layer === "bottom" ) {
112+ attrs . push ( `layer="bottom"` )
113+ }
114+
115+ elementStrings . push ( `<fabricationnotetext ${ attrs . join ( " " ) } />` )
116+ }
117+
118+ for ( const fabRect of fabricationNoteRects ) {
119+ const center = fabRect . center ?? { x : 0 , y : 0 }
120+ const attrs = [
121+ `pcbX={${ center . x } }` ,
122+ `pcbY={${ center . y } }` ,
123+ `width={${ fabRect . width ?? 0 } }` ,
124+ `height={${ fabRect . height ?? 0 } }` ,
125+ ]
126+
127+ if ( fabRect . stroke_width !== undefined ) {
128+ attrs . push ( `strokeWidth={${ fabRect . stroke_width } }` )
129+ }
130+ if ( fabRect . is_filled !== undefined ) {
131+ attrs . push ( `isFilled={${ fabRect . is_filled } }` )
132+ }
133+ if ( fabRect . has_stroke !== undefined ) {
134+ attrs . push ( `hasStroke={${ fabRect . has_stroke } }` )
135+ }
136+ if ( fabRect . is_stroke_dashed !== undefined ) {
137+ attrs . push ( `isStrokeDashed={${ fabRect . is_stroke_dashed } }` )
138+ }
139+ if ( fabRect . color !== undefined ) {
140+ attrs . push ( `color="${ fabRect . color } "` )
141+ }
142+ if ( "corner_radius" in fabRect && fabRect . corner_radius !== undefined ) {
143+ attrs . push ( `cornerRadius={${ fabRect . corner_radius } }` )
144+ }
145+ if ( fabRect . layer === "bottom" ) {
146+ attrs . push ( `layer="bottom"` )
147+ }
148+
149+ elementStrings . push ( `<fabricationnoterect ${ attrs . join ( " " ) } />` )
150+ }
151+
152+ for ( const fabDimension of fabricationNoteDimensions ) {
153+ const fromPoint = fabDimension . from ?? { x : 0 , y : 0 }
154+ const toPoint = fabDimension . to ?? { x : 0 , y : 0 }
155+ const attrs = [
156+ `from={{ x: ${ fromPoint . x } , y: ${ fromPoint . y } }}` ,
157+ `to={{ x: ${ toPoint . x } , y: ${ toPoint . y } }}` ,
158+ ]
159+
160+ if ( fabDimension . text !== undefined ) {
161+ const escapedText = String ( fabDimension . text ) . replace ( / " / g, '\\"' )
162+ attrs . push ( `text="${ escapedText } "` )
163+ }
164+ if ( fabDimension . font !== undefined ) {
165+ attrs . push ( `font="${ fabDimension . font } "` )
166+ }
167+ if ( fabDimension . font_size !== undefined ) {
168+ attrs . push ( `fontSize={${ fabDimension . font_size } }` )
169+ }
170+ if ( fabDimension . color !== undefined ) {
171+ attrs . push ( `color="${ fabDimension . color } "` )
172+ }
173+ if ( fabDimension . arrow_size !== undefined ) {
174+ attrs . push ( `arrowSize={${ fabDimension . arrow_size } }` )
175+ }
176+ if ( fabDimension . offset !== undefined ) {
177+ attrs . push ( `offset={${ fabDimension . offset } }` )
178+ } else if (
179+ "offset_distance" in fabDimension &&
180+ fabDimension . offset_distance !== undefined
181+ ) {
182+ attrs . push ( `offset={${ fabDimension . offset_distance } }` )
183+ }
184+ if ( fabDimension . layer === "bottom" ) {
185+ attrs . push ( `layer="bottom"` )
186+ }
187+
188+ elementStrings . push ( `<fabricationnotedimension ${ attrs . join ( " " ) } />` )
189+ }
190+
82191 // Add silkscreen text elements (use pcbX/pcbY instead of anchorPosition)
83192 for ( const stext of silkscreenTexts ) {
84193 const pcbX = stext . anchor_position ?. x ?? 0
0 commit comments