View Issue Details

IDProjectCategoryView StatusLast Update
0003019File formatsGeneralpublic2017-05-11 20:48
ReporterOgnian Assigned Tokeithsloan52  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Summary0003019: implement or fix text() in csg and scad import
DescriptionHello,
first of all thank you for building this wonderful tool.

I'm using the latest 0.17_pre:

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10986 (Git)
Build type: Release
Branch: (detached from a328e1f)
Hash: a328e1fe737a882c8bdb48da1ed30f77cde019f6
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0


I'm having the following error when trying to import an csg file generated from an scad file:


('$fa', '12')
('$fs', '2')
textmsg : text ( text="ESP8266MOD", size = 0.8, spacing = "1", font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
Fontconfig warning: line 144: blank doesn't take any effect anymore. please remove it from your fonts.conf

DXF libraries not found. Trying to download...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/importCSG.py", line 121, in insert
    processcsg(filename)
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/importCSG.py", line 145, in processcsg
    result = parser.parse(f.read())
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/ply/yacc.py", line 971, in parseopt_notrack
    p.callable(pslice)
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/importCSG.py", line 1078, in p_text_action
    p[0] = [processTextCmd(t)]
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/importCSG.py", line 734, in processTextCmd
    face = importDXFface(tmpfilename,None,None)
  File "/Applications/FreeCAD 2.app/Contents/Mod/OpenSCAD/OpenSCAD2Dgeom.py", line 480, in importDXFface
    importDXF.getDXFlibs()
  File "/Applications/FreeCAD 2.app/Contents/Mod/Draft/importDXF.py", line 144, in getDXFlibs
    errorDXFLib(gui)
  File "/Applications/FreeCAD 2.app/Contents/Mod/Draft/importDXF.py", line 113, in errorDXFLib
    reply = QtGui.QMessageBox.question(None,"",message.decode('utf8'),
  File "/Applications/FreeCAD 2.app/Contents/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
<type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\xf6' in position 19: ordinal not in range(128)


looks like text() has some problems
original lines in csg are:

...
group() {
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, 0.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "ESP8266MOD", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, -0.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "AI-THINKER", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, -1.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, -2.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "ISM 2.4GHz", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, -3.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "PA +25dBm", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                            multmatrix([[1, 0, 0, -0.5], [0, 1, 0, -4.5], [0, 0, 1, 1.101], [0, 0, 0, 1]]) {
                                                linear_extrude(height = 0.2, center = true, convexity = 10, scale = [1, 1], $fn = 72, $fa = 12, $fs = 2) {
                                                    text(text = "802.11b/g/n", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);
                                                }
                                            }
                                        }
                                        
...

Direct scad import fails with the same error message too


Any chance this to get fixed?

Thanks
Ognian
Steps To Reproduce1. create new Document
2. import ogi_nodemcu.csg
TagsCSG, OpenSCAD
FreeCAD Information

Activities

Ognian

2017-05-04 08:33

reporter  

ogi_nodemcu.csg (199,711 bytes)

Kunda1

2017-05-04 10:35

administrator   ~0008882

@Ognian best chances to get it fixed faster is to post to the forum first before opening a ticket, as the guidelines state. Please do that from here on out.

CC @keithsloan52

Ognian

2017-05-04 10:43

reporter   ~0008884

Last edited: 2017-05-06 11:04

@Kunda1
Thanks a lot, I will do so from now on.

But just to let you know why I did so, I read this in the forum:
Board index ->Users ->Help on using FreeCAD
the first pinned entry:

Bug submission guidelines
by yorik ยป Sun Dec 29, 2013 9:48 pm
If you think you found a bug in FreeCAD, you can help greatly by reporting that bug to the FreeCAD developers on the FreeCAD bug tracker at http://www.freecadweb.org/tracker/ Bugs reported here on the forum can be easily overlooked or missed by developers, while on the
tracker they are sure to stay in the queue until a developer looks at it.

....

Ognian

keithsloan52

2017-05-04 11:55

developer   ~0008885

I tried this on my freecad-daily and I got a different error. There is a bug in linear_extrude with twist and 2D objects. Its on my list of things to do, but applying for a Msc has to take top priority

Kunda1

2017-05-06 11:14

administrator   ~0008896

@yorik do you mind modifying the language on
Per: https://forum.freecadweb.org/viewtopic.php?f=3&t=5236#p41597


Bug submission guidelines

Ognian
So users quickly understand how to submit bugs the freecad way?

Kunda1

2017-05-07 14:44

administrator   ~0008902

Last edited: 2017-05-07 17:01

@keithsloan52 it's understood. do you mind if I assign this ticket to you in the meantime?

keithsloan52

2017-05-07 17:01

developer   ~0008905

Yes fine to assign to me

yorik

2017-05-08 13:52

administrator   ~0008918

The error reported by the OP is apparently not in openscad but just an encoding issue in importDXF. I now fixed the original issue, @keithsloan52 up to you to decide if you work further on this or if we close it...

keithsloan52

2017-05-08 14:57

developer   ~0008919

When I tried it on freecad-daily I did not get the DXF error but another error to do with linear-extrude. I will investigate further. Hope to find some time later this week.

keithsloan52

2017-05-10 20:06

developer   ~0008945

Apart from the dxf problem which yorik has address the CSG file throws up a problem because of an empty text request see line 192
text(text = "", size = 0.8, spacing = 1, font = "Arial:style=Bold", direction = "ltr", language = "en", halign = "left", valign = "center", $fn = 72, $fa = 12, $fs = 2);

Bypass is not to make text requests with empty string @Ognian

Ognian

2017-05-11 09:02

reporter   ~0008950

@keithsloan52 Thank you for your efforts resolving this issue. I tested yesterday with the latest build on github and indeed the UTF8 error is now away but the extrude error was there. Searching for the empty string ("") an removing it manually from the .csg file worked. COOL. So I hope you will add some check to ignore empty text strings to be extruded. Then importing the actual scad file which in turn includes the library (with the empty string) will also succeed (I hope)...
FYI the scad lib is http://www.thingiverse.com/thing:1933779
Ognian

Kunda1

2017-05-11 11:52

administrator   ~0008952

@keithsloan I guess we could associate the future commit of FreeCAD Pull Request 748 with this ticket even though its named for a non-existent bug in HEAD.

keithsloan52

2017-05-11 12:09

developer   ~0008953

No 748 is for a different bug one that happens with the file below. For this issue I need to add some code to check if linearextrude is trying to extrude a null object ( i.e. Null text ). Problem is what do I return to the object stack? A null object and if so what are the implications for other requests
offsetTest2.scad (222 bytes)

keithsloan52

2017-05-11 14:07

developer   ~0008957

Last edited: 2017-05-11 14:08

Should be fixed in Pull Request 752. Sorry not used to adding fix 0003019 to commit.

Have to be patient for import but does work for Op's file. Saves FreeCAD file is over 7Mb

Kunda1

2017-05-11 20:48

administrator   ~0008963

Thx for all your work on this @keithsloan52 !
Closing ticket

Related Changesets

FreeCAD: master 73f23073

2017-05-08 13:51:04

yorik

Details Diff
Draft: Fixed encoding in importDXF message - issue 0003019 Affected Issues
0003019
mod - src/Mod/Draft/importDXF.py Diff File

FreeCAD: master 1e04f7da

2017-05-11 13:41:27

Keith Sloan


Committer: wmayer Details Diff
Fix for linear_extrude request of null object i.e. null text Affected Issues
0003019
mod - src/Mod/OpenSCAD/importCSG.py Diff File

Issue History

Date Modified Username Field Change
2017-05-04 08:33 Ognian New Issue
2017-05-04 08:33 Ognian File Added: ogi_nodemcu.csg
2017-05-04 10:35 Kunda1 Note Added: 0008882
2017-05-04 10:38 Kunda1 Tag Attached: CSG
2017-05-04 10:40 Kunda1 Tag Attached: OpenSCAD
2017-05-04 10:43 Ognian Note Added: 0008884
2017-05-04 11:55 keithsloan52 Note Added: 0008885
2017-05-06 11:04 Kunda1 Note Edited: 0008884
2017-05-06 11:14 Kunda1 Note Added: 0008896
2017-05-07 14:44 Kunda1 Note Added: 0008902
2017-05-07 17:00 keithsloan52 Note Edited: 0008902
2017-05-07 17:01 keithsloan52 Note Added: 0008905
2017-05-07 17:01 keithsloan52 Note Edited: 0008902
2017-05-07 20:01 Kunda1 Assigned To => keithsloan52
2017-05-07 20:01 Kunda1 Status new => assigned
2017-05-08 13:51 yorik Changeset attached => FreeCAD master 73f23073
2017-05-08 13:52 yorik Note Added: 0008918
2017-05-08 14:57 keithsloan52 Note Added: 0008919
2017-05-10 20:06 keithsloan52 Note Added: 0008945
2017-05-11 09:02 Ognian Note Added: 0008950
2017-05-11 11:52 Kunda1 Note Added: 0008952
2017-05-11 12:09 keithsloan52 File Added: offsetTest2.scad
2017-05-11 12:09 keithsloan52 Note Added: 0008953
2017-05-11 14:07 keithsloan52 Note Added: 0008957
2017-05-11 14:08 keithsloan52 Note Edited: 0008957
2017-05-11 20:45 Kunda1 Changeset attached => FreeCAD master 1e04f7da
2017-05-11 20:48 Kunda1 Status assigned => closed
2017-05-11 20:48 Kunda1 Resolution open => fixed
2017-05-11 20:48 Kunda1 Note Added: 0008963