Hi,
I just can’t make this happen
what is the correct syntax ? thre is virtually no doc about this LINE_STYLE enum
center_line.SetLineStyle(pcbnew.LINE_STYLE.DotDash)
thanks for your help
Hi,
I just can’t make this happen
what is the correct syntax ? thre is virtually no doc about this LINE_STYLE enum
center_line.SetLineStyle(pcbnew.LINE_STYLE.DotDash)
thanks for your help
anyone ? it is actually really hard to find the info online
Bumping your own thread in such a short time is not going to motivate people to help you.
This forum automatically keeps track for everyone which threads they have seen, and such a bump is only causing annoyance for people who have already seen your post, but can’t help you with this topic.
ok but why is there so few doc around that python api ??
There is no doc about LINE_STYLE enum because it is not in the API. You should file a feature request on gitlab asking to expose it in the swig api if you need it.
so there is no way to set the line style in python ? I tried with it’s enum value from the cpp code, but it does not want it
it is weird that the function can be used but not the enum that goes with its parameter type
It is quite common in swig generated interfaces like this. If the header containing the enum is not mapped in swig then you will not be able to create the correct python object to pass as a parameter to the function. Swig doesn’t care that it’s an enum and in case of c++ it really is just an int. For wider compatibility it treats everything that is not explicitly a primitive as an object and does it’s own validation.
Best I now, python scripting started on a bit of an ad-hoc bases. There are some serious problems which break scripts between KiCad versions. I guess the priority for scripting is to create a stable interface so scripts don’t have to be debugged / updated in between KiCad versions anymore. But I don’t know how long that will take. Feature requests for small features may get implemented in between.
so is it better to write pluggins in c++ ?
It’s not clear to me just what you want but there is already line style setting in the line’s properties panel… if specifically asking specifically about the API or Script this won’t help
And the Dash/Gap settings for lines can be altered in: Schematic Setup > General > Formatting.
Script acceptability depends upon whether a “dash” or and “underscore” is implemented
in the code and for what purpose in most programming languages.
KiCad also has its own preferential boolean (yes/no) acceptance in its syntax.
I believe ‘BlackCoffee’ explained method is probably the most globally useful.
Thanx to ‘jmk’ too.
PSST! Quick hints for ‘newbies’ …
‘int’ means integer which is a whole number without
a fractional decimal point (e.g. 1, 2 ,4, 100, 1K, etc.)
‘float’ means it is a number with a fractional decimal point (e.g. 1.234)
‘bool’ means boolean which is a yes/no, true/false command
These 3 ‘mousekeeters’ are the ones that throw newcomers off the most!
…and, if intending/hoping to make a Plugin (or, just use Command-Line in the Python console) you can simply use Pythons Find/Replace on the PCB file… (or, in most any Text-Editor)
Video shows making the change (using my App but, that’s not important.) The important thing is changing the Text in the PCB-file so, how you do it is up to you…)
I need to generate a complex grid layout, and some lines are plain some are dashdot
gotta be a script
Shouldn’t be a problem to do that. Each line is a beast unto itself so, whether they are placed manually or by Array or by Script, you can change them as desired and your code (if a well thought-out code) can do the Magic… Play around with the PCB file and some lines and code…
ADDED:
Can make a GUI panel dedicated to making the Grid with inputs as desired. This (below video) shows a GUI, what it does isn’t important, just showing options for coding fun…
sorry I am not following… how is this helping me setting the line style via script ?
I need this, not an option
also is there a way to printout variables ? I tried print, the the python console is really useless in that matter
It is intended to Help by pointing out options to consider as ‘You’ create your Script. In otherwords, you could create GUI with Radio-Buttons and input Fields for Grid Geometry you want, including Line Style.
Yes, I could create a nice script with GUI having input fields for Start/Finish line postions and Styles…etc But, I don’t need the script and doing your work, though could be fun for me, isn’t in my line of thinking how to best Help You Learn. Perhaps others may be willing to do it… It’s pretty simple stuff to do this sort of thing and, if I did do it, there would, no doubt be things you wanted different/added/etc… and would ask for the changes/edits…
For just Line Style change, you create the Script that Edits the PCB-File (using Python’s Search&Replace) or, other Code language…
ADDED: I’ve posted ‘Search and Replace’ code several times on this forum. If you look around you’ll find it and will be able to use it to do as you asked as shown below…
Here is one of my Posts - though it shows editing of Footprint, it will edit any Text file including the PCB-file, so it will be the basis of what you need…
Perhaps this is all you need for accomplishing a goal of Grid with mixed line styles… No script needed
I first drew the two Horiz & Vert lines before making video… and, I didn’t care about spacing…etc
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.