Skip to main content

Posts

Showing posts with the label Macro

Editable ISO Mesh for Curves Workbench Part 1

I talked about creating a Rhino3D tween curve on my Patreon page a few weeks ago ( https://www.patreon.com/posts/75954207 ) and an idea that I have to get this working as a macro in #FreeCAD. But I thought I try to make a few intermediary macros to get myself back into the swings of programming again.  I already created the 'curve to freehand b-spline' in a previous post but now I want to take this a step further and create a 'ISO curve to freehand b-spline mesh'.  This means that there would be a fully eatable mesh that can be lofted, approximated with some kind of NURBS surface such as a Gordan surfaced or even a plane loft or ruled surface.  Building it with Freehand B-Splines will allow a user to double clicking the individual curves to edit the mesh via the control points.  The ISO surface interrogates a selected surface and creates a UV grid which follows the contours.  My idea is to take this ISO grid and make it fully editable as a mesh allow the resulti...

Curve Workbench Macro: Curve to Freehand B-Spline

FreeCAD Macro: Create Freehand B-Spline from a Selected Curve If you're exploring FreeCAD macros or looking to replicate Rhino3D’s tween curve functionality, this guide will walk you through how to create a freehand B-spline from a selected curve using the Curves workbench. This macro is part of an ongoing effort to bring more organic, editable curve control into FreeCAD. Goal: Convert a Selected Curve to a Freehand B-Spline The first step in this project is converting a selected edge or curve into a freehand B-spline, not directly connected, but one that follows the curvature of the original. This allows for more flexible editing and prepares us for the next stages, like applying this to ISO curves on a surface and generating multiple B-splines per edge. Watch the Macro in Action Here’s an unlisted video showing the macro in use: https://youtu.be/fycOs-0Oy8M What Is "Discretize" and Why Use It? To build a B-spline, we first discretize the edge. This simply mean...

Your first Macro "Hello World"

What is a Macro? A Macro is code which can be run to automate a tasks.  This general differs from standard programs as a macro is normally run through or targets an existing program to automate actions that would normally be done manually i.e. in FreeCAD to control a simulation or animation.   Why Do We Need One For Animation So why do we need these in animation?  There are a number of ways to create animation and some additional workbenches take over the need for macros, allowing for a process of recording the movement and playback these are fine for exploding and imploding assembles.  But if we want to go beyond seeing how things fit together and explore subject areas such as simulating a suspension system tackling bumpy roads then it is inevitable that we will need to write at least some code.  The aim is to write as little as possible and allow FreeCAD to do the hard work.  Your First Macro, 'Hello World!' So it's time to write your first macro! It...

FreeCAD: Introducing the Python Console and writing your first line of code

There is nothing like experimenting and seeing what happens when learning something new.  For millennia humans have learnt by doing, learning through success and failure. This process is known simply as 'play'.  FreeCAD offers a coding environment to allows you to do just that, it's called the Python Console. To start our experimenting we need to make the necessary panels available.  This will allow access to both the Python Console and the Report View. Python Console The Python Console allows us to enter and experiment with commands and to see what operations look like in code such as creating pads and pockets. The majority of these operations are translated and displayed in the panel as Python commands. To show this panel we go to the top menu and click on: View > Panels > Python Console Report View Any output that may result from executing our code, including those from FreeCAD itself, are displayed in the report view.  Messages such as warnings of potential...