Guest User

willa pythonscad with import fullcontrol

a guest
Dec 20th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. '''
  2. Prereq setup:
  3. - Windows has Python installation (3.12.9), matching version in Pythonscad
  4. - Cmd prompt > python -m pip install fullcontrol
  5.  
  6. Now, run the following py script in PythonScad.
  7. - It will add site-packages location used by my Windows' python installation. This is where pip installs packages.
  8. - Remove colliding py files from Windows Python installation. My hypothesis: collision occurs with the embedded Python runtime from Pythonscad.
  9. - NOTE: this is not "portable" since it "hardcodes" the path for your Windows Python installation. Appdata path is the default path by the Windows Python installer.
  10.  
  11. Stdout is at the bottom for reference. I redacted my USERNAME for privacy purposes.
  12. '''
  13.  
  14. import sys, os
  15.  
  16. def sys_path_site_pkg():
  17. '''
  18. Make pip installs from OS level python accessible to PythonScad. Requires matching version (3.12.9)
  19. '''
  20. SITE_PKG = rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\Lib\site-packages"
  21.  
  22. if SITE_PKG not in sys.path:
  23. sys.path.append(SITE_PKG)
  24.  
  25. # Unwind some default folder adds by PythonScad that seem to conflict!!
  26. # Specifically: ctypes.
  27. unwinds = set([
  28. rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\Lib",
  29. rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\DLLs"
  30. ])
  31.  
  32. sys.path = [path for path in sys.path if path not in unwinds]
  33.  
  34.  
  35. sys_path_site_pkg()
  36. print('sys.path', sys.path)
  37.  
  38. import fullcontrol as fc
  39.  
  40. print('fc.linspace', fc.linspace(1.5,2.5,11))
  41.  
  42. '''
  43. Stdout for reference:
  44.  
  45. PythonSCAD 2025.10.28
  46. https://www.pythonscad.org/
  47.  
  48. Copyright (C) 2009-2025 The OpenSCAD Developers
  49. Copyright (C) 2024-2025 The PythonSCAD Developers
  50. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  51.  
  52.  
  53. Parsing design (AST generation)...
  54. Running Python 3.12.9 without venv.
  55. sys.path ['C:\\Program Files\\libraries\\python', 'C:\\Users\\USERNAME\\Documents\\PythonSCAD\\libraries', 'C:\\Users\\USERNAME\\Documents\\OpenSCAD\\libraries', 'C:\\Users\\USERNAME\\workspace\\prog-splitz\\openscad\\bug_fixes\\divmatrix', 'C:\\Program Files\\PythonSCAD\\python312.zip', 'C:\\Program Files\\PythonSCAD', 'C:\\Program Files\\PythonSCAD\\Lib', 'C:\\Users\\USERNAME\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages']
  56. fc.linspace [1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
  57.  
  58. Compiling design (CSG Tree generation)...
  59. Compiling design (CSG Products generation)...
  60. Geometries in cache: 0
  61. Geometry cache size in bytes: 0
  62. CGAL Polyhedrons in cache: 0
  63. CGAL cache size in bytes: 0
  64. Compiling design (CSG Products normalization)...
  65. Normalized tree has 1 elements!
  66. Compile and preview finished.
  67. Total rendering time: 0:00:00.179
  68. '''
Advertisement
Add Comment
Please, Sign In to add comment