boltsparts / BOLTS_archive

BOLTS is a open library of technical specifications
GNU General Public License v3.0
266 stars 54 forks source link

Remove dict comprehensions #60

Closed jreinhardt closed 10 years ago

jreinhardt commented 10 years ago

at least from blt_parser and widget. To ensure compatibility with python 2.6

KeithSloan commented 10 years ago

As requested

a = {k:[] for k in [1,2,3]} File "", line 1 a = {k:[] for k in [1,2,3]} ^ SyntaxError: invalid syntax

KeithSloan commented 10 years ago

Has not cut and pasted very well the ^ above SyntaxError points to r or for.

jreinhardt commented 10 years ago

Hi, can you try the most recent development snapshot from the BOLTS page: http://jreinhardt.github.io/BOLTS/downloads.html

I removed all the dict comprehensions I could find, but there could be more problems lurking.

KeithSloan commented 10 years ago

Hi

I downloaded and extracted to my FreeCAD macro directory. It created a subdirectory called BOLTS.

When I try and run I get

Traceback (most recent call last):

File "/media/Drive D/Shared/FreeCAD/testmacros/start_bolts.FCMacro", line 1, in

import BOLTS

<type 'exceptions.ImportError'>: No module named BOLTS

and the same if I type import BOLTS in the python window, thought it got further last time. Is it something I have done wrong?

Keith

On 10/11/13 10:14, jreinhardt wrote:

Hi, can you try the most recent development snapshot from the BOLTS page: http://jreinhardt.github.io/BOLTS/downloads.html

I removed all the dict comprehensions I could find, but there could be more problems lurking.

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28147601.

KeithSloan commented 10 years ago

Whoops just seen I should have tried development version.

I will try again you can ignore previous

Keith

On 10/11/13 10:14, jreinhardt wrote:

Hi, can you try the most recent development snapshot from the BOLTS page: http://jreinhardt.github.io/BOLTS/downloads.html

I removed all the dict comprehensions I could find, but there could be more problems lurking.

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28147601.

KeithSloan commented 10 years ago

Just tried BOLTS_FreeCAD_201311101107_lgpl2.1+.tar.gz

Same result

Traceback (most recent call last):

File "/media/Drive D/Shared/FreeCAD/testmacros/start_bolts.FCMacro", line 1, in

import BOLTS

<type 'exceptions.ImportError'>: No module named BOLTS

Do I have to move anything to FreeCAD's Mod directory?

Keith

On 10/11/13 10:14, jreinhardt wrote:

Hi, can you try the most recent development snapshot from the BOLTS page: http://jreinhardt.github.io/BOLTS/downloads.html

I removed all the dict comprehensions I could find, but there could be more problems lurking.

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28147601.

bilderbuchi commented 10 years ago

@KeithSloan you can get a code-formatted section by either indenting at least 4(?) spaces, or puttin "```" before and after the code block. See https://help.github.com/articles/github-flavored-markdown

>>> a = {k:[] for k in [1,2,3]}
  File "<input>", line 1
    a = {k:[] for k in [1,2,3]}
                ^
SyntaxError: invalid syntax
KeithSloan commented 10 years ago

Sorry about this but I obviously failed to restart FreeCAD after uncompressing the tar. Apologies for such a basic error.

It now gets further and now fails at

Traceback (most recent call last):

File "/media/Drive D/Shared/FreeCAD/testmacros/start_bolts.FCMacro", line 1, in

import BOLTS

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/init.py", line 20, in

from bolttools import blt_parser

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/blt_parser.py", line 25, in

import openscad,freecad, html, downloads File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/openscad.py", line 28, in from common import BackendData, BackendExporter, BaseBase, BOLTSParameters : ('invalid syntax', ('/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/common.py', 114, 6, '\t\t\tfor pname in self.free}\n')) Keith On 10/11/13 10:14, jreinhardt wrote: > Hi, can you try the most recent development snapshot from the BOLTS page: > http://jreinhardt.github.io/BOLTS/downloads.html > > I removed all the dict comprehensions I could find, but there could be > more problems lurking. > > — > Reply to this email directly or view it on GitHub > https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28147601.
jreinhardt commented 10 years ago

Yep, I missed this one, should be fixed now. I just pushed another development snapshot, could you please try again?

KeithSloan commented 10 years ago

ha Ha I find I miss loads and spend my life reloading FreeCAD because of some silly python syntax error.

Anyway this is the latest barf

Traceback (most recent call last):

File "/media/Drive D/Shared/FreeCAD/testmacros/start_bolts.FCMacro", line 1, in

import BOLTS

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/init.py", line 20, in

from bolttools import blt_parser

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/blt_parser.py", line 25, in

import openscad,freecad, html, downloads File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/freecad.py", line 17, in import importlib : No module named importlib On 10/11/13 20:11, jreinhardt wrote: > Yep, I missed this one, should be fixed now. I just pushed another > development snapshot, could you please try again? > > — > Reply to this email directly or view it on GitHub > https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28159287.
jreinhardt commented 10 years ago

Thanks for your patience. importlib was introduced in python 2.7, but is available as a package for older versions:

https://pypi.python.org/pypi/importlib/1.0.2

You should be able to get rid of this error by installing this.

KeithSloan commented 10 years ago

Okay latest barf

Traceback (most recent call last):

File "/media/Drive D/Shared/FreeCAD/testmacros/start_bolts.FCMacro", line 1, in

import BOLTS

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/init.py", line 20, in

from bolttools import blt_parser

File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/blt_parser.py", line 25, in

