kicad importer online help

kicad importer online help used https://kicad-component.tscircuit.com/ imported kicad_mod hit Open on Snippets tried to change some stuff, got lost.
import { createUseComponent } from "@tscircuit/core"
import type { CommonLayoutProps } from "@tscircuit/props"
const pinLabels = undefined as const
interface Props extends CommonLayoutProps {
name: string
}
export const MyComponent = (props: Props) => {
return (
<chip
{...props}
footprint={<footprint>
<platedhole portHints={["1"]} pcbX="0mm" pcbY="0mm" outerDiameter="1.6mm" holeDiameter="1.2mm" shape="circle" />
</footprint>}
/>
)
}
export const useMyComponent = createUseComponent(MyComponent, pinLabels)
import { createUseComponent } from "@tscircuit/core"
import type { CommonLayoutProps } from "@tscircuit/props"
const pinLabels = undefined as const
interface Props extends CommonLayoutProps {
name: string
}
export const MyComponent = (props: Props) => {
return (
<chip
{...props}
footprint={<footprint>
<platedhole portHints={["1"]} pcbX="0mm" pcbY="0mm" outerDiameter="1.6mm" holeDiameter="1.2mm" shape="circle" />
</footprint>}
/>
)
}
export const useMyComponent = createUseComponent(MyComponent, pinLabels)
This is the default output. Do I change something here to give this a unique name like "MediumMachinePinShort" ? I'm also confused about the purpose of const pinLabels = undefined as const Do I do something to define my plated hole as a pin? What is pinLabels, is it for silkscreen helpers for a pin?
No description
No description
57 Replies
Ray Kholodovsky
Ray KholodovskyOP4w ago
Or is this it and I'm good to go?
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
@Seve just to clarify, in my second screenshot, I changed some things, and then got the syntax errors. So this is more my confusion about what I need to do, first.
Seve
Seve4w ago
what's the name of the kicad mod? We'll add a regression test for it
Ray Kholodovsky
Ray KholodovskyOP4w ago
Here is stock output with no changes and I just renamed the package, no problems.
No description
Seve
Seve4w ago
that module is quite old, the new footprint syntax for kicad was just recently merged @Rishabh i wonder if we can put together a doc on it? I can help fix the autocomplete Also CC @DOPΣ kicad mod importing seems a bit borked with old syntax (createUseComponent) etc.
Ray Kholodovsky
Ray KholodovskyOP4w ago
This is one of our internal machine pin footprints, no real secret, just not published anywhere. Attached. Happy to wait. Just trying to put together a quick proof of concept of one of our "molecule" breakout boards
Seve
Seve4w ago
amazing and ty, yes we're 100% committed to getting your stuff to work because it's representative of a common use case- but it sucks that it's kind of slow and painful, thanks for working with us- it'll be as smooth as butter as we move it along
Ray Kholodovsky
Ray KholodovskyOP4w ago
yep all good so just real quick for me to understand, I created the above footprint and saved is as private, now how I can bring it in to an empty tscircuit file, this is all in your web editor
Seve
Seve4w ago
you can import it with @tsci/yourname.projectname one sec...
Ray Kholodovsky
Ray KholodovskyOP4w ago
looking at pico example , think we're on the same page
Seve
Seve4w ago
No description
Seve
Seve4w ago
yea ideally your auto-generated README has the instructions
Ray Kholodovsky
Ray KholodovskyOP4w ago
where is my auto generated README? oooh wow
Seve
Seve4w ago
hehe did you find it
Ray Kholodovsky
Ray KholodovskyOP4w ago
I didn't know clicking on the name brought me to a github equivalent yes now I did You've got your user feedback about things that are non-obvious
Seve
Seve4w ago
haha yes for sure
Ray Kholodovsky
Ray KholodovskyOP4w ago
bug: it didn't update the readme url when I renamed it from untitled-package-0
No description
Seve
Seve4w ago
CC @DOPΣ yea that's a legit bug, we were discussing the other day, you can hit the refresh button at the top right of the README to force it for now i hope that works
Ray Kholodovsky
Ray KholodovskyOP4w ago
it said shortly, still not updated and waiting on that, meanwhile so this was my original question I think: <MyComponent name="U1" /> I didnt' want to call it MyComponent , I wanted to change it to something meaningful like MediumMachinePinShort and I was getting confused on the syntax to change and not get errors.
Seve
Seve4w ago
yea we need a loading indication while the README is updating 🤔 i think if you change the export const MyComponent = to export const MediumMachinePinShort = it SHOULD work
Ray Kholodovsky
Ray KholodovskyOP4w ago
if I change MyComponent to MediumMachinePinShort in the 2 places , I get the red squiggles under pinLabels if I change it as you said, same thing.
No description
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
with your change, error:
No description
Seve
Seve4w ago
i think you can just remove all the lines with pinLabels it shouldn't be undefined, i think it's not finding any pins in your kicad_mod file
Ray Kholodovsky
Ray KholodovskyOP4w ago
it still no like me
No description
Seve
Seve4w ago
yea literally just remove the createUseComponent, then replace MyComponent on line 7 createUseComponent is deprecated we shouldn't be generating code with it because it's more complicated and wasn't usually used correctly
Ray Kholodovsky
Ray KholodovskyOP4w ago
that simple, eh
No description
Seve
Seve4w ago
GitHub
Discord Issues with loading a custom kicad_mod file · Issue #125 ...
https://discord.com/channels/1233487248129921135/1414644835683668119/1414648587912220913 Don&#39;t use createUseComponent Handle undefined pin labels Find the pin within the following kicad_mod (fo...
Seve
Seve4w ago
i noticed that there was a step path within the kicad_mod file which is pretty interesting because it means kicad_mod can't live totally standalone
Ray Kholodovsky
Ray KholodovskyOP4w ago
req: I had unsaved changes and clicked the link to the "github equivalent" without realizing , and lost my several changes. can you throw a warning?
No description
Seve
Seve4w ago
it should be on any page navigation, i'm surprised that happened CC @DOPΣ (also sorry for all the pings @DOPΣ lol) (we might need more FE people hahaha)
Ray Kholodovsky
Ray KholodovskyOP4w ago
yes, the 0 or more step/wrl model(s) are separate from the kicad_mod file, that is the only thing that is not self-sufficient about kicad footprints. The new embedding functionality in v9 changes it but suggest we don't go there rn.
Ray Kholodovsky
Ray KholodovskyOP4w ago
Ok now the AI hath rejiggered the descrip
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
Next problem?
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
nope, it works!
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
Progress!
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
I know I can use a grid instead of the individual coordinates.
So the other day you brought up the templates like import arduino shield. I'd love to just be able to bring in a Adom Molecule Template and define it with our specific design parameters: pinType: MediumPinStandard, MediumPinShort, LargePinStandard xSpacing: 32 ySpacing: 16 (these need to be multiples of 2 or 8 or 32 or something, but that's a separate matter)
Seve
Seve4w ago
yea i have mixed feelings on the template proposal because for this use case it's actually probably easier to release a component like <AdomModuleBoard /> because it'll offer more customization the template strings are basically just to make it really easy for AI to autogen stuff, user modules are wayy more capable
Ray Kholodovsky
Ray KholodovskyOP4w ago
cool, gotcha, yeah I'm game. I assume we'd host it under our account name so we can change it as needed.
Seve
Seve4w ago
(btw i mean you guys would release it not tscircuit haha) yea do you have a spec for it somewhere? I can show you the structure of the module it should be relatively small iiuc
Ray Kholodovsky
Ray KholodovskyOP4w ago
I have a lot of specs for what we're designing! But it may be past the level we need to deal with now for tsci proof of concept 🙂
Seve
Seve4w ago
haha okok i'll make an arduino shield component, that should demonstrate the concept /pattern
Ray Kholodovsky
Ray KholodovskyOP4w ago
rn if I can just define the pinType to use, the x and y spacing, and the "wing size" which is an extra buffer and then the pcb size is determined around that, that's sufficient for now.
DOPΣ
DOPΣ4w ago
did it? i guess backend checks release date to refresh it
Seve
Seve4w ago
@Ray Kholodovsky yea i'm thinking you might want to do <pinheader footprint="pinheader8_p1mm" /> or something, that would be easier than importing kicad_mod for individual pins i'll do a quick arduino shield and show how this could work
DOPΣ
DOPΣ4w ago
like switching links while ediitng?
Seve
Seve4w ago
yea so basically he hit the blue link to go to the View Package page and it didn't prompt him to save
Ray Kholodovsky
Ray KholodovskyOP4w ago
correct, my goal is to just specify which of our 3 types of pins to use and the module handles the using of 4 of that pin under the hood Regarding the step model referenced in the kicad_mod file,
(model "${ADOM_LIBRARY_DIR}/Adom Footprint Library.pretty/3D_Models/MachinePin_Medium_Short.step"
(offset
(xyz 0 0 0)
)
(scale
(xyz 1 1 1)
)
(rotate
(xyz 0 0 0)
)
)
(model "${ADOM_LIBRARY_DIR}/Adom Footprint Library.pretty/3D_Models/MachinePin_Medium_Short.step"
(offset
(xyz 0 0 0)
)
(scale
(xyz 1 1 1)
)
(rotate
(xyz 0 0 0)
)
)
I realize this is a separate matter and it gets complicated. It's not helped by the fact that I'm using an environment variable within KiCad ${ADOM_LIBRARY_DIR} which is how I allow anyone else to use the same library without the path problem of C:\Users\Ray\Documents\GitHub\adom-kicad-library\Adom Footprint Library.pretty vs C:\Users\Seve\adom-kicad-library\Adom Footprint Library.pretty This way you set the variable for the first part of the path for yourself, and then everything after it is the same and anyone can open the same library files with the 3D Models working, etc... Sparkfun does the exact same thing for their library distribution, I learned a year after figuring this out myself 🙂 TLDR is when you import the kicad_mod, can you make sure to capture and save all those elements of the syntax, even if you're not using them just yet?
Later, would need a way to either a) prompt the user to upload a referenced step/ 3d model in a one-off upload to web scenario b) if processing an entire folder/ library git repo, just look for a file of the same name in there and that's probably ok enough. The offset , scale , rotate XYZ vals are not to be ignored. When adding a 3rd party 3D Model to a footprint, they often do not align exactly, and the human engineer (me) spends a lot of time getting the 3D Model aligned exactly to the footprint. <sigh>
Ray Kholodovsky
Ray KholodovskyOP4w ago
Example:
No description
Seve
Seve4w ago
yea we will probably prompt for the step files or something, one thing kicad really messed up with library management is the non-universal file paths/lack of fully-embedded stuff. Obviously these are big files and embedding them is also an issue but we don't want to inherit those problems with typescript/npm in general, there are requirements around importing that enable bundling, so we definitely want to make sure we're always "bundle-able" i'm not 100% sure how we'll make this work rn, but we should be able to find a good solution. even if we just convert the kicad_mod step file import to a regular static import in the typescript file that should be fine
Ray Kholodovsky
Ray KholodovskyOP4w ago
Related: TerminalBlock_WAGO:TerminalBlock_WAGO_2601-3107_1x07_P3.50mm_Vertical is a kicad stock footprint but does not have a 3D Model built yet. KiCad's rules are to define a path/ file name in the footprint for "if this model were to exist in the future" However, the supposedly "correct" way for me to add a 3D Model is to make a copy of the footprint into my own Library and add the 3D Model that way. Ray Library 1:TerminalBlock_WAGO_2601-3107_1x07_P3.50mm_Vertical Remember that the footprints are not linked to each other,, there is no parent/ child inheritance or anything, so if they update that footprint in the future, I wouldn't know or benefit from it.
I was imagining if we could have "kicad library overloading" in tsci: like in the scenario where the footprint 3D Model doesn't exist, if I can just define the same path/ file name in a different location, and tsci could fall back to that instead. Could be in my own userland if you don't want to get into maintaining your own "kicad improvements library" globally. At that point, just contribute the models directly to kicad library and wait 2 months - years
No description
No description
Seve
Seve4w ago
yea i see what you're saying, definitely something to consider as we get those 3d kicad models loading (i think we may have them loading end of day today/tomorrow)
Ray Kholodovsky
Ray KholodovskyOP4w ago
Further related, for the future, since we're on the topic, "how do you become better than kicad" https://discord.com/channels/502708194179809281/502708194179809283/1346056560069181466 https://gitlab.com/kicad/code/kicad/-/issues/12521 This is a much desired feature in KiCad, where again the feature development time is in the range of years-eternity. My simplest example is that I like to render my LED colors, and since I can't parent:child a footprint or footprint:3d-model, I have 5+ identical copies of a footprint just to get a different 3D Model of an LED color into it.
GitLab
Support 1:N links between symbols and footprints/BOM items (meta-fo...
Description There are some situations that are currently difficult to represent in KiCad (or some other EDA tools, for that manner)...
No description
No description
No description
No description
Ray Kholodovsky
Ray KholodovskyOP4w ago
Between our friend's message and the GitLab issue, I believe the various use cases of this functionality are thoroughly covered. "use a footprint inside another footprint" is a separate matter that we've also run into needing and not being able to do in kicad, but that's more custom to us.
Seve
Seve4w ago
ah yea very interesting, yea this is really good to keep in mind. Yes using footprints within footprints should be possible with tscircuit, a lot of stuff comes for free when everything is super automation friendly/in code Also yea different color LEDs shouldn't require separate files...
Ray Kholodovsky
Ray KholodovskyOP4w ago
I know, I'm here for reasons beyond your sparkling personality 🙂
Seve
Seve4w ago
yea you're here after my code livestreaming era hahaha
Ray Kholodovsky
Ray KholodovskyOP4w ago
It can be 2 things! I said 'beyond', not 'other than'

Did you find this page helpful?