Please review FCVerticalText Macro

Need help, or want to share a macro? Post here!
User avatar
WRM65
Posts: 9
Joined: Sun Jul 19, 2020 4:22 am

Please review FCVerticalText Macro

Postby WRM65 » Thu Jul 23, 2020 10:06 pm

FreeCAD Community,

Prior to submitting the new macro Vertical Text for inclusion to the central repository, please review the macro scripts (see attached zip file).

Here is a description of the macro.

Description
==========
FCVerticalText.png
FCVerticalText.png (1.28 KiB) Viewed 924 times
Typically, when a text is presented "vertically", the text is rotated 90 degrees resulting in each character in the text positioned horizontally, which can also make it difficult to read the text. In some cases, it may be preferable to position each character in a vertical (upright) position which make the text easier to read. However, it can be quite laborious, positioning and aligning each character in the text to get the final "vertical" layout. This macro provides an easy and intuitive way to create a "vertical" layout of a given text string. The image below illustrates the vertical layout of a text in both the "typical" and "upright" layout.

The creation of this macro was inspired by the Macro to Create Circular Text and as such, the layout of the user interface (UI) is very similar.

Screenshot - VerticalText - 00.png
Screenshot - VerticalText - 00.png (31.76 KiB) Viewed 924 times

Scripts
=======
The macro files:
There are four (4) supporting Python files which must be installed in the subfolder ./verticaltext
1. Constants.py
2. Utilities.py
3. FormEntrySettings.py
4. FormPreview.py


All comments / advice welcomed.

Thanks.

Happy FreeCAD'in
Attachments
FCVerticalText.zip
(17.59 KiB) Downloaded 56 times
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Please review FCVerticalText Macro

Postby vocx » Thu Jul 23, 2020 10:09 pm

WRM65 wrote:
Thu Jul 23, 2020 10:06 pm
Prior to submitting the new macro Vertical Text for inclusion to the central repository, please review the macro scripts (see attached zip file).
...
It's much easier to review if you keep the code in a Git repository, like GitHub or Gitlab.

Also, it's best if you follow Pythonic guidelines, and name the files in lowercase, and follow the general directions of PEP8 (Python style guidelines).
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
WRM65
Posts: 9
Joined: Sun Jul 19, 2020 4:22 am

Re: Please review FCVerticalText Macro

Postby WRM65 » Fri Jul 24, 2020 12:20 am

I will rewrite as advised.

Much appreciated.
mario52
Posts: 3215
Joined: Wed May 16, 2012 2:13 pm

Re: Please review FCVerticalText Macro

Postby mario52 » Fri Jul 24, 2020 9:50 am

hi

thanks for appreciate and use my macro

i discover little error in the test 0.18 : "__title__" must be uppercase "__Title__" (i correct it later in my macro (only this macro use the uppercase))

Code: Select all

"This version " + __title__ + " rmu work with the FreeCAD 0.18 or higher.
the installation is not easy and not FreeCAD rule:

Installation error: missing file - C:/Users/userName/AppData/Roaming/FreeCADverticaltext/VerticalText.py

instead

C:/Users/userName/AppData/Roaming/FreeCAD/Macro/.......

many macro is not installable with AddonManager (you have 4 macros and different directory)

thanks for adding the link to the original macro idea

i have years late for my new modification and i use the path on wire (direction) for position the text

example :

Image

thanks

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
Kunda1
Posts: 8690
Joined: Thu Jan 05, 2017 9:03 pm

Re: Please review FCVerticalText Macro

Postby Kunda1 » Fri Jul 24, 2020 1:05 pm

mario52 wrote:
Fri Jul 24, 2020 9:50 am
hi
@mario52 couple of observations:
  • Size character should be Character size
  • Begin angle should be Starting angle
  • End angle should be Ending angle
  • Would it be possible to add the ° (degree character) in the textboxes of the appropriate spinners?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
mario52
Posts: 3215
Joined: Wed May 16, 2012 2:13 pm

Re: Please review FCVerticalText Macro

Postby mario52 » Fri Jul 24, 2020 8:12 pm

hi
Kunda1 wrote:
Fri Jul 24, 2020 1:05 pm
[*]Size character should be Character size
[*]Begin angle should be Starting angle
[*]End angle should be Ending angle
done thanks
[*]Would it be possible to add the ° (degree character) in the textboxes of the appropriate spinners?[/list]
no many errors with utfblabla (ça m'a dégoûté) stay..."deg"

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
WRM65
Posts: 9
Joined: Sun Jul 19, 2020 4:22 am

Re: Please review FCVerticalText Macro

Postby WRM65 » Sun Jul 26, 2020 3:41 am

Hi Mario,

As I am new to FreeCAD please explain your comment
"the installation is not easy and not FreeCAD rule:"

The installation error prints the parameter settings retrieved from your FreeCAD installation.

Code: Select all

Installation error: missing file - C:/Users/userName/AppData/Roaming/FreeCADverticaltext/VerticalText.py
See the code starting at line number 279 - 305

Code: Select all

 
  __param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
  __path  = __param.GetString("MacroPath","")
  __path  = __path.replace("\\","/") # convert the "\" to "/"
  __path += "verticaltext/" #add macro subdirectory
It seems that a "forward slash" need to be added when formulating the macro subdirectory (line 284)

Code: Select all

__path += "/verticaltext/" #add macro subdirectory
From the README.md, it suggest multiple files are supported during the installation process using the __Files__ metadata property.
https://github.com/FreeCAD/FreeCAD-macros#readme

However, if your comment "many macro is not installable with AddonManager (you have 4 macros and different directory)", then my macro will not work.

Also if your enhancement to your FCCircularText macro will provide the exact functionality I have developed, then my macro will be unnecessary.

Thanks for your response.

Regards,
WRM.
mario52
Posts: 3215
Joined: Wed May 16, 2012 2:13 pm

Re: Please review FCVerticalText Macro

Postby mario52 » Sun Jul 26, 2020 12:53 pm

hi WRM65

no problem with your macro and if the functionality is duplicate everyone is free and your macro is a good macro thanks for sharing
WRM65 wrote:
Sun Jul 26, 2020 3:41 am

It seems that a "forward slash" need to be added when formulating the macro subdirectory (line 284)

Code: Select all

__path += "/verticaltext/" #add macro subdirectory
yes

Code: Select all

QFontDialog.getFont
does not give the Fonts directory in Windows 10

for this i have used Matplotlib font

you must see with galou and Kunda1 for the installation with AddonManager

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting, Dialog creation. My macros on Gist.github.
User avatar
Kunda1
Posts: 8690
Joined: Thu Jan 05, 2017 9:03 pm

Re: Please review FCVerticalText Macro

Postby Kunda1 » Sun Jul 26, 2020 1:04 pm

It would be ideal if macros weren't duplicated for the simple reason to keep the macro ecosystem as uncluttered as possible.

Is there a way functionality can get combined?

BTW, to submit macros, check out:

https://github.com/FreeCAD/FreeCAD-addons
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
WRM65
Posts: 9
Joined: Sun Jul 19, 2020 4:22 am

Re: Please review FCVerticalText Macro

Postby WRM65 » Mon Aug 17, 2020 2:23 am

Hello Mario,

I would like to use your circular text macro to create a circular text on a flat object as shown in your example (included below).

Could you please assist and provide the configuration settings to provide both text layouts.

Thanks.

Kind regards,
WRM.

Image
Attachments
252px-FCCircularText_05.png
252px-FCCircularText_05.png (40.47 KiB) Viewed 581 times