import openscad,freecad, html, downloads File "/media/Drive D/Shared/FreeCAD/testmacros/BOLTS/bolttools/html.py", line 21, in from subprocess import check_output : cannot import name check_output Keith On 10/11/13 21:33, jreinhardt wrote: > Thanks for your patience. importlib was introduced in python 2.7, but > is available as a package for older versions: > > https://pypi.python.org/pypi/importlib/1.0.2 > > You should be able to get rid of this error by installing this. > > — > Reply to this email directly or view it on GitHub > https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28161433.
KeithSloan commented 10 years ago

Okay I am off to bed now.

Will pick up in the morning if you reply

Thanks Keith

On 10/11/13 21:33, jreinhardt wrote:

Thanks for your patience. importlib was introduced in python 2.7, but is available as a package for older versions:

https://pypi.python.org/pypi/importlib/1.0.2

You should be able to get rid of this error by installing this.

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28161433.

jreinhardt commented 10 years ago

I pushed another development snapshot.

I think we are finally there. Now that I am at home I have access to my old machine that has python 2.6, so I could make some tests. I did not find more problems, so I hope it works for you too.

Have a good night

KeithSloan commented 10 years ago

Hi trouble sleeping so I am back.

Yes appears to work. Do get one message when I click on add part

TypeError: on_addButton_clicked() takes exactly 2 arguments (1 given)

But it does not stop it working

Keith

On 10/11/13 23:05, jreinhardt wrote:

I pushed another development snapshot.

I think we are finally there. Now that I am at home I have access to my old machine that has python 2.6, so I could make some tests. I did not find more problems, so I hope it works for you too.

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28163707.

jreinhardt commented 10 years ago

I get this message as well, but it doesn't break and I could not figure out how to suppress this error.

So thank you again for your help with getting it to work in Python 2.6

KeithSloan commented 10 years ago

Hi

Normally if you call a python function with the wrong number of parameters it stops in its tracks My reading of TypeError: on_addButton_clicked() takes exactly 2 arguments (1 given)

Is that somehow you have code that just calls addButton_clicked with one parameter, should be able to use editor to find all places addButton_clicked is called. Or if its you function maybe you could add code to give it a default second parameter something like AddButton_clicked(parm1,parm2=default)

Couple of questions

One did I see whilst testing that you use OpenSCAD in BOLTS, if so its great to see how people especially Sebastian Hoogen have enhanced my initial efforts at importing OpenSCAD CSG files.

I am in the process of building a Mende90 3D printer and whilst I accept that most people doing CAD work with FreeCAD don't want bolts with actual threads, us 3D printers do. Is there any chance BOLTS will be enhanced to give an option for threads on the bolts.

If you see a way to note contributors efforts then I would be grateful for a mention (with helping for python 2.6)

Thanks Keith

On 11/11/13 08:05, jreinhardt wrote:

I get this message as well, but it doesn't break and I could not figure out how to suppress this error.

So thank you again for your help with getting it to work in Python 2.6

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28180092.

jreinhardt commented 10 years ago

Hi,

it is not me calling on_addButton_clicked with the wrong number of arguments, but the GUI event loop. When the user clicks a button a number of callbacks is called so that you can hook your logic up. For the button click there are several overloaded versions of the callback that all get connected to the same python function. This causes the function to be called two times, once with the two expected parameters, and once with only one, which triggers an exception. However this exception is handled by the event loop so that the FreeCAD continues to work. I will try to silence this error, but I have to figure out how I can do that.

To answer your questions.

BOLTS is actually many different things, in particular the set of files that you downloaded for FreeCAD ("BOLTS for FreeCAD"), and a set of files for working with OpenSCAD ("BOLTS for OpenSCAD"). These two sets of files are fundamentally different, but are created from or use the same data (tables of dimensions, ...).

BOLTS for FreeCAD does not use the FreeCAD OpenSCAD workbench or depends on OpenSCAD in any way. However the OpenSCAD capabilities of FreeCAD come handy when creating drawings for parts for which no FreeCAD geometry is available. I describe this use of the OpenSCAD workbench here. I was not aware that you were involved in the OpenSCAD workbench, it is really handy.

The FreeCAD geometries for many of the parts were done by me in a hurry and more or less translated from the OpenSCAD geometries that I had done earlier. I plan to get better geometries from the screwmaker macro http://freecadweb.org/wiki/index.php?title=Macro_screw_maker1_2 (see also #41 ), which can give you threads on your bolts.

But do you really want to print out plastic bolts with thre ads? This does not work too well (I have a Mendel90 as well).

I have mentioned you in this post. On the website I have a automatically generated list of contributors, and I think I will try to extend it by a list of people that helped in other ways.

jreinhardt commented 10 years ago

Did that: http://jreinhardt.github.io/BOLTS/html/contributors.html

KeithSloan commented 10 years ago

Many Thanks, always good to get a mention and does not reality cost the prime developer anything.

As to OpenSCAD if you look at the python code importCSG.py you will see my name as copyright holder. I initially asked about the possibility of converting OpenSCAD CSG files to FreeCAD. Sebastian responded and made a start and started coding a parser in python. I also made a start using Lex i.e. PLY as the parser. I ended up using a lot of Sebastians code and help. But it is the Lex/PLY parser version that is used.

Sebastian then developed the OpenSCAD Module so that when somebody opened an OpenSCAD scad file it would under the covers run OpenSCAD and import the CSG file.

I have been helping with some code for adding support for OpenSCAD hull & minkowski functions and using those facilities via the GUI.

3D printing, well I was hoping to print things with larger threads like telescope adapter, I agree not small bolts.

Keith

On 11/11/13 11:22, jreinhardt wrote:

Did that: http://jreinhardt.github.io/BOLTS/html/contributors.html

— Reply to this email directly or view it on GitHub https://github.com/jreinhardt/BOLTS/issues/60#issuecomment-28191127.