Skip to content

Instantly share code, notes, and snippets.

View tritao's full-sized avatar
🎯
Focusing

João Matos tritao

🎯
Focusing
  • Portugal
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using CppSharp;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors.Infrastructure;
using Microsoft.AspNetCore.Http;
const Button = defineComponent(({
id,
label = '',
width = 100,
height = 40,
color = gray,
hoverColor = lightGray,
pressedColor = darkGray,
fontSize = 16,
textColor = black,
#include <string>
#include <cctype>
#include <stdexcept>
#include <unordered_map>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
// Simple RGB color
static PyObject* createMyConstantsEnum()
{
// Import the Python 'enum' module.
PyObject* enumModule = PyImport_ImportModule("enum");
if (!enumModule) {
PyErr_SetString(PyExc_ImportError, "Failed to import the enum module");
return nullptr;
}
@tritao
tritao / py.cpp
Last active March 2, 2025 23:01
#include <Python.h>
#include <thread>
#include <future>
#include <iostream>
#include <chrono>
// ----- Python-bound Function: execute -----
//
// This function takes an integer, offloads a computation (here, squaring the number)
// using std::async, and returns the result.
FEP00
Title Evolution of FreeCAD's Rendering Subsystem
Status Draft
Author(s) Joao Matos (tritao)
Created Mar 02, 2025
Updated Mar 02, 2025

#include <iostream>
#include <chrono>
struct Color {
float a, b, c, d;
};
volatile float sink = 0.0f;
#if defined(_MSC_VER)
diff --git a/cMake/FreeCAD_Helpers/SetupPython.cmake b/cMake/FreeCAD_Helpers/SetupPython.cmake
index a2887affcb..6043fba779 100644
--- a/cMake/FreeCAD_Helpers/SetupPython.cmake
+++ b/cMake/FreeCAD_Helpers/SetupPython.cmake
@@ -18,4 +18,12 @@ macro(SetupPython)
message(FATAL_ERROR "To build FreeCAD you need at least Python 3.8\n")
endif()
+ # If a custom Python directory was passed in, then save it as PYTHON_HOME_DIR,
+ # which is used by config.h.cmake when generating the config header file.
@tritao
tritao / coin.sh
Last active February 10, 2025 22:46
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR
cd coin
# rm -rf bld
mkdir -p bld && cd bld
cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCOIN_BUILD_SHARED_LIBS=1 -DCOIN_BUILD_EXAMPLES=1 -DCOIN_BUILD_TRACY_PROFILER=0 \
@tritao
tritao / Bindings.md
Last active February 15, 2025 15:23

FreeCAD C++ to Python Binding System Manual

Welcome to the new Python-based binding system for exposing FreeCAD C++ APIs to Python. This system replaces the previous XML-based approach with a more direct and flexible Python interface, allowing C++ developers to define Python bindings using native Python syntax, type annotations, and decorators.


Table of Contents