This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pySDL3 is required, install with: | |
# pip install PySDL3 | |
# Free Flight FreeCAD demo. Navigate scene with mouse and keyboard | |
# Bindings: | |
# mouse: yaw and pitch | |
# Q/E - roll, W/S - forward/backward, A/D - sidestep left/right, Ctrl/Space - down/up | |
# note: proper threading/concurrency not completed, adjust sleep in self._running loop if segfaults | |
# note: background color and lights copying from main view not implemented yet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# moves selected shape along predefined path, and creates a 3D picking ray along object's Z axis | |
# solid should be outside 0-Z+ to avoid self-picking | |
# the ray picks another object in predefined location (waypoint changing from (plecement, False) to (placement, True)) and drags it | |
from pivy.coin import SbVec3f, SbRotation | |
from pivy.coin import SoTranslation | |
from pivy.coin import SoSeparator, SoSwitch, SO_SWITCH_ALL, SO_SWITCH_NONE | |
from pivy.coin import SoVertexProperty, SoLineSet, SoSphere | |
from pivy.coin import SoBaseColor, SbColor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Steam Deck UNOFFCIAL Tilt Five install script | |
# Save to a directory with the tiltfive_driver_1.4.1_amd64.unpacked_debs.tar.xz archive | |
# chmod +x steamdeck-install.sh | |
# sudo sh ./steamdeck-install.sh | |
# Adjust paths if necessary | |
TILTFIVE_HOME_DIR="/var/opt/tiltfive" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeCADGui as Gui | |
import FreeCAD as App | |
import Part | |
def pick_ray(start_vec, dir_vec): | |
Gui.Selection.clearSelection() | |
if App.ActiveDocument.getObject('Line_dir'): | |
App.ActiveDocument.removeObject('Line_dir') | |
if App.ActiveDocument.getObject('Line_ray'): | |
App.ActiveDocument.removeObject('Line_ray') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from OpenGL.GL import * | |
WINDOW_LIBRARY = 'GLFW' # GLFW or GLUT | |
TRY_FRAMEBUFFER = True | |
GENERATE_TEXTURE_ID_PROBLEM = False # Follow this global variable to see the error in texture ID generation | |
SIDE = 800 # window size | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SoEnvironment usage in FreeCAD scene | |
# https://www.coin3d.org/coin/classSoEnvironment.html | |
# https://forum.freecad.org/viewtopic.php?p=785643#p785643 | |
from pivy.coin import SoEnvironment | |
se = SoEnvironment() # create a new node | |
sg = Gui.ActiveDocument.ActiveView.getSceneGraph() | |
sg.insertChild(se, 1) # add the node at the beginning of our scene | |
se.ambientIntensity.getValue() # read value for current ambient light eg.: 0.2 | |
se.ambientIntensity.setValue(0.8) # set a new value for ambient light, can be higher than 1 too, since it is multiplied by AmbientColor property of a material |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeCAD as App, FreeCADGui as Gui, time | |
from PySide2 import QtGui,QtCore | |
class Animation(object): | |
def __init__(self): | |
App.Console.PrintMessage("init \n") | |
App.ActiveDocument.recompute() | |
self.timer = QtCore.QTimer() | |
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.my_update) | |
self.timer.start(100) #100ms for step, adjust to performance of the PC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FreeCAD as App, FreeCADGui as Gui, Part, time | |
from PySide2 import QtGui,QtCore | |
from pivy import coin | |
import math | |
class CustomArrow(object): | |
def __init__(self): | |
self.cyl_height = 6 | |
cyl_radius = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on gl_example.py https://github.com/cmbruns/pyopenxr_examples | |
import ctypes | |
import logging | |
from threading import Thread | |
import sdl2 | |
import platform | |
from OpenGL import GL |
NewerOlder