Skip to content
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

better 3d model path handling and add support for named variables for… #177

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

the-this-pointer
Copy link

… path

instead of using 4 text boxes to define path alternatives, now we have a multi-line text area which user can add any number of paths, each path in one line, and also user can define a named path with the format NAMED_PATH@PATH_VALUE that results better handling of KiCad style path variables.

… path

instead of using 4 text boxes to define path alternatives, now we have a multi-line text area which user can add any number of paths, each path in one line,
and also user can define a named path with the format NAMED_PATH@PATH_VALUE that results better handling of KiCad style path variables.
@the-this-pointer
Copy link
Author

The scenario that user updates this mod from previous versions is not considered yet, I should take care of importing alternate paths 1 to 4 to the new path model if their values are present in preferences.

@s-ol
Copy link

s-ol commented Aug 31, 2023

+1, this sounds like a much better way of handling this and exactly what I need. Unfortunately the UI doesn't seem to be working for me:

image

@the-this-pointer
Copy link
Author

the-this-pointer commented Aug 31, 2023

It's strange. Thank you for letting me know.
I'm just asking to be sure, Are you sure that 4 text boxes are not enough to add the library paths? If you have less than 4 paths, you can simply add these paths in the preferences without making this change, and KiCad Stepup will handle this correctly as I've seen it in the source code.

I will look at this in the future days, but if you are in a hurry, you can do the following for now.

Make sure you can see the textbox in the "Addon Manager" preferences, like below:

image

If you can see it, I think it might be an issue in layout or component position after adding the text area.
You can just edit the position in ksu_prefs.ui (located in Resources/ui) line 105.
If everything goes well you should see something like this:

image

@s-ol
Copy link

s-ol commented Aug 31, 2023

I've worked around this by setting the values directly in ~/.FreeCAD/user.cfg:

...
          <FCParamGroup Name="kicadStepUpGui">
...
            <FCText Name="3d_model_paths" Value="KICAD7_3DMODEL_DIR@/usr/share/kicad/3dmodels/&#10&#10LOCAL_LIB_DIR@${KIPRJMOD}/lib/local"/>
....

As you can see, I'd like to use recursive variable expansion the way KiCad does; for this I moved the "extra local ${ENV} 3D path" block up before line 4415 and as a separate if block (not chained with elseif). That works for my specific case, but really this whole section should be rewritten properly to deal with any number of (recursive) variables in any order.

@s-ol
Copy link

s-ol commented Aug 31, 2023

Make sure you can see the textbox in the "Addon Manager" preferences, like below:

I'm on the "FreeCAD Link Branch" (LinkStage3), version 2022.111 and that whole menu isn't in the settings, but there is a textarea like this in the options of the addon manager itself:
image

I'm wondering if my installation method is maybe the cause, basically I just installed the "vanilla" ksu version via the addon manager and then pulled your branch in the git repository .FreeCAD/Mod/kicadStepUpMod which seemed to work - but maybe there are some other steps the addon manager does that I missed?

EDIT: I tried the same thing on Windows with a Fresh FreeCAD install from the main branch and the UI works there.

@ckuhlmann
Copy link

ckuhlmann commented Jan 27, 2024

I was about to suggest a similar change, but maybe this enhancement should be bundled in this PR.
My changes so far are here:
#206

I modified StepUp to read KiCad's kicad_common.json file, so that I don't have to enter or update the paths and just need to provide the path to the KiCad config directory.
This could be used to auto fill and auto update the preferences from this PR.
Please note that to support older versions of KiCad than 6.0, additional enhancements might be required. Also, I have not not tested these changes with KiCad 8 yet. Also, the GUI changes I made were done by just editing the xml, so some fields overlap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants