Description |
---|
Creates a 3D image from an 8 bit (256 color) BMP image. In other words, it allows one to build a 3D project very easily from a bitmap image using grayscale (256 shades of gray). If one 32 bit BMP image is selected, the image is represented in points. The FCCreaLoft Macro Loft macro is used to automate the multi loft operation. Macro version: 0.15 Last modified: 2025/01/04 FreeCAD version: 0.18 and more Download: ToolBar Icon Author: Mario52 |
Author |
Mario52 |
Download |
ToolBar Icon |
Links |
Macros recipes How to install macros How to customize toolbars |
Macro Version |
0.15 |
Date last modified |
2025/01/04 |
FreeCAD Version(s) |
0.18 and more |
Default shortcut |
None |
See also |
![]() |
This small macro allows one to build a 3D project very easily from a bitmap image with 256 shades of gray.
I hope that this macro will revolutionize the way we think when modeling with CAD and CNC converting to 3D objects with little to no intervention.
Everything becomes possible regardless of the complexity of the image!
The Macro Loft is used to automate the multi loft operation.
Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro
# This code is copied instead of the original macro code # to guide the user to the online download page. # Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki # or if the RAW code URL is somewhere else in the wiki. from PySide import QtGui, QtCore diag = QtGui.QMessageBox(QtGui.QMessageBox.Information, "Information", "This macro must be downloaded from this link\n" "\n" "https://gist.githubusercontent.com/mario52a/262317bc7d8555885b0e/raw/f18613c8bfd142e644ba79fc8dd34a5f72282f18/Macro%2520FCTexture.FCMacro" + "\n" "\n" "Quit this window to access the download page") diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) diag.setWindowModality(QtCore.Qt.ApplicationModal) diag.exec_() import webbrowser webbrowser.open("https://gist.githubusercontent.com/mario52a/262317bc7d8555885b0e/raw/f18613c8bfd142e644ba79fc8dd34a5f72282f18/Macro%2520FCTexture.FCMacro")
Texture 004 Honda
This macro requires an image in 256 shades of gray (0-255) therefore before executing the macro, convert your image into grayscale (black and white). When running the macro, the number of colors is detected automatically. Note: if the image is more than 256 colors another function is expected (WIP). Each color (gray level) is regarded as a deep, white (255) the level high and black (0) the lowest level (deep).
Configuration is done before the opening of the file, default values are the settings provided to get a project's dimensions:
The image file unfolds like a scanner x1 x2 x3 ... in 1 mm increments in FreeCAD similarly to the value y of 1 mm at a time. The value of z is given by the value of the color. These values are configurable in the macro.
Important note: depending on the size of the image, the project can become very large in size! For example, a simple image of (100px x 100px) width/height would be: 100 x 100 = 10000 points. Each of the 10,000 points corresponds to a coordinate, so that means 10000 X, 10000 Y, and 10000 Z coordinates in actuality.
The beginning of the operation value automatically adapts to the selected function: 0 if the setting is on black (Black) 255 or 20 if the setting is white (White).
true
(false
by default)Macro_Texture.FCMacro
Download the macro to Gist Macro FCTexture.FCMacro
The images were inclined to enhance the 3D effect.
Honda
Here with option contour
Here an example of a bmp image converted to points and restoring picture the width of the image is 6.5 nm
thanks for the permission of Yorik
Here an example of a bmp image converted to object 3D of 6.7 nm width.
thanks for the permission of Yorik
The logo of FreeCAD.
A portion of the screen FreeCAD. The file.
A portion of a tablecloth.
A diamond plate.
Mode Plan: the image on the left the white background has been ignored in the right image the colour black has been ignored (an example on the forum)
Topography from a drawing or each level is represented with a degrees of different color.
Image converted in ASCII caracter.
Procedure for create solid:
1: Create loft with the tools or with the
Macro Loft
2: Select all and extrude with the tools
3A: For Linux Download GMSHMesh (author psicofil) Macro_GMSH Wiki page
3B: For Windows Download GmshMesh2.zip unzip the file and install it in your Mod directory (author ulrich1a)
4: Create your Mesh file and use it
Convert solid in mesh with GmshMesh.
The discussion on the forum to give your impressions or contact me.
The macro Macro Loft for automate the multi loft.
How to handle pdf import properly and feasibly?
####new2
pathFile = os.path.dirname(SaveName) + "/" #= C:/Provisoire400/
formatFichier = os.path.splitext(SaveName)[1] #= .png
SaveName = os.path.splitext(SaveName)[0] #= /home/kubuntu/.FreeCAD/Macro/Texture_007_H #= C:/Provisoire400/image3D
SaveNameformatFichier = SaveName + formatFichier #= C:/Provisoire400/image3D.png
####new2
FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macros/FCMmacros/FCTexture").SetString("Path",pathFile)
####new
that causes an error with the version FreeCAD : Version: 0.14.3343 (Git), Python version: 2.7.6, Qt version: 4.8.5