FS#2312Draw from CSV can not create Layers with NewLayer
- Type
- Bug
- Status
- Closed
- Resolution
- Fixed
- Category
- QCAD Community Edition
- Severity
- Low
- Priority
- Low
- Reported version
- 3.26.4
- Operating system
- Linux (All / Other)
- Reported
- 2021-11-17 by zem
- Closed
- 2021-12-03 by andrew
NewLayer always complains about a missing parent layer.
I could not figure out how to create Layers from a CSV file,
I tried DrawCSV_Layer_test.csv which is a reference test from the qcad repo but NewLayer always returns "Parent layer doesn't exist."
Reading from file: /home/zem/DrawCSV_Layer_test.csv
Switched to semicolon/comma CSV style.
Layer doesn't exist, ignored. Text line 20 layer: 0 Entity Colors
Not a correct layer name. Text line 24 name: Invalid=`name`
Add/Update layer ignored.
Not a correct color. Text line 25 color: ByBlock
Add/Update layer ignored.
Not a correct Lineweight. Text line 26 weight: 999
Add/Update layer ignored.
Not a correct Linetype. Text line 27 type: Orange line
Add/Update layer ignored.
Parent layer doesn't exist. Text line 31 layer: MyLayerInvalid paren
Add/Update layer ignored.
Can not hide layer, ignored. Text line 34 layer: Invalid Hide
Can not freeze layer, ignored. Text line 35 layer: Invalid FreezeInvalid SUB
Can not lock layer, ignored. Text line 36 layer: Invalid Lock
Can not lock layer, ignored. Text line 37 layer: Invalid=`name`
Can not allow layer, ignored. Text line 38 layer: Invalid Allow
Can not switch to layer, ignored. Text line 39 layer: Invalid layer switch
Can not switch to layer, ignored. Text line 40 layer: Invalid=`name`
Parent layer doesn't exist. Text line 43 layer: 01 Gree
Add/Update layer ignored.
Parent layer doesn't exist. Text line 44 layer: 02 Parent
Add/Update layer ignored.
Parent layer doesn't exist. Text line 45 layer: 02 Parent1Sub
Add/Update layer ignored.
Parent layer doesn't exist. Text line 46 layer: 02 Parent1Sub1SubSub1
Add/Update layer ignored.
Parent layer doesn't exist. Text line 47 layer: 03 Parent
Add/Update layer ignored.
Parent layer doesn't exist. Text line 48 layer: 03 Parent2Sub
Add/Update layer ignored.
Parent layer doesn't exist. Text line 49 layer: 03 Parent2Sub2SubSub
Add/Update layer ignored.
Parent layer doesn't exist. Text line 50 layer: 04 Parent
Add/Update layer ignored.
Parent layer doesn't exist. Text line 51 layer: 04 Parent3Sub
Add/Update layer ignored.
Parent layer doesn't exist. Text line 52 layer: 04 Parent3Sub3SubSub
Add/Update layer ignored.
Parent layer doesn't exist. Text line 53 layer: Last New &Curren
Add/Update layer ignored.
Can not hide layer, ignored. Text line 56 layer: 03 Parent2
Can not freeze layer, ignored. Text line 57 layer: 03 Parent2Sub2
Can not lock layer, ignored. Text line 58 layer: 03 Parent2Sub2SubSub2
Can not hide layer, ignored. Text line 60 layer: 04 Parent3
Can not freeze layer, ignored. Text line 61 layer: 04 Parent3
Can not lock layer, ignored. Text line 62 layer: 04 Parent3
Can not hide layer, ignored. Text line 63 layer: 04 Parent3Sub3
Can not freeze layer, ignored. Text line 64 layer: 04 Parent3Sub3
Can not lock layer, ignored. Text line 65 layer: 04 Parent3Sub3
Can not hide layer, ignored. Text line 66 layer: 04 Parent3Sub3SubSub3
Can not freeze layer, ignored. Text line 67 layer: 04 Parent3Sub3SubSub3
Can not lock layer, ignored. Text line 68 layer: 04 Parent3Sub3SubSub3
Can not allow layer, ignored. Text line 70 layer: 04 Parent3
Can not switch to layer, ignored. Text line 76 layer: 02 Parent1Sub1SubSub1 %
Layer doesn't exist, ignored. Text line 82 layer: 02 Parent1
Can not switch to layer, ignored. Text line 85 layer: 02 Parent1Sub1SubSub1 %
Casted entries : 4 with 90 text lines
Importing CSV complete. Command ended.
No layers are added in the resulting drawing.
OS here is fedora 34 and qcad is either from fedora or rpmfusion.
Comments (4)
I have looked into it for a bit, to me it looks like in:
src/core/RLayerProxy.h line 38:
virtual QString getHierarchySeparator() = 0;
This returns an empty string as hierarchy separator. And I think DrawFromCSV.js at line 1641 is not prepared to deal with an empty string here.
How are those Layer Parents working anyway? Schould I we get rid of that parent code in DraqFromCSV.js alltogether or is it better to fix up parent handling if we get an empty separator string?
I prepared a hotfix which is not complete as the Test still does not run completely. However it fixes up the NewLayer command well enough to be able to add new layers which is what I need to continue on my project.
zem,
I have run the test again and it works fine over here.
In total 11 layers were added.
It is normal that you get 18 warnings in red.
Those faults are intentionally in the test CSV file.
At CSV line 43 it starts to go wrong!?
There a layer '01 Green' should be added.
I read in your report '01 Gree'.
Same for the next CSV line: '02 Parent1' vs '02 Parent'.
And so on.
RLayer.getHierarchySeparator() should return 3 dots + spaces aka ' ... '
One can verify that in the script shell:
- type the shortcut 'GE' to start the shell.
- confirm and then paste the next code:
You can always reach me in direct by a personal message (PM) on the forum ... ;-)
Regards,
CVH
Andrew,
zem,
Should be fixed with the update 3.04
https://qcad.org/rsforum/viewtopic.php?f=30&t=8135#p35383
Regards,
CVH