Paramatric Model Maker V0.9.0 - Support Multi-Color Modeling

中文版本在下方。

English Version

We’re thrilled to announce that Parametric Model Maker V0.9.0 now supports multi-color model export! This exciting feature was made possible thanks to the valuable contributions of our amazing community (GitHub - ochafik/openscad at color-assimp2). Leveraging the latest OpenSCAD update, which allows color information to be exported with 3D models, Parametric Model Maker can now export vibrant, multi-color models in the 3MF format.

Creating Colorful Models

Parametric Model Maker makes creating multi-color models intuitive by using OpenSCAD’s familiar syntax for defining colors within your script:

color([1,0,0]) cube([2,3,4]);     // Red. Defined as an array with values in the 0~1 range
translate([3,0,0])
color("#00FF00") cube([2,3,4]);   // Green. Defined as a hex string
translate([6,0,0])
color("blue") cube([2,3,4]);      // Blue. Defined as a web color name string

For a deeper dive into OpenSCAD’s color functionalities, check out their documentation: OpenSCAD User Manual/First Steps/Changing the color of an object - Wikibooks, open books for an open world

Making Color a Parameter

Want to give your users the power to customize their creations? You can easily turn colors into adjustable parameters within your models. Here’s how:

  1. Define your color in hex format as a string variable.

  2. Add the comment // color at the end of the variable declaration. This signals to Parametric Model Maker that this variable represents a color parameter.

// Color for the first cube
color1="#FF0000"; // color
// Color for the second cube
color2="#00FF00"; // color
// Color for the third cube
color3="#0000FF"; // color

color(color1) cube([2,3,4]);
translate([3,0,0])
color(color2) cube([2,3,4]);
translate([6,0,0])
color(color3) cube([2,3,4]);

Important Note: When defining a color as a parameter, only the hex string format is supported.

中文版本

参数化模型编辑器 V0.9.0: 新增多色模型支持

我们很高兴地宣布,参数化模型编辑器 V0.9.0 现在支持多色模型导出! 此功能归功于OpenSCAD 社区的宝贵贡献(https://github.com/ochafik/openscad/tree/color-assimp2)。利用最新的 OpenSCAD 更新(允许将颜色信息导出到 3D 模型),参数化模型编辑器现在可以导出多彩的 3MF 格式模型。

创建彩色模型

参数化模型编辑器通过使用 OpenSCAD 定义颜色语法的熟悉方式,使创建多色模型变得直观:

color([1,0,0]) cube([2,3,4]);     // 红色。以 0~1 范围内的数组表达颜色
translate([3,0,0])
color("#00FF00") cube([2,3,4]);   // 绿色。以十六进制字符串表达颜色
translate([6,0,0])
color("blue") cube([2,3,4]);      // 蓝色。以颜色名称字符串表达颜色

有关 OpenSCAD 颜色功能的更深入了解,请查看其文档:OpenSCAD User Manual/First Steps/Changing the color of an object - Wikibooks, open books for an open world

将颜色设为参数

希望让用户能够自定义颜色吗? 你可以轻松地将颜色转换为模型中的可调参数。 操作方法如下:

  1. 以十六进制格式将颜色定义为字符串变量(例子:#FFFFFF)。

  2. 在变量声明的末尾添加注释 // color 这向参数化模型编辑器表明此变量表示颜色参数。

// 第一个立方体的颜色
color1="#FF0000"; // color
// 第二个立方体的颜色
color2="#00FF00"; // color
// 第三个立方体的颜色
color3="#0000FF"; // color
color(color1) cube([2,3,4]);
translate([3,0,0])
color(color2) cube([2,3,4]);
translate([6,0,0])
color(color3) cube([2,3,4]);

**重要提示:**将颜色定义为参数时,仅支持十六进制字符串格式。

8 Likes

Awesome!!! I have been waiting for this option sooo long.
After work I will start updating all my designs with this new feature, but first tests have worked great

2 Likes

Wow, this is a feature I’ve been waiting for forever! Huge shoutout to Olivier for getting this implemented. I don’t think it has even made it to the latest development build of OpenSCAD since it’s still on the color-assimp2 branch. Major props to the Bambu team for staying on top of these updates and making it available so quickly! This is going to be awesome!!

2 Likes

I would like to express my gratitude to Bambulab for referencing my model!
This provided me with the incentive to make adjustments to the .scad file, specifically enabling users to customize the color scheme of the QR code, the background, and the labels.

1 Like

Now, check all your existing uploads because you will have left some colour declarations in your code without thinking it would be included that may render as such where it wasn’t intended.

It hasn’t been included in the main development, there are two “implementations” that have significant side-effects. If this manages it without those and flawlessly, superb.

You can say a lot about MW and BL and how they fail to listen and make daft designs, but, the team doing this project nailed it! They should be applauded for the whole parametric solution.

1 Like

I just wish this level of listening to customers and creators alike would happen for all vital requests that have enough users behind it.
Don’t use parametric model makes as I can’t be bothered learning new tricks I have no real use for.
But even I see the benefits here.
Still try to keep my hopes up that one day Bambu will implement a properly capable, easy to use modelling option right into Studio.
Maybe not on par with Fusion360 in terms of engineering options or timeline based modifications.
Probably not any free forming, sandboxing or such options like Blender and such offer…
A nice and above child level modelling option though would clearly make a difference to many newbies in the 3D printing world…

Keep it Bambu, this one shall not be a one off to impress us :wink:

Bambu Studio offers a lot of flexibility with its built-in primitives for modeling. While it’s not full 3D sculpting, you can still do quite a bit—add negative parts, move objects along any axis, and rotate them as needed. Plus, there are various cutting features, like splitting objects with snaps and slides. There’s plenty to explore without needing to switch to another app!

1 Like

Basically parametric models are the reasson I’m uploading designs to makerworld.
For me it is the perfect mix between my designing skills and programming skills (the way I make a leaving).
Most of my designs are working pretty good, and during the last 4 or 5 months I have reached about 700/800 euros in gift cards thanks to this designs so no complain at all.

@PineappleBun_BBL I have already migrated some of my desings to start using the colouring function, and it is working great.
Ii is even helping me simplify some options, as now I don’t need to use a “preview” mode to show some pieces that were hard to see in just one colour.
For now I’ve migrated this:

I will continue tomorrow and the weekend with the rest of the designs.

Thanks a lot and feel free to contact me if you need any beta tester for future updates

2 Likes

I’m trying out the Multi-Color modeling and it seems to generate the model fine with all the coloring but when I go to download the 3mf file, it thinks for a while and then I get the message “Failed to download 3mf file”. Is there any way to get more information about what is causing it to fail? I can download the STL without problem.

Error generating OpenSCAD code

// Parameters
num_columns = 13; // Must be an odd number
num_rows = 13; // Must be an odd number
small_square_size = 3; // Size of the smaller squares
small_square_spacing = 2; // Spacing from the default positions
small_square_offset = -0.75; // Additional offset to move smaller squares closer to edges
large_square_size = 15; // Size of the larger squares
small_square_extrude = 1; // Extrusion height for smaller squares
large_square_extrude = 0.5; // Extrusion height for larger squares (base)

// Color Parameters (using hex color strings)
large_square_color1 = “#000000”; // Black
large_square_color2 = “#FFFFFF”; // White

// Derived parameters
center_column = floor(num_columns / 2);
center_row = floor(num_rows / 2);

// Calculate total size of the grid
total_width = num_columns * large_square_size;
total_height = num_rows * large_square_size;

// Module to create the pattern of smaller squares within a larger square
module small_square_pattern(i, j, larger_square_color)
{
// Determine the color of the smaller squares
small_square_color = (i == center_column && j == center_row) ? larger_square_color :
(larger_square_color == large_square_color1) ? large_square_color2 : large_square_color1;

// Positions within the larger square
edge_offset = small_square_spacing + small_square_offset;
left_edge_x = edge_offset;
right_edge_x = large_square_size - small_square_size - edge_offset;
top_edge_y = large_square_size - small_square_size - edge_offset;
bottom_edge_y = edge_offset;
center_pos = [large_square_size / 2 - small_square_size / 2, large_square_size / 2 - small_square_size / 2];

// Corner positions
TL = [left_edge_x, top_edge_y];          // Top-Left
TR = [right_edge_x, top_edge_y];         // Top-Right
BL = [left_edge_x, bottom_edge_y];       // Bottom-Left
BR = [right_edge_x, bottom_edge_y];      // Bottom-Right

// Positions for vertical alignment (central row)
left_vertical_positions = [ [left_edge_x, top_edge_y], [left_edge_x, bottom_edge_y] ];
right_vertical_positions = [ [right_edge_x, top_edge_y], [right_edge_x, bottom_edge_y] ];

// Positions for horizontal alignment (central column)
top_horizontal_positions = [ [left_edge_x, top_edge_y], [right_edge_x, top_edge_y] ];
bottom_horizontal_positions = [ [left_edge_x, bottom_edge_y], [right_edge_x, bottom_edge_y] ];

delta_i = i - center_column;
delta_j = j - center_row;

// Determine positions based on location
positions = 
    (i == center_column && j == center_row) ? [center_pos] :
    (j == center_row) ? (
        // On central horizontal line
        (i < center_column) ? right_vertical_positions :
        (i > center_column) ? left_vertical_positions :
        []
    ) :
    (i == center_column) ? (
        // On central vertical line
        (j < center_row) ? top_horizontal_positions :
        (j > center_row) ? bottom_horizontal_positions :
        []
    ) :
    // Quadrants
    (
        ((delta_i > 0 && delta_j > 0) || (delta_i < 0 && delta_j < 0)) ? [ TL, BR ] : // Quadrants I and III
        ((delta_i < 0 && delta_j > 0) || (delta_i > 0 && delta_j < 0)) ? [ TR, BL ] : // Quadrants II and IV
        []
    );

// Draw the smaller squares at the determined positions
for (pos = positions)
    translate([pos[0], pos[1], large_square_extrude])
        color(small_square_color)
        linear_extrude(height = small_square_extrude)
            square([small_square_size, small_square_size], center=false);

}

// Module to draw a larger square (base) and add the smaller squares pattern
module large_square_with_pattern(i, j)
{
// Determine color of the larger square based on position (checkerboard pattern)
larger_square_color = ((i + j) % 2 == 0) ? large_square_color1 : large_square_color2;

// Draw the base larger square with specified color
color(larger_square_color)
linear_extrude(height = large_square_extrude)
{
    square([large_square_size, large_square_size], center = false);
}

// Draw the pattern of smaller squares above the base
small_square_pattern(i, j, larger_square_color);

}

// Main module to generate the grid of larger squares
module grid_of_large_squares()
{
// Translate the entire grid to center it at [0, 0]
translate([-total_width / 2, -total_height / 2, 0])
{
for (i = [0 : num_columns - 1])
for (j = [0 : num_rows - 1])
{
translate([i * large_square_size, j * large_square_size, 0])
large_square_with_pattern(i, j);
}
}
}

// Call the main module to render the 3D object
grid_of_large_squares();

I could be too large and it cannot fit in a plate. Please try to resize it.

I was eventually able to fix it but the download to 3mf definitely needs some better error messages. I think it had something to do with overlapping geometries.

Are you planning to allow generating bigger models?
I’m working in a script that needs to generate 2 parts, that individualy will not be bigger than the build plate, but both at the same time could not fit.
Also an option for exporting the models in two plates would be great.

Hi All,
Firstly thanks for implementing this. I have used it on my gyro fidget maker and it is great!
I have found a “bug” / “quirk” that may cause problems when using difference().
It appears that if your “tool body” is a different colour than that of what you are cutting, the tool body leaves some of its colour behind. An easy workaround is to use color() on the resultant object or to make sure tools and object body are the same colour. This caught me out big time when I could not work out why colours that weren’t in the model appeared in the slicer.

The following code snippet demonstrates the issue.

difference()
{
    color("red")
    cylinder(r=10,h=20,center=true);
    color("blue")
    cube([5,5,25],center=true);
}
translate([25,0,0])
color("red")
difference()
{
    color("red")
    cylinder(r=10,h=20,center=true);
    color("blue")
    cube([5,5,25],center=true);
}
translate([50,0,0])
difference()
{
    color("red")
    cylinder(r=10,h=20,center=true);
    color("red")
    cube([5,5,25],center=true);
}
1 Like

Hi WardCons, thanks for using Parametric Model Maker! The “issue” mentioned is actually a feature. This feature is also demonstrated in the example provided by ochafik.
I agreed that it may introduce some confusion in some cases but it is still a great way to color a mesh with different colors.

1 Like

We will consider how to create 3mf with multiple plates. Do you have other features want to see in the future release?

1 Like

Hi, a few extra features it will make my life easier:

  • When generating multiple models in the same 3MF, export them as different objects. (Extra points for new objects for each color)
  • Allow set up some slicer parameters (for instance one of my models requires activate Ararchne wall generation, and plenty of users forget about it)
  • Allow uploading multiple svg/pngs.
  • Increase a little the max generation time (when using complex images, scripts will not run on makerlab just in local)
  • Fixing a bug that causes that when spliting a model in objects, it will loose all the color infomation.
    I will make you know if something new comes to my mind, as I’m always working in new scad projects.

I would add these

  • The ability to target multiple build plates
  • The ability to add PAUSE and COLOUR commands at specific layer heights
  • The ability to add Height Range Modifiers with at least a colour change.

The ability to hide the OpenSCAD source code. If you want people to post sophisticated models that take a lot of work, you are going to need the option to not reveal the source code.

3 Likes

I have written this request everywhere, yet no confirmation.

@MakerWorld Given the new exclusive models option, how can allowing the source code of models fully visible and “steal-able” be smart or even inline with the license you need to prove ownership.

Private code should at least be an option when uploading and with standard digital licence it should be the default or enforced.

1 Like

Thanks PineappleBun_BBL.
I now see that the ability to use the tool body colour to create different mesh colours can be very useful. I made a multicolour “stamp” from a svg image then used this to paint a mesh - very cool!
Recently I came across another issue with this feature where I was using a tool cutter to trim a multicoloured object. This did not work as the tool body painted the coloured objects.
Suggestion - if the difference() is made with an tool object that has not been colour()ed, keep the colour of the objects being cut.

Note - Is there a better place to post these suggestions?

Cheers