Hi,
I have an annoying issue. When I edit the macro in notepad++, for some odd reason, all the characters are correctly shown in Freecad macro editor, except tab. It is translated into 4 spaces when opened in Freecad editor. Has anyone had a similar issue? And is there a way to solve it?
notepad ++ tab
freecad tab
Kind regards,
Peter Korenčan
Edit macro in Notepad++ tab issue
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Edit macro in Notepad++ tab issue
- Attachments
-
- n.FCMacro
- (236 Bytes) Downloaded 16 times
Kind regards,
Peter
Peter
Re: Edit macro in Notepad++ tab issue
Hi
FreeCAD:
Menu > Edit > preference > General > Editor > Indentation Space or Tabs
Notepad ++:
Menu > edition > Traitement des espaces
the best use space
mario
FreeCAD:
Menu > Edit > preference > General > Editor > Indentation Space or Tabs
Notepad ++:
Menu > edition > Traitement des espaces
the best use space
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Veteran
- Posts: 5513
- Joined: Thu Apr 05, 2018 1:53 am
Re: Edit macro in Notepad++ tab issue
You don't want tabs in your python code, or at least you don't want to mix tabs and spaces. Everybody seems to be using spaces for python code in FreeCAD, so it's better to just use the 4 spaces. Mixing was okay with python2, but no longer works with python3.
Re: Edit macro in Notepad++ tab issue
Tabs in Python are not very accepted, in fact all the guides to the language will advice to use spaces.
Edit:
from PEP8
It is consistent across OS and between editors.
Other thing, are avoid to have spaces at the end of the line and avoid having empty line with only spaces, so it is better to activate also "Show non printable characters" or whatever options your editor have to show spaces, usually as little grey points.
All editors have such option and is very useful.
Happy coding with Python and FreeCAD.
Regards
Carlo D.
Edit:
from PEP8
Why? "tabs stops" could have different lengths, so the most simple thing is to use 4 space per indent level.
Tabs or Spaces?
Spaces are the preferred indentation method.
Tabs should be used solely to remain consistent with code that is already indented with tabs.
Python disallows mixing tabs and spaces for indentation.
It is consistent across OS and between editors.
Other thing, are avoid to have spaces at the end of the line and avoid having empty line with only spaces, so it is better to activate also "Show non printable characters" or whatever options your editor have to show spaces, usually as little grey points.
All editors have such option and is very useful.
Happy coding with Python and FreeCAD.
Regards
Carlo D.
Last edited by onekk on Sat Jan 22, 2022 9:57 am, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Edit macro in Notepad++ tab issue
Hi
it is interesting to activate the spaces by default instead of tab in the preference Editor > Indentation
mario
it is interesting to activate the spaces by default instead of tab in the preference Editor > Indentation
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Edit macro in Notepad++ tab issue
Thanks guys. I changed the setting in notepad++ now it works with tabs. I like it better.
Regards,
Peter
Regards,
Peter
Kind regards,
Peter
Peter