中文版本在下方。
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:
-
Define your color in hex format as a string variable.
-
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
将颜色设为参数
希望让用户能够自定义颜色吗? 你可以轻松地将颜色转换为模型中的可调参数。 操作方法如下:
-
以十六进制格式将颜色定义为字符串变量(例子:#FFFFFF)。
-
在变量声明的末尾添加注释
// 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]);
**重要提示:**将颜色定义为参数时,仅支持十六进制字符串格式。