MitjaNemec / Kicad_action_plugins

Kicad action plugins
413 stars 62 forks source link

Not copyng module (improve error message) #42

Closed hildogjr closed 5 years ago

hildogjr commented 5 years ago

I am using the last KiCad NIgthly on Ubuntu 16 and constantly getting the message: "More or less than 1 module selected. Please select exactly one module and run the script again.".

Screenshot from 2019-04-10 09-55-38

As far I know, I selected exactly the necessary one instance of the module. So, I don't known if it is a version compatibility error.

Could this message be improved to give me some tip about (each components are missing or were selected in excess).

I am also having the same error with the PCB examples.

MitjaNemec commented 5 years ago

From the screenshot I see that you selected all the modules in one sheet. You have to select only one module in the sheet.

The confusion comes from the KiCad nomenclatrue where module means footprint. So you have to select only one footprint in the sheet. Keep in mind that you have to place the corresponding footprints in other sheet to desired final position.

I'll have to adjust the UI language as it seems that KiCad asimilated the common industry terms.

On 10 April 2019 14:59:36 CEST, "Hildo Guillardi Júnior" notifications@github.com wrote:

I am using the last KiCad NIgthly on Ubuntu 16 and constantly getting the message: "More or less than 1 module selected. Please select exactly one module and run the script again.".

Screenshot from 2019-04-10
09-55-38

As far I know, I selected exactly the necessary one instance of the module. So, I don't known if it is a version compatibility error.

Could this message be improved to give me some tip about (each components are missing or were selected in excess).

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/MitjaNemec/Kicad_action_plugins/issues/42

hildogjr commented 5 years ago

I pick just one element/part/footprint, I am getting:

Screenshot from 2019-04-10 11-06-12

MitjaNemec commented 5 years ago

You opened a .kicad_pcb file which does not have a corresponding .sch file. If you open multiple_hierarchy.kicad_pcb it should work.

I'll have to handle this error in a sane way though

On 10 April 2019 16:09:25 CEST, "Hildo Guillardi Júnior" notifications@github.com wrote:

I pick just one element/part/footprint, I am getting:

Screenshot from 2019-04-10
11-06-12

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/MitjaNemec/Kicad_action_plugins/issues/42#issuecomment-481706879

hildogjr commented 5 years ago

In my personal project appear to be some string space-split. Check the image:

Screenshot from 2019-04-10 12-02-20

MitjaNemec commented 5 years ago

Can you send me the .log file which should be in the project folder. I'll try to fix this today or tomorrow.

hildogjr commented 5 years ago

I found:

04-10 12:20:43 replicate_layout.action_replicate_layout 122:Replicate layout plugin version: 11 started
04-10 12:20:48 replicate_layout.action_replicate_layout 122:Replicate layout plugin version: 11 started
04-10 12:20:48 replicate_layout.action_replicate_layout 153:Preparing replicator with CNN201 as a reference
04-10 12:20:48 replicate_layout.replicatelayout 189:getting project hierarchy from schematics
hildogjr commented 5 years ago

I found the source of the issue: adding logger.info('TEST1 -> {}'.format(filename)) #TODO I have a log:

04-10 12:27:31 replicate_layout.action_replicate_layout 122:Replicate layout plugin version: 11 started
04-10 12:27:31 replicate_layout.action_replicate_layout 153:Preparing replicator with CNN201 as a reference
04-10 12:27:31 replicate_layout.replicatelayout 190:getting project hierarchy from schematics
04-10 12:27:31 replicate_layout.replicatelayout 191:TEST1 -> /home/h/Documents/UNICAMP/LabREI/Projeto painel/Boards/Analog conditioning.sch
04-10 12:27:31 replicate_layout.replicatelayout 98:TEST1 -> /home/h/Documents/UNICAMP/LabREI/Projeto painel/Boards/Analog conditioning.sch
04-10 12:27:31 replicate_layout.replicatelayout 98:TEST1 -> /home/h/Documents/UNICAMP/LabREI/Projeto painel/Boards/Analog

The input of extract_subsheets(filename)in class Replicatoris correct but yield file_path, subsheet_id, subsheet_name return:

04-10 12:33:29 replicate_layout.replicatelayout 157:TEST1 -> `/home/h/Documents/UNICAMP/LabREI/Projeto painel/Boards/Analog` `5C9F82F2` `Antialiasing & signal conditioning 0`.

Hence, space is allowed at folder path but not in file name until now.

hildogjr commented 5 years ago

In this function the "F1" line search return:

['$Sheet', 'S 3300 900  1350 900 ', 'U 5C9F82F2', 'F0 "Antialiasing & signal conditioning 0" 50', 'F1 "Analog conditioning - antialiasing.sch" 50', 'F2 "outA+" O R 4650 1000 50 ', 'F3 "outA-" O R 4650 1100 50 ', 'F4 "outB+" O R 4650 1200 50 ', 'F5 "outB-" O R 4650 1300 50 ', 'F6 "outC+" O R 4650 1400 50 ', 'F7 "outC-" O R 4650 1500 50 ', 'F8 "outD+" O R 4650 1600 50 ', 'F9 "outD-" O R 4650 1700 50 ', '']

An you break it at the space subsheet_path = line.split()[1].rstrip("\"").lstrip("\"").

I replace that line by subsheet_path = re.findall("\s\"(.*.sch)\"\s", line)[0] and now works good.

MitjaNemec commented 5 years ago

Thanks for spotting, reporting and fixing the bug. I should have fixed it a week ago when I dealt with the handling of space in schematics name (5-6 lines higher)