New Macro " Sketch Constraint From Spreadsheet"

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by Syres »

@chennes Is there something specific that must be done to Wiki held macros that perhaps is being missed by the authors or is there a bug with AddonManager?

Both this new macro https://wiki.freecad.org/Macro_Sketch_C ... preadsheet and https://wiki.freecad.org/Macro_Shake_Sketch (a fairly old macro) produce errors when trying to install using the AddonManager (the FCMacro files are definitely not in the macro folder):

Code: Select all

19:59:55  Failed to install macro Sketch Constraint From Spreadsheet
19:59:55  Could not locate macro-specified file https://wiki.freecad.org/File:SketchConstraintFromSpreadsheet.svg (expected at https:/wiki.freecad.org/File:SketchConstraintFromSpreadsheet.svg)
19:59:55  Failed to copy https:/wiki.freecad.org/File:SketchConstraintFromSpreadsheet.svg to /tmp/tmpo6r1nv36/https:/wiki.freecad.org/File:SketchConstraintFromSpreadsheet.svg

Code: Select all

20:03:25  Failed to install macro Shake Sketch
20:03:25  Could not locate macro-specified file https://wiki.freecadweb.org/images/4/4a/Macro_Shake_Sketch.png (expected at https:/wiki.freecadweb.org/images/4/4a/Macro_Shake_Sketch.png)
20:03:25  Failed to copy https:/wiki.freecadweb.org/images/4/4a/Macro_Shake_Sketch.png to /tmp/tmpg8czt9xo/https:/wiki.freecadweb.org/images/4/4a/Macro_Shake_Sketch.png

Code: Select all

OS: Linux Mint 20.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.0.32413 (Git)
Build type: Release
Branch: master
Hash: cb2160449412b6470996a2b9b4a4a8ed172d6717
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.7.1
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * Silk 1.0.0
  * CurvedShapes 1.0.4
  * freecad.gears 1.0.0
  * Curves 0.6.8
  * PieMenu 1.2.4
  * Plot 2022.4.17
  * AirPlaneDesign 0.4.0
  * fasteners 0.4.54
  * sheetmetal 0.2.59
User avatar
chennes
Veteran
Posts: 3878
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by chennes »

Looks like an AM bug to me (note the missing slash in the location it's trying to find the file). I'll try to get a look at it tonight, but it might not happen before tomorrow.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

@chennes
Thanks a lot to have a look. I need help for that beacaus I don't know anything about that !
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by mario52 »

Hi

@chennes not installation possible

11:05:31 Impossible d'installer la macro Sketch Constraint From Spreadsheet
11:05:31 Failed to create C:\Users\User\AppData\Local\Temp\tmpl5mh57vq\https://wiki.freecad.org

11:07:29 Impossible de lancer un nouveau programme d'installation tant que le précédent n'est pas terminé.Impossible de lancer un nouveau programme d'installation tant que le précédent n'est pas terminé.


i try AeroFoil

11:39:02 Impossible d'installer la macro AeroFoil
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_Initial_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_Initial_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_NACA4Digit_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_NACA4Digit_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_NACA5Digit_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_NACA5Digit_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_CurvesInput_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_CurvesInput_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_PointsInput_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_PointsInput_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_DATInput_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_DATInput_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_CSVInput_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_CSVInput_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_FileLoad_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_FileLoad_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_Final_Dialog.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_Final_Dialog.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_Math_Functions_Box.ui to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_Math_Functions_Box.ui
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil_mfb_img.gif to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil_mfb_img.gif
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil.svg to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil.svg
11:39:02 Failed to copy AeroFoil_UI_Files\AeroFoil.png to C:\Users\User\AppData\Local\Temp\tmp3nkyprnc\AeroFoil_UI_Files\AeroFoil.png

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.31917 (Git)
Build type: Release
Branch: master
Hash: 4639283b459f9ff9093e289908cc003db8745b82
Python 3.10.9, Qt 5.15.6, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
@2cv001

for the french "accentué" , old and always problem see Fehler in Version 0.19 pre ??

now no put an accent in my macros !

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.
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

Thanks Mario52
mario52 wrote: Thu Mar 23, 2023 10:46 am



for the french "accentué" , old and always problem see Fehler in Version 0.19 pre ??

now no put an accent in my macros !

mario
Probleme ! I don't speak German

I deleted all french word so no accent in comments,
but I have to have some for this line of code :
Capture.PNG
Capture.PNG (8.37 KiB) Viewed 1504 times

Code: Select all

# list of characters to be replaced by an equivalent. for example 'é' will be replaced by 'e
# if you add characters, please send me a private message. Il will eventually add it in my code.
caracEquivalents = [ ['é','e'],['è','e'],['à','a'],['@','a'],['&','e'],['ç','c'],
                  ['²','2'],["'",''],['?',''],['"',''],['(',''],[')',''],['#',''],
                  ['$',''],['+',''],['-',''],['*',''],['/',''],['\\',''] ]
                  
What can I do for this line ? Is there a way with ascii code number ?
edit : like this ?

Code: Select all

caracEquivalents = [ [chr(233),'e'],[chr(232),'e'],[chr(224),'a'],[chr(64),'a'],[chr(38),'e'],
                    [chr(231),'c'],[chr(178),'2'],[chr(39),''],[chr(63),''],[chr(34),''],
                    [chr(40),''],[chr(41),''],[chr(35),''],[chr(36),''],[chr(43),''],
                    [chr(45),''],[chr(42),''],[chr(47),''],[chr(92),''] ]
                    
Perhaps that is enought (eaysier to understand when we read the code) :

Code: Select all

caracEquivalents = [ [chr(233),'e'],[chr(232),'e'],[chr(224),'a'],['@','a'],['&','e'],
                     [chr(231),'c'],['²','2'],["'",''],['?',''],['"',''],['(',''],[')',''],['#',''],
                     ['$',''],['+',''],['-',''],['*',''],['/',''],['\\',''] ]
                     
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

I changed the wiki code with this :

Code: Select all

caracEquivalents = [ [chr(233),'e'],[chr(232),'e'],[chr(224),'a'],[chr(64),'a'],[chr(38),'e'],
                    [chr(231),'c'],[chr(178),'2'],[chr(39),''],[chr(63),''],[chr(34),''],
                    [chr(40),''],[chr(41),''],[chr(35),''],[chr(36),''],[chr(43),''],
                    [chr(45),''],[chr(42),''],[chr(47),''],[chr(92),''] ]
                    
                    
I did a test, always the issue, but I think I have to wait
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
mario52
Veteran
Posts: 4673
Joined: Wed May 16, 2012 2:13 pm

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by mario52 »

Hi

my experience also the chr() can give error

here the method proposed by wmayer (character degrees)

Code: Select all

b' \xc2\xb0'.decode("utf-8")
but the "decode" code can give error

maybe in Unicode character ...

Code: Select all

"\u00E9" # = é
"\u00E8" # = è

# your first line
['\u00E9','e'],['\u00E8','e'],['\u00E0','a'],['\u0040','a'],['\u0026','e'],['\u00E7','c'],
personally i don't put accent or character hover 127 in my macro

more than thirty years informatic "grand public" and always this problem

even with this code

Code: Select all

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
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.
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

Another issue :
Do you know how I can have an icon here :
Capture.PNG
Capture.PNG (45.13 KiB) Viewed 1448 times
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

To be sure, I have just minimized the code with only one line (print...)
We will know if issue come from code or not.
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
User avatar
2cv001
Posts: 484
Joined: Wed Jan 01, 2020 9:30 am

Re: New Macro " Sketch Constraint From Spreadsheet"

Post by 2cv001 »

Always the issue (same than Mario52...):
With only this code in the wiki :

Code: Select all

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =========================================================================
# Macro Sketch Constraint From Spreadsheet
# file name : sketchConstraintFromSpreadsheet.FCMacro
# ========================================================================
# ==                                                                    ==
# == Adds a length constraint to a line or between 2 points             ==
# == using a spreadsheet cell alias or name (ex. C2).                   ==
# == Future changes to the spreadsheet will update the constraint.      ==
# == if necessary, the macro help you to create alias                   ==
# == USE:                                                               ==
# == 1) Select 1 line, 2 points or a constraint                         ==
# == 2) Click on a spreadsheet cell                                     ==
# == 3) Launch the macro                                                ==
# ==    if the cell has an alias, the length property will be something ==
# ==    like 'Spreadsheet.alias'.                                       ==
# ==    if not, just something like 'Spreadsheet.C2'                    ==
# == You can select lines, points line, points, circle...               ==
# == You can't select external objetcs  (next version will be able to   ==
# ========================================================================
# ========================================================================
__author__ = "2cv001"
__title__   = "Macro Sketch Constraint From Spreadsheet"
__date__    = "2023/03/23"    #YYYY/MM/DD
__version__ = __date__
__icon__    = "https://wiki.freecad.org/File:SketchConstraintFromSpreadsheet.svg"
__Wiki__    = "https://wiki.freecad.org/Macro_sketchConstraintFromSpreadsheet"

import FreeCAD, FreeCADGui

print('code will come back in few minutes')

Code: Select all

15:20:13  Failed to install macro Sketch Constraint From Spreadsheet
15:20:13  Failed to create C:\Users\miche\AppData\Local\Temp\tmpefh8oh27\https://wiki.freecad.org
so it's not an issue with accents

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.0.32258 (Git)
Build type: Release
Branch: master
Hash: 0f4acc55beb66dcc9dfab442344c6286d6a2913e
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: French/France (fr_FR)
Installed mods: 
  * Assembly3 0.11.4
  * Curves 0.6.5
  * fasteners 0.4.26
  * Help 1.0.3
  * ThreadProfile 1.84.0
Macro Sketch Constraint From Spreadsheet :
https://wiki.freecad.org/Macro_Sketch_C ... adsheet/fr
Post Reply