-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configured CLI to allow 'manual' option for layout. #535
base: master
Are you sure you want to change the base?
Conversation
This places additional boards at specified locations. Also added 'destination' option to layout, to specify the destination of the source board for all layout types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for your proposal. I left some comments regarding the code in the comments. I am mainly concerned with inconsistent UI.
However, to give proper feedback and consider merging this, I need to understand the use of this layout type. What use cases should it cover? KiKit's CLI aims to cover 98% of penalization cases. The rest is designed to be handled either via using plugins or scripting, as we cannot handle all use-cases in the UI without it becoming too cluttered.
Have you tried covering your use case with a Layout plugin? If so, what limitations did the plugin impose?
I am aware that these features could be documented better, and we miss proper examples (#283). Therefore, any effort and PR in this regard are welcomed.
PS: If we agree on merging this, I will require adding documentation and at least basic system tests added.
The application for this is primarily putting multiple different boards into a single panel. I originally wrote a Layout plugin to do this, but thought this is a generic enough task, and found that there was existing demand for this (#242). So I decided to roll it into the CLI. If you are happy with this justification then I will address your concerns above, and then move onto docs and tests. Otherwise I'll close the PR and put a Layout plugin example somewhere for people to find. |
I am willing to merge such a feature. However, we have to find a clean way of UI for this. And I am still trying to figure out what's the right way. One thing I came up with is: Let's always take a single source file. The source file could be either a single board or a board collection. Board collection would be either a path to a JSON file or directly JSON-encoded content that describes board mapping. The structure of the JSON can depend on the layout plugin used. For the manual layout, we could have something like this: [
{
"board": "path/to/board.kicad_pcb",
"source": {
"tolerance": "10mm"
}
"pos": ["100mm", "20mm"]
}
{
"source": "path/to/another/board.kicad_pcb",
"pos": ["100mm", "20mm"]
} The semantics is as follows:
What do you think about this proposal? I think with this feature implemented, we could also support #533. |
That sounds good to me, I'll get onto it hopefully today.
|
define how to source and place a board in the panel.
values.append(Board(value, ["0mm","0mm"])) | ||
else: | ||
json_str = value | ||
s = Section() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Section
object in order to not rewrite the conversion code.
Might be cleaner to move that code out into it's own function?
@@ -138,8 +177,7 @@ def fun(ctx, args, incomplete): | |||
return fun | |||
|
|||
@click.command() | |||
@click.argument("input", type=click.Path(dir_okay=False), | |||
**addCompatibleShellCompletion(pathCompletion(".kicad_pcb"))) | |||
@click.argument("input", type=Input()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure what to do about shell completion
@@ -252,7 +252,7 @@ def buildLayout(preset, panel, sourceBoard, sourceArea): | |||
hbonefirst=layout["hbonefirst"], | |||
vbonefirst=layout["vbonefirst"]) | |||
substrates = panel.makeGrid( | |||
boardfile=sourceBoard, sourceArea=sourceArea, | |||
boardfile=boardList[0].path, sourceArea=sourceArea, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just uses the first board in the list.
Would you rather it error out if there are multiple boards in the list?
Could even make a grid for each board in the list?
@yaqwsx apologies for the bump, didn't mean to ping you. |
What's the next steps for this? I started putting together a similar separate CLI that does the same thing with a different input method: https://github.com/snhobbs/kikit-multipanel. Is it better as a separate tool or integrated into the existing CLI? |
Hi! Andrew put good arguments, so I want this feature to be merged into KiKit. I am postponing merging this, as there two upcoming tasks on KiKit roadmap, that will make this feature more streamlined and better working:
|
Great! Can these be made into issues with a bit of background? I'd love to get into them so this can be officially added in! |
63883b3
to
e0c897b
Compare
This places additional boards at specified locations. Also added 'destination' option to layout, to specify the destination of the source board for all layout types.
New options for the 'manual' option are 'boards' and 'locations'.
Both are lists, and could be changed to a dictionary or other format if that is preferred.
Tested the following:
Let me know if you have any questions, more to come.