Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Prereq setup:
- - Windows has Python installation (3.12.9), matching version in Pythonscad
- - Cmd prompt > python -m pip install fullcontrol
- Now, run the following py script in PythonScad.
- - It will add site-packages location used by my Windows' python installation. This is where pip installs packages.
- - Remove colliding py files from Windows Python installation. My hypothesis: collision occurs with the embedded Python runtime from Pythonscad.
- - 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.
- Stdout is at the bottom for reference. I redacted my USERNAME for privacy purposes.
- '''
- import sys, os
- def sys_path_site_pkg():
- '''
- Make pip installs from OS level python accessible to PythonScad. Requires matching version (3.12.9)
- '''
- SITE_PKG = rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\Lib\site-packages"
- if SITE_PKG not in sys.path:
- sys.path.append(SITE_PKG)
- # Unwind some default folder adds by PythonScad that seem to conflict!!
- # Specifically: ctypes.
- unwinds = set([
- rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\Lib",
- rf"C:\Users\{os.getlogin()}\AppData\Local\Programs\Python\Python312\DLLs"
- ])
- sys.path = [path for path in sys.path if path not in unwinds]
- sys_path_site_pkg()
- print('sys.path', sys.path)
- import fullcontrol as fc
- print('fc.linspace', fc.linspace(1.5,2.5,11))
- '''
- Stdout for reference:
- PythonSCAD 2025.10.28
- https://www.pythonscad.org/
- Copyright (C) 2009-2025 The OpenSCAD Developers
- Copyright (C) 2024-2025 The PythonSCAD Developers
- 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.
- Parsing design (AST generation)...
- Running Python 3.12.9 without venv.
- 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']
- fc.linspace [1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5]
- Compiling design (CSG Tree generation)...
- Compiling design (CSG Products generation)...
- Geometries in cache: 0
- Geometry cache size in bytes: 0
- CGAL Polyhedrons in cache: 0
- CGAL cache size in bytes: 0
- Compiling design (CSG Products normalization)...
- Normalized tree has 1 elements!
- Compile and preview finished.
- Total rendering time: 0:00:00.179
- '''
Advertisement
Add Comment
Please, Sign In to add comment