Skip to content

Instantly share code, notes, and snippets.

@mario52a
mario52a / Macro FCCamera.FCMacro
Last active March 9, 2025 03:14
This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera, align view to face or to axis, align the object to view.
# -*- coding: utf-8 -*-
"""
***************************************************************************
* Copyright (c) 2015 2016 2017 2018 2019 2020 2024 <mario52> *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
@mario52a
mario52a / Macro_WireXYZ.FCMacro
Last active August 12, 2021 23:51
This macro creates a wire (or points) with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# created a wire with coordinate x y z separated (in the file without coma)
__title__= "Macro_WireXYZ"
__author__= "Mario52"
__date__= "2020/10/16"
__version__= "00.03"
##
#EX:
#0 0 0
@mario52a
mario52a / FCInfo_fr_Ver_1-12_No_Docked_Ubuntu.FCMacro
Created February 25, 2015 16:49
Gives a series of informations about the selected shape and can display a conversion of length, inclination (degrees, radians, grades, pourcent) shape, surface, volume and the weight of the form in the density selected in different units of quantities international and Anglo-Saxon. (Version Française)
# -*- coding: utf-8 -*-
"""
***************************************************************************
* Copyright (c) 2014 <mario52> *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
@mario52a
mario52a / FCInfo_en_Ver_1-12_No_Docked_Ubuntu.FCMacro
Last active August 12, 2021 23:52
Gives a series of informations about the selected shape and can display a conversion of length, inclination (degrees, radians, grades, pourcent) shape, surface, volume and the weight of the form in the density selected in different units of quantities international and Anglo-Saxon. (English version)
# -*- coding: utf-8 -*-
"""
***************************************************************************
* Copyright (c) 2014 <mario52> *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
@mario52a
mario52a / FCInfo_fr_Ver_1-30c-rmu_Docked.FCMacro
Last active January 28, 2025 19:49
Donne une série de renseignements sur la forme sélectionnée et peut afficher une conversion de la longueur, de l'inclinaison de la forme (degrés, radian, grade, pourcent), de la surface, du volume et du poids de la forme dans la densité sélectionnée dans différentes unités de grandeurs internationales et anglo-saxonnes. (Version Française)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) <mario52> 2014 2015 2016 2017 2018 2019 2020 2021 2022 *
* 2023 2024 2025 *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
@mario52a
mario52a / FCInfo_en_Ver_1-30c-rmu_Docked.FCMacro
Last active April 26, 2025 14:06
Gives a series of informations about the selected shape and can display a conversion of length, inclination (degrees, radians, grades, pourcent) shape, surface, volume and the weight of the form in the density selected in different units of quantities international and Anglo-Saxon. (English version)
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) <mario52> 2014 2015 2016 2017 2018 2019 2020 2021 2022 *
* 2023 2024 2025 *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
@mario52a
mario52a / Macro_Line_Length.FCMacro
Created February 25, 2015 16:33
This small macro create a line giving as an argument the XYZ coordinates, length, and angle
# -*- coding: utf-8 -*-
# créer une ligne avec une coordonnée une longueur et un angle sur le plan X Y
# create line with coordinate length and angle to plane X Y
import FreeCAD, FreeCADGui, Draft
from math import cos, sin, radians
#from FreeCAD import Base
def line_length(x1 = 0.0, y1 = 0.0, z1 = 0.0, length = 10.0, angle = 0.0):
x2 = x1 + (length * cos(radians(angle)))
y2 = y1 + (length * sin(radians(angle)))
@mario52a
mario52a / Macro_FCSpring_Helix_Variable.FCMacro
Last active July 11, 2024 19:05
This macro creates a spring with customizable, any turn may change the spring configuration can be saved in a file with the extension .FCSpring or in a coordonate file with the extension .FCSpringCoor
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
"""
***************************************************************************
* Copyright (c) <mario52> 2014-2015-2016-2017 2018 2019 2020 2022 2023 *
* 2024 *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
@mario52a
mario52a / Macro_FCCircularText.FCMacro
Last active October 17, 2024 17:47
This macro writes a text, standing or flat, circumferential or helical in the manner of Trajan Column and creates a clock with Arabic numerals 1 2 3 ... or Roman I II III ... (inspired to Macro to Create Clock Face to cblt2l). Also to follow the path with selection one wire, edge, line, circle.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) 2014 2015 2016 2017 2018 2019 2020 2021 2022 <mario52> *
* 2023 2024 *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
@mario52a
mario52a / Macro_CloneConvert.FCMacro
Last active August 12, 2021 23:52
Creates a clone or copy of the object and the converted in the chosen position and size (inch, mm, m, µm...) or free. The base object is recognized in mm (FreeCAd base)
# -*- coding: utf-8 -*-
# CloneConvert.FCMacro
# Cree un clone ou une copie de l'objet ou des objets selectionne(s) et le met e l'echelle de la grandeur choisie
# utilisation : lancer CloneConvert selectionnez un objet choisissez la grandeur et cliquez sur OK
#
# Creates a clone of one copy the selected object and updates the selected size range
# use: start CloneConvert select an object choose the size and click OK
#