根据材料判断可显示内容。Gcode代码研究

This commit is contained in:
cjw 2025-03-04 10:06:19 +08:00
parent b2b9264d18
commit 2df7bf7e09
7 changed files with 590 additions and 211 deletions

View File

@ -2952,25 +2952,36 @@ inline std::string get_instance_name(const PrintObject* object, const PrintInsta
// In non-sequential mode, process_layer is called per each print_z height with all object and support layers accumulated.
// For multi-material prints, this routine minimizes extruder switches by gathering extruder specific extrusion paths
// and performing the extruder specific extrusions together.
//在顺序模式下每个对象及其副本调用一次process_layer
//因此层将包含一个条目singleobjectinstance-idx将指向对象的副本。
//在非顺序模式下根据每个print_z高度调用process_layer并累积所有对象和支持层。
//对于多材料打印,该程序通过收集挤出机特定的挤出路径,最大限度地减少了挤出机的切换
//并一起进行挤出机特定的挤出。
GCode::LayerResult GCode::process_layer(
const Print &print,
// Set of object & print layers of the same PrintObject and with the same print_z.
//具有相同PrintObject和相同print_z的对象和打印层集。
const std::vector<LayerToPrint> &layers,
const LayerTools &layer_tools,
const bool last_layer,
// Pairs of PrintObject index and its instance index.
//成对的PrintObject索引及其实例索引。
const std::vector<const PrintInstance*> *ordering,
// If set to size_t(-1), then print all copies of all objects.
// Otherwise print a single copy of a single object.
//如果设置为size_t-1则打印所有对象的所有副本。
//否则,打印单个对象的单个副本。
const size_t single_object_instance_idx,
// BBS
const bool prime_extruder)
{
assert(! layers.empty());
// Either printing all copies of all objects, or just a single copy of a single object.
//打印所有对象的所有副本,或仅打印单个对象的单个副本。
assert(single_object_instance_idx == size_t(-1) || layers.size() == 1);
// First object, support and raft layer, if available.
//第一个对象,支撑和筏板层(如果可用)。
const Layer *object_layer = nullptr;
const SupportLayer *support_layer = nullptr;
const SupportLayer *raft_layer = nullptr;
@ -2997,18 +3008,25 @@ GCode::LayerResult GCode::process_layer(
return result;
// Extract 1st object_layer and support_layer of this set of layers with an equal print_z.
//使用相等的print_z提取这组层的第一个object_layer和support_layer。
coordf_t print_z = layer.print_z;
//BBS: using layer id to judge whether the layer is first layer is wrong. Because if the normal
//support is attached above the object, and support layers has independent layer height, then the lowest support
//interface layer id is 0.
//BBS使用层id判断第一层是否错误。因为如果正常
//支撑物附着在物体上方,支撑层具有独立的层高,然后是最低的支撑物
//接口层id为0。
bool first_layer = (layer.id() == 0 && abs(layer.bottom_z()) < EPSILON);
unsigned int first_extruder_id = layer_tools.extruders.front();
// Initialize config with the 1st object to be printed at this layer.
//使用此层要打印的第一个对象初始化配置。
m_config.apply(layer.object()->config(), true);
// Check whether it is possible to apply the spiral vase logic for this layer.
// Just a reminder: A spiral vase mode is allowed for a single object, single material print only.
//检查是否可以对此层应用螺旋花瓶逻辑。
//提醒一下:螺旋花瓶模式只允许用于单个对象、单个材质打印。
m_enable_loop_clipping = true;
if (m_spiral_vase && layers.size() == 1 && support_layer == nullptr) {
bool enable = (layer.id() > 0 || !print.has_brim()) && (layer.id() >= (size_t)print.config().skirt_height.value && ! print.has_infinite_skirt());
@ -3023,6 +3041,7 @@ GCode::LayerResult GCode::process_layer(
}
result.spiral_vase_enable = enable;
// If we're going to apply spiralvase to this layer, disable loop clipping.
//如果我们要将spiralvase应用于此层请禁用循环剪裁。
m_enable_loop_clipping = !enable;
}
@ -3030,6 +3049,7 @@ GCode::LayerResult GCode::process_layer(
assert(is_decimal_separator_point()); // for the sprintfs
// add tag for processor
//为处理器添加标签
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Layer_Change) + "\n";
// export layer z
char buf[64];
@ -3045,6 +3065,7 @@ GCode::LayerResult GCode::process_layer(
m_last_height = height;
// Set new layer - this will change Z and force a retraction if retract_when_changing_layer is enabled.
//设置新图层-如果启用了retrackt_when_changing_layer这将更改Z并强制收缩。
if (! print.config().before_layer_change_gcode.value.empty()) {
DynamicConfig config;
config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index + 1));
@ -3079,6 +3100,7 @@ GCode::LayerResult GCode::process_layer(
};
// BBS: don't use lazy_raise when enable spiral vase
//BBS启用螺旋花瓶时不要使用lazy_reed
gcode += this->change_layer(print_z); // this will increase m_layer_index
m_layer = &layer;
m_object_layer_over_raft = false;
@ -3087,6 +3109,7 @@ GCode::LayerResult GCode::process_layer(
gcode += timepals_gcode;
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
//BBS检查自定义gcode是否更改了z位置。更改后更新
double temp_z_after_timepals_gcode;
if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) {
Vec3d pos = m_writer.get_position();
@ -3104,6 +3127,7 @@ GCode::LayerResult GCode::process_layer(
config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z));
}
//BBS: set layer time fan speed after layer change gcode
//BBS设置换层后的层时间风扇速度gcode
gcode += ";_SET_FAN_SPEED_CHANGING_LAYER\n";
if (print.calib_mode() == CalibMode::Calib_PA_Tower) {
@ -3133,6 +3157,7 @@ GCode::LayerResult GCode::process_layer(
//BBS
if (first_layer) {
//BBS: set first layer global acceleration
//BBS设置第一层全局加速
if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) {
double acceleration = m_config.initial_layer_acceleration.value;
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
@ -3144,6 +3169,7 @@ GCode::LayerResult GCode::process_layer(
if (! first_layer && ! m_second_layer_things_done) {
//BBS: open powerlost recovery
//BBS开放式断电恢复
{
if (print.is_BBL_Printer()) {
gcode += "; open powerlost recovery\n";
@ -3151,8 +3177,10 @@ GCode::LayerResult GCode::process_layer(
}
}
// BBS: open first layer inspection at second layer
//BBS第二层开放式第一层检查
if (print.config().scan_first_layer.value) {
// BBS: retract first to avoid droping when scan model
//BBS扫描模型时先缩回避免掉落
gcode += this->retract();
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
gcode += "M400 P100\n";
@ -3160,6 +3188,7 @@ GCode::LayerResult GCode::process_layer(
}
//BBS: reset acceleration at sencond layer
//BBS:重置第二层加速度
if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) {
double acceleration = m_config.default_acceleration.value;
gcode += m_writer.set_acceleration((unsigned int)floor(acceleration + 0.5));
@ -3170,6 +3199,8 @@ GCode::LayerResult GCode::process_layer(
// Transition from 1st to 2nd layer. Adjust nozzle temperatures as prescribed by the nozzle dependent
// nozzle_temperature_initial_layer vs. temperature settings.
//从第一层过渡到第二层。根据喷嘴的具体情况调整喷嘴温度
//喷嘴温度初始层与温度设置。
for (const Extruder &extruder : m_writer.extruders()) {
if (print.config().single_extruder_multi_material.value && extruder.id() != m_writer.extruder()->id())
// In single extruder multi material mode, set the temperature for the current extruder only.
@ -3183,10 +3214,12 @@ GCode::LayerResult GCode::process_layer(
int bed_temp = get_bed_temperature(first_extruder_id, false, print.config().curr_bed_type);
gcode += m_writer.set_bed_temperature(bed_temp);
// Mark the temperature transition from 1st to 2nd layer to be finished.
//标记待完成的第1层到第2层的温度转变。
m_second_layer_things_done = true;
}
// Map from extruder ID to <begin, end> index of skirt loops to be extruded with that extruder.
//从挤出机ID到使用该挤出机挤出的裙环的<beginend>索引的映射。
std::map<unsigned int, std::pair<size_t, size_t>> skirt_loops_per_extruder;
if (single_object_instance_idx == size_t(-1)) {
@ -3195,15 +3228,19 @@ GCode::LayerResult GCode::process_layer(
}
// Extrude skirt at the print_z of the raft layers and normal object layers
// not at the print_z of the interlaced support material layers.
//在筏层和普通对象层的print_z处挤出裙部
//而不是在交错支撑材料层的印刷z处。
skirt_loops_per_extruder = first_layer ?
Skirt::make_skirt_loops_per_extruder_1st_layer(print, layer_tools, m_skirt_done) :
Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done);
// BBS: get next extruder according to flush and soluble
//BBS根据冲洗和溶解情况获得下一台挤出机
auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values));
const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON);
// Extract purging volumes for each extruder pair:
//提取每对挤出机的吹扫体积:
std::vector<std::vector<float>> wipe_volumes;
for (unsigned int i = 0; i < number_of_extruders; ++i)
wipe_volumes.push_back(std::vector<float>(flush_matrix.begin() + i * number_of_extruders, flush_matrix.begin() + (i + 1) * number_of_extruders));
@ -3221,6 +3258,7 @@ GCode::LayerResult GCode::process_layer(
};
// Group extrusions by an extruder, then by an object, an island and a region.
//将挤出物按挤出机分组,然后按物体、岛屿和区域分组。
std::map<unsigned int, std::vector<ObjectByExtruder>> by_extruder;
bool is_anything_overridden = const_cast<LayerTools&>(layer_tools).wiping_extrusions().is_anything_overridden();
for (const LayerToPrint &layer_to_print : layers) {
@ -3232,15 +3270,20 @@ GCode::LayerResult GCode::process_layer(
bool has_support = role == erMixed || role == erSupportMaterial || role == erSupportTransition;
bool has_interface = role == erMixed || role == erSupportMaterialInterface;
// Extruder ID of the support base. -1 if "don't care".
//支撑底座的挤出机ID-1如果“不在乎”。
unsigned int support_extruder = object.config().support_filament.value - 1;
// Shall the support be printed with the active extruder, preferably with non-soluble, to avoid tool changes?
//支架是否应使用主动挤出机印刷,最好是不溶性的,以避免更换工具?
bool support_dontcare = object.config().support_filament.value == 0;
// Extruder ID of the support interface. -1 if "don't care".
//支撑接口的挤出机ID-1如果“不在乎”。
unsigned int interface_extruder = object.config().support_interface_filament.value - 1;
// Shall the support interface be printed with the active extruder, preferably with non-soluble, to avoid tool changes?
//支撑接口是否应使用主动挤出机打印,最好是不可溶的,以避免更换工具?
bool interface_dontcare = object.config().support_interface_filament.value == 0;
// BBS: apply wiping overridden extruders
//BBS应用擦拭超控挤出机
WipingExtrusions& wiping_extrusions = const_cast<LayerTools&>(layer_tools).wiping_extrusions();
if (support_dontcare) {
int extruder_override = wiping_extrusions.get_support_extruder_overrides(&object);
@ -3259,6 +3302,7 @@ GCode::LayerResult GCode::process_layer(
}
// BBS: try to print support base with a filament other than interface filament
//BBS尝试用界面灯丝以外的灯丝打印支撑底座
if (support_dontcare && !interface_dontcare) {
unsigned int dontcare_extruder = first_extruder_id;
for (unsigned int extruder_id : layer_tools.extruders) {
@ -3266,6 +3310,7 @@ GCode::LayerResult GCode::process_layer(
continue;
//BBS: now we don't consider interface filament used in other object
//BBS现在我们不考虑其他物体中使用的界面灯丝
if (extruder_id == interface_extruder)
continue;
@ -3274,6 +3319,7 @@ GCode::LayerResult GCode::process_layer(
}
#if 0
//BBS: not found a suitable extruder in current layer ,dontcare_extruider==first_extruder_id==interface_extruder
//BBS在当前层中找不到合适的挤出机请不要使用extruider==first_extruder_id==interface_extruder
if (dontcare_extruder == interface_extruder && (object.config().support_interface_not_for_body && object.config().support_interface_filament.value!=0)) {
// BBS : get a suitable extruder from other layer
auto all_extruders = print.extruders();
@ -3287,10 +3333,14 @@ GCode::LayerResult GCode::process_layer(
else if (support_dontcare || interface_dontcare) {
// Some support will be printed with "don't care" material, preferably non-soluble.
// Is the current extruder assigned a soluble filament?
//一些支架将印有“不在乎”的材料,最好是不溶性的。
//当前的挤出机是否分配了可溶性长丝?
unsigned int dontcare_extruder = first_extruder_id;
if (print.config().filament_soluble.get_at(dontcare_extruder)) {
// The last extruder printed on the previous layer extrudes soluble filament.
// Try to find a non-soluble extruder on the same layer.
//印刷在前一层上的最后一台挤出机挤出可溶性长丝。
//试着在同一层上找到一个不溶的挤出机。
for (unsigned int extruder_id : layer_tools.extruders)
if (! print.config().filament_soluble.get_at(extruder_id)) {
dontcare_extruder = extruder_id;
@ -3304,6 +3354,8 @@ GCode::LayerResult GCode::process_layer(
}
// Both the support and the support interface are printed with the same extruder, therefore
// the interface may be interleaved with the support base.
//支架和支架接口都是用同一台挤出机印刷的,因此
//接口可以与支撑基座交错。
bool single_extruder = ! has_support || support_extruder == interface_extruder;
// Assign an extruder to the base.
ObjectByExtruder &obj = object_by_extruder(by_extruder, has_support ? support_extruder : interface_extruder, &layer_to_print - layers.data(), layers.size());
@ -3328,10 +3380,21 @@ GCode::LayerResult GCode::process_layer(
// - for each island, we extrude perimeters first, unless user set the infill_first
// option
// (Still, we have to keep track of regions because we need to apply their config)
//我们现在定义一个构建边界和填充物的策略。分离
//就打印顺序而言,地区之间并不重要,如下所述
//另一种逻辑:
//-我们按挤出机对所有挤出物进行分组,以尽量减少工具更改
//-我们从上次使用的挤出机开始
//-对于每台挤出机,我们按岛对挤出机进行分组
//-对于每个岛屿我们首先拉伸周界除非用户设置了fill_first
//选项
//(不过,我们必须跟踪区域,因为我们需要应用它们的配置)
size_t n_slices = layer.lslices.size();
const std::vector<BoundingBox> &layer_surface_bboxes = layer.lslices_bboxes;
// Traverse the slices in an increasing order of bounding box size, so that the islands inside another islands are tested first,
// so we can just test a point inside ExPolygon::contour and we may skip testing the holes.
//按照边界框大小的递增顺序遍历切片,以便首先测试另一个岛内的岛,
//所以我们可以只测试ExPolygon::轮廓内的一个点,我们可以跳过测试孔。
std::vector<size_t> slices_test_order;
slices_test_order.reserve(n_slices);
for (size_t i = 0; i < n_slices; ++ i)
@ -3354,28 +3417,38 @@ GCode::LayerResult GCode::process_layer(
continue;
// PrintObjects own the PrintRegions, thus the pointer to PrintRegion would be unique to a PrintObject, they would not
// identify the content of PrintRegion accross the whole print uniquely. Translate to a Print specific PrintRegion.
//PrintObjects拥有PrintRegions因此指向PrintRegion的指针对于PrintObject来说是唯一的它们不会
//在整个打印中唯一标识PrintRegion的内容。转换为特定于打印的打印区域。
const PrintRegion &region = print.get_print_region(layerm->region().print_region_id());
// Now we must process perimeters and infills and create islands of extrusions in by_region std::map.
// It is also necessary to save which extrusions are part of MM wiping and which are not.
// The process is almost the same for perimeters and infills - we will do it in a cycle that repeats twice:
//现在我们必须处理周界和填充并在by_region std:map中创建拉伸岛。
//还需要保存哪些挤压件是MM擦拭的一部分哪些不是。
//对于周界和填充物,这个过程几乎是一样的——我们将在一个重复两次的循环中完成:
std::vector<unsigned int> printing_extruders;
for (const ObjectByExtruder::Island::Region::Type entity_type : { ObjectByExtruder::Island::Region::INFILL, ObjectByExtruder::Island::Region::PERIMETERS }) {
for (const ExtrusionEntity *ee : (entity_type == ObjectByExtruder::Island::Region::INFILL) ? layerm->fills.entities : layerm->perimeters.entities) {
// extrusions represents infill or perimeter extrusions of a single island.
//拉伸表示单个岛的填充或周边拉伸。
assert(dynamic_cast<const ExtrusionEntityCollection*>(ee) != nullptr);
const auto *extrusions = static_cast<const ExtrusionEntityCollection*>(ee);
if (extrusions->entities.empty()) // This shouldn't happen but first_point() would fail.
if (extrusions->entities.empty()) // This shouldn't happen but first_point() would fail.//这不应该发生但first_point会失败。
continue;
// This extrusion is part of certain Region, which tells us which extruder should be used for it:
//该挤压机是某个区域的一部分,该区域告诉我们应使用哪个挤压机:
int correct_extruder_id = layer_tools.extruder(*extrusions, region);
// Let's recover vector of extruder overrides:
//让我们恢复挤出机覆盖的向量:
const WipingExtrusions::ExtruderPerCopy *entity_overrides = nullptr;
if (! layer_tools.has_extruder(correct_extruder_id)) {
// this entity is not overridden, but its extruder is not in layer_tools - we'll print it
// by last extruder on this layer (could happen e.g. when a wiping object is taller than others - dontcare extruders are eradicated from layer_tools)
//此实体未被覆盖但其挤出机不在layertools中-我们将打印它
//通过该层上的最后一个挤出机(例如,当擦拭物体比其他物体高时,可能会发生这种情况-不小心挤出机从层工具中消失)
correct_extruder_id = layer_tools.extruders.back();
}
printing_extruders.clear();
@ -3388,8 +3461,10 @@ GCode::LayerResult GCode::process_layer(
for (int extruder : *entity_overrides)
printing_extruders.emplace_back(extruder >= 0 ?
// at least one copy is overridden to use this extruder
//至少有一个副本被覆盖以使用此挤出机
extruder :
// at least one copy would normally be printed with this extruder (see get_extruder_overrides function for explanation)
//此挤出机通常至少会打印一份副本有关说明请参阅get_extruderoverride函数
static_cast<unsigned int>(- extruder - 1));
Slic3r::sort_remove_duplicates(printing_extruders);
}
@ -3397,6 +3472,7 @@ GCode::LayerResult GCode::process_layer(
printing_extruders.emplace_back(correct_extruder_id);
// Now we must add this extrusion into the by_extruder map, once for each extruder that will print it:
//现在我们必须将此挤出添加到by_extruder映射中每个将打印它的挤出机一次
for (unsigned int extruder : printing_extruders)
{
std::vector<ObjectByExtruder::Island> &islands = object_islands_by_extruder(
@ -3407,9 +3483,9 @@ GCode::LayerResult GCode::process_layer(
for (size_t i = 0; i <= n_slices; ++ i) {
bool last = i == n_slices;
size_t island_idx = last ? n_slices : slices_test_order[i];
if (// extrusions->first_point does not fit inside any slice
if (// extrusions->first_point does not fit inside any slice //挤出->first_point不适合任何切片
last ||
// extrusions->first_point fits inside ith slice
// extrusions->first_point fits inside ith slice //挤压件->第一点与切片内部相匹配
point_inside_surface(island_idx, extrusions->first_point())) {
if (islands[island_idx].by_region.empty())
islands[island_idx].by_region.assign(print.num_print_regions(), ObjectByExtruder::Island::Region());
@ -3428,6 +3504,7 @@ GCode::LayerResult GCode::process_layer(
m_wipe_tower->set_is_first_print(true);
// Extrude the skirt, brim, support, perimeters, infill ordered by the extruders.
//按照挤出机的顺序挤出裙子、帽沿、支撑、周边和填充物。
for (unsigned int extruder_id : layer_tools.extruders)
{
if (has_wipe_tower) {
@ -3440,6 +3517,7 @@ GCode::LayerResult GCode::process_layer(
gcode += timepals_gcode;
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
//BBS检查自定义gcode是否更改了z位置。更改后更新
double temp_z_after_timepals_gcode;
if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) {
Vec3d pos = m_writer.get_position();
@ -3455,6 +3533,7 @@ GCode::LayerResult GCode::process_layer(
}
// let analyzer tag generator aware of a role type change
//让分析器标签生成器知道角色类型的更改
if (layer_tools.has_wipe_tower && m_wipe_tower)
m_last_processor_extrusion_role = erWipeTower;
@ -3466,16 +3545,19 @@ GCode::LayerResult GCode::process_layer(
double mm3_per_mm = layer_skirt_flow.mm3_per_mm();
for (size_t i = loops.first; i < loops.second; ++i) {
// Adjust flow according to this layer's layer height.
//根据此层的层高调整流量。
ExtrusionLoop loop = *dynamic_cast<const ExtrusionLoop*>(print.skirt().entities[i]);
for (ExtrusionPath &path : loop.paths) {
path.height = layer_skirt_flow.height();
path.mm3_per_mm = mm3_per_mm;
}
//FIXME using the support_speed of the 1st object printed.
//FIXME使用打印的第一个对象的support_speed。
gcode += this->extrude_loop(loop, "skirt", m_config.support_speed.value);
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point if this is the first layer (but don't in next layers).
//如果这是第一层,则允许直线移动到第一个对象点(但不要在下一层中)。
if (first_layer && loops.first == 0)
m_avoid_crossing_perimeters.disable_once();
}
@ -3485,6 +3567,7 @@ GCode::LayerResult GCode::process_layer(
continue;
// BBS: ordering instances by extruder
//BBS按挤出机订购实例
std::vector<InstanceToPrint> instances_to_print;
bool has_prime_tower = print.config().enable_prime_tower
&& print.extruders().size() > 1
@ -3532,6 +3615,7 @@ GCode::LayerResult GCode::process_layer(
}
// We are almost ready to print. However, we must go through all the objects twice to print the the overridden extrusions first (infill/perimeter wiping feature):
//我们几乎准备好打印了。但是,我们必须对所有对象进行两次检查,才能首先打印覆盖的拉伸(填充/周界擦拭功能):
std::vector<ObjectByExtruder::Island::Region> by_region_per_copy_cache;
for (int print_wipe_extrusions = is_anything_overridden; print_wipe_extrusions>=0; --print_wipe_extrusions) {
if (is_anything_overridden && print_wipe_extrusions == 0)
@ -3540,6 +3624,7 @@ GCode::LayerResult GCode::process_layer(
const auto& inst = instance_to_print.print_object.instances()[instance_to_print.instance_id];
const LayerToPrint &layer_to_print = layers[instance_to_print.layer_id];
// To control print speed of the 1st object layer printed over raft interface.
//控制在筏界面上打印的第一个对象层的打印速度。
bool object_layer_over_raft = layer_to_print.object_layer && layer_to_print.object_layer->id() > 0 &&
instance_to_print.print_object.slicing_parameters().raft_layers() == layer_to_print.object_layer->id();
m_config.apply(instance_to_print.print_object.config(), true);
@ -3556,12 +3641,14 @@ GCode::LayerResult GCode::process_layer(
start_str += "\n";
} else {
// BBS: support octoprint exclude object
//BBS:支持octoprint排除对象
start_str += std::string("; printing object ") + get_instance_name(&instance_to_print.print_object, inst.id) + "\n";
}
temp_start_str = start_str;
m_writer.set_object_start_str(start_str);
}
//Orca's implementation for skipping object, for klipper firmware printer only
//Orca的跳过对象实现仅适用于klipper固件打印机
bool reset_e = false;
if (this->config().exclude_object && print.config().gcode_flavor.value == gcfKlipper) {
gcode += std::string("EXCLUDE_OBJECT_START NAME=") +
@ -3572,6 +3659,7 @@ GCode::LayerResult GCode::process_layer(
gcode += m_writer.reset_e(true);
// When starting a new object, use the external motion planner for the first travel move.
//启动新对象时,使用外部运动规划器进行第一次移动。
const Point &offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;
std::pair<const PrintObject*, Point> this_object_copy(&instance_to_print.print_object, offset);
if (m_last_obj_copy != this_object_copy)
@ -3583,6 +3671,7 @@ GCode::LayerResult GCode::process_layer(
m_object_layer_over_raft = false;
//BBS: print supports' brims first
//BBS:打印支持'边缘优先
if (this->m_objSupportsWithBrim.find(instance_to_print.print_object.id()) != this->m_objSupportsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
@ -3591,10 +3680,12 @@ GCode::LayerResult GCode::process_layer(
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
//允许直线移动到第一个目标点。
m_avoid_crossing_perimeters.disable_once();
this->m_objSupportsWithBrim.erase(instance_to_print.print_object.id());
}
// When starting a new object, use the external motion planner for the first travel move.
//启动新对象时,使用外部运动规划器进行第一次移动。
const Point& offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;
std::pair<const PrintObject*, Point> this_object_copy(&instance_to_print.print_object, offset);
if (m_last_obj_copy != this_object_copy)
@ -3613,6 +3704,7 @@ GCode::LayerResult GCode::process_layer(
if (is_overridden == (print_wipe_extrusions != 0))
gcode += this->extrude_support(
// support_extrusion_role is erSupportMaterial, erSupportTransition, erSupportMaterialInterface or erMixed for all extrusion paths.
//对于所有挤出路径support_extrusion_role为erSupportMaterial、erSupportTransition、erSupportMaterialInterface或erMixed。
instance_to_print.object_by_extruder.support->chained_path_from(m_last_pos, support_extrusion_role));
m_layer = layer_to_print.layer();
@ -3620,9 +3712,12 @@ GCode::LayerResult GCode::process_layer(
}
//FIXME order islands?
// Sequential tool path ordering of multiple parts within the same object, aka. perimeter tracking (#5511)
//FIXME订购岛屿
//同一对象内多个零件的顺序刀具路径排序,又名。周界跟踪(#5511
for (ObjectByExtruder::Island &island : instance_to_print.object_by_extruder.islands) {
const auto& by_region_specific = is_anything_overridden ? island.by_region_per_copy(by_region_per_copy_cache, static_cast<unsigned int>(instance_to_print.instance_id), extruder_id, print_wipe_extrusions != 0) : island.by_region;
//BBS: add brim by obj by extruder
//BBS通过挤出机通过obj添加边缘
if (this->m_objsWithBrim.find(instance_to_print.print_object.id()) != this->m_objsWithBrim.end() && !print_wipe_extrusions) {
this->set_origin(0., 0.);
m_avoid_crossing_perimeters.use_external_mp();
@ -3631,10 +3726,12 @@ GCode::LayerResult GCode::process_layer(
}
m_avoid_crossing_perimeters.use_external_mp(false);
// Allow a straight travel move to the first object point.
//允许直线移动到第一个目标点。
m_avoid_crossing_perimeters.disable_once();
this->m_objsWithBrim.erase(instance_to_print.print_object.id());
}
// When starting a new object, use the external motion planner for the first travel move.
//启动新对象时,使用外部运动规划器进行第一次移动。
const Point& offset = instance_to_print.print_object.instances()[instance_to_print.instance_id].shift;
std::pair<const PrintObject*, Point> this_object_copy(&instance_to_print.print_object, offset);
if (m_last_obj_copy != this_object_copy)
@ -3642,6 +3739,7 @@ GCode::LayerResult GCode::process_layer(
m_last_obj_copy = this_object_copy;
this->set_origin(unscale(offset));
//FIXME the following code prints regions in the order they are defined, the path is not optimized in any way.
//FIXME以下代码按定义的顺序打印区域路径没有以任何方式优化。
bool is_infill_first =print.config().is_infill_first;
auto has_infill = [](const std::vector<ObjectByExtruder::Island::Region> &by_region) {
@ -3654,6 +3752,8 @@ GCode::LayerResult GCode::process_layer(
//BBS: for first layer, we always print wall firstly to get better bed adhesive force
//This behaviour is same with cura
//BBS对于第一层我们总是先打印墙壁以获得更好的床附着力
//这种行为与cura相同
if (is_infill_first && !first_layer) {
if (!has_wipe_tower && need_insert_timelapse_gcode_for_traditional && !has_insert_timelapse_gcode && has_infill(by_region_specific)) {
gcode += this->retract(false, false, LiftType::NormalLift);
@ -3668,6 +3768,7 @@ GCode::LayerResult GCode::process_layer(
gcode += timepals_gcode;
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
//BBS检查自定义gcode是否更改了z位置。更改后更新
double temp_z_after_timepals_gcode;
if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) {
Vec3d pos = m_writer.get_position();
@ -3697,6 +3798,7 @@ GCode::LayerResult GCode::process_layer(
gcode += timepals_gcode;
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
//BBS检查自定义gcode是否更改了z位置。更改后更新
double temp_z_after_timepals_gcode;
if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) {
Vec3d pos = m_writer.get_position();
@ -3715,6 +3817,7 @@ GCode::LayerResult GCode::process_layer(
gcode += this->extrude_infill(print,by_region_specific, true);
}
// Don't set m_gcode_label_objects_end if you don't had to write the m_gcode_label_objects_start.
//如果不必编写m_gcode_label_objects_start则不要设置m_gcode_label_objects\end。
if (!m_writer.empty_object_start_str()) {
m_writer.set_object_start_str("");
} else if (m_enable_label_object) {
@ -3724,6 +3827,7 @@ GCode::LayerResult GCode::process_layer(
m_writer.set_object_end_str(end_str);
}
//Orca's implementation for skipping object, for klipper firmware printer only
//Orca的跳过对象实现仅适用于klipper固件打印机
if (this->config().exclude_object && print.config().gcode_flavor.value == gcfKlipper) {
gcode += std::string("EXCLUDE_OBJECT_END NAME=") +
get_instance_name(&instance_to_print.print_object, inst.id) + "\n";
@ -3781,6 +3885,7 @@ GCode::LayerResult GCode::process_layer(
gcode += timepals_gcode;
m_writer.set_current_position_clear(false);
//BBS: check whether custom gcode changes the z position. Update if changed
//BBS检查自定义gcode是否更改了z位置。更改后更新
double temp_z_after_timepals_gcode;
if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) {
Vec3d pos = m_writer.get_position();

View File

@ -1163,11 +1163,11 @@ void PrintConfigDef::init_fff_params()
def->enum_values.push_back("monotonicline");
def->enum_values.push_back("alignedrectilinear");
//xiamian-
//def->enum_values.push_back("hilbertcurve");
//def->enum_values.push_back("archimedeanchords");
//def->enum_values.push_back("octagramspiral");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral");
//xiamian+
def->enum_values.push_back("fiberspiral");
//def->enum_values.push_back("fiberspiral");
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Rectilinear"));
@ -1175,11 +1175,11 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Monotonic line"));
def->enum_labels.push_back(L("Aligned Rectilinear"));
//xiamian-
//def->enum_labels.push_back(L("Hilbert Curve"));
//def->enum_labels.push_back(L("Archimedean Chords"));
//def->enum_labels.push_back(L("Octagram Spiral"));
def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back(L("Octagram Spiral"));
//xiamian+
def->enum_labels.push_back(L("Fiber Spiral"));
//def->enum_labels.push_back(L("Fiber Spiral"));
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipRectilinear));
def = this->add("bottom_surface_pattern", coEnum);
@ -1618,14 +1618,14 @@ void PrintConfigDef::init_fff_params()
def->enum_values.push_back("alignedrectilinear");
def->enum_values.push_back("3dhoneycomb");
//xiamian-
//def->enum_values.push_back("hilbertcurve");
//def->enum_values.push_back("archimedeanchords");
//def->enum_values.push_back("octagramspiral");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("archimedeanchords");
def->enum_values.push_back("octagramspiral");
def->enum_values.push_back("supportcubic");
def->enum_values.push_back("lightning");
def->enum_values.push_back("crosshatch");
//xiamian+
def->enum_values.push_back("fiberspiral");
//def->enum_values.push_back("fiberspiral");
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Grid"));
@ -1639,15 +1639,15 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Aligned Rectilinear"));
def->enum_labels.push_back(L("3D Honeycomb"));
//xiamian-
//def->enum_labels.push_back(L("Hilbert Curve"));
//def->enum_labels.push_back(L("Archimedean Chords"));
//def->enum_labels.push_back(L("Octagram Spiral"));
def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back(L("Archimedean Chords"));
def->enum_labels.push_back(L("Octagram Spiral"));
def->enum_labels.push_back(L("Support Cubic"));
def->enum_labels.push_back(L("Lightning"));
def->enum_labels.push_back(L("Cross Hatch"));
//xiamian+
def->enum_labels.push_back(L("Fiber Spiral"));
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipCubic));
//def->enum_labels.push_back(L("Fiber Spiral"));
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipGrid));
def = this->add("top_surface_acceleration", coFloat);
def->label = L("Top surface");
@ -1776,8 +1776,18 @@ void PrintConfigDef::init_fff_params()
def->tooltip = L("Height of initial layer. Making initial layer height thick slightly can improve build plate adhension");
def->sidetext = L("mm");
def->min = 0;
//def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.2));
//def = this->add("initial_layer_print_height", coFloat);
//def->label = L("Initial layer height");
//def->category = L("Quality");
//def->tooltip = L("Height of initial layer. Making initial layer height thick slightly can improve build plate adhension");
//def->sidetext = L("mm");
//def->min = 0;
//def->mode = comSimple;
//def->set_default_value(new ConfigOptionFloat(0.2));
//def = this->add("adaptive_layer_height", coBool);
//def->label = L("Adaptive layer height");
//def->category = L("Quality");
@ -3966,6 +3976,25 @@ void PrintConfigDef::init_fff_params()
" Otherwise, rectilinear pattern is used defaultly.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(true));
//def = this->add("temp_fiber_pattern", coEnum);
//def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
//def->enum_values.push_back("concentric");
//def->enum_values.push_back("zig-zag");
//def->enum_values.push_back("monotonic");
//def->enum_values.push_back("monotonicline");
//def->enum_values.push_back("alignedrectilinear");
//def->enum_values.push_back("fiberspiral");
//def->enum_labels.push_back(L("Concentric"));
//def->enum_labels.push_back(L("Rectilinear"));
//def->enum_labels.push_back(L("Monotonic"));
//def->enum_labels.push_back(L("Monotonic line"));
//def->enum_labels.push_back(L("Aligned Rectilinear"));
//def->enum_labels.push_back(L("Fiber Spiral"));
//def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipRectilinear));
}
void PrintConfigDef::init_extruder_option_keys()

View File

@ -513,9 +513,11 @@ public:
*/
wxBitmap new_bmp("E:\\Code\\Projects\\BambuStudio\\resources\\images\\back123.png", wxBITMAP_TYPE_PNG);
new_bmp.SetHeight(height);
new_bmp.SetWidth(width);
//wxBitmap new_bmp("D:\\Code\\Projects\\BambuStudio\\resources\\images\\back123.png", wxBITMAP_TYPE_PNG);
BitmapCache new_cache;
wxBitmap new_bmp = *new_cache.load_png("back123", width, height);
//new_bmp.SetHeight(height);
//new_bmp.SetWidth(width);
return new_bmp;
}

View File

@ -964,6 +964,7 @@ Sidebar::Sidebar(Plater *parent)
{
p->editing_filament = 0;
combobox->switch_to_tab();
p->combo_config->update();
});
combobox->edit_btn = edit_btn;
@ -6507,6 +6508,16 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
if (flag != flag_is_change) {
sidebar->auto_calc_flushing_volumes(idx);
}
//wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box()->Update();
//wxGetApp().preset_bundle->configs.get_preset_base()->Update();
//p->combo_config->update();
wxGetApp().sidebar().update_presets(Preset::TYPE_CONFIG);
//wxGetApp().preset_bundle->configs.Update();
//TabPresetComboBox* tabCombo = wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box();
//tabCombo->update();
//wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box()->presets()->reset(false);
wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box()->update();
//wxGetApp().get_tab(Preset::TYPE_CONFIG)->load_current_preset();
}
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
// TODO: ?

View File

@ -830,6 +830,7 @@ bool PlaterPresetComboBox::switch_to_tab()
return false;
}
}
//wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box()->Update();
}
/*
@ -969,6 +970,7 @@ void PlaterPresetComboBox::update()
bool wide_icons = selected_preset && !selected_preset->is_compatible;
std::map<wxString, wxBitmap*> nonsys_presets;
std::map<wxString, wxBitmap*> temp_presets;
//BBS: add project embedded presets logic
std::map<wxString, wxBitmap*> project_embedded_presets;
std::map<wxString, wxBitmap *> system_presets;
@ -1057,11 +1059,43 @@ void PlaterPresetComboBox::update()
//BBS: add project embedded preset logic
if (m_type == Preset::TYPE_CONFIG) {
wxString lian_xu = _L("Lian xu");
bool m_fold = false;
//m_preset_bundle->filament_presets
for (auto& f : m_preset_bundle->filament_presets) {
wxString abc = wxString::FromUTF8(f);
if (m_fold = abc.Contains(lian_xu)) {
break;
}
}
if (m_fold){
/* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
wxString key = it->first;
temp_presets.insert
}*/
temp_presets.clear();
for (const auto& pair : nonsys_presets) {
if (m_fold) {
wxString key = pair.first;
if (key.Contains(lian_xu)) {
temp_presets.emplace(pair);
}
}
}
for (std::map<wxString, wxBitmap*>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) {
SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
validate_selection(it->first == selected_user_preset);
}
//m_collection->cbegin
}
else {
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]);
validate_selection(it->first == selected_user_preset);
}
}
}
else {
if (!project_embedded_presets.empty())
{
@ -1233,6 +1267,7 @@ void TabPresetComboBox::update()
const std::deque<Preset>& presets = m_collection->get_presets();
std::map<wxString, std::pair<wxBitmap*, bool>> nonsys_presets;
std::map<wxString, std::pair<wxBitmap*, bool>> temp_presets;
//BBS: add project embedded presets logic
std::map<wxString, std::pair<wxBitmap*, bool>> project_embedded_presets;
//BBS: move system to the end
@ -1302,6 +1337,40 @@ void TabPresetComboBox::update()
//BBS: add project embedded preset logic
if (m_type == Preset::TYPE_CONFIG) {
wxString lian_xu = _L("Lian xu");
bool m_fold = false;
//m_preset_bundle->filament_presets
for (auto& f : m_preset_bundle->filament_presets) {
wxString abc = wxString::FromUTF8(f);
if (m_fold = abc.Contains(lian_xu)) {
break;
}
}
if (m_fold) {
/* for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
wxString key = it->first;
temp_presets.insert
}*/
temp_presets.clear();
for (const auto& pair : nonsys_presets) {
if (m_fold) {
wxString key = pair.first;
if (key.Contains(lian_xu)) {
temp_presets.emplace(pair);
}
}
}
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = temp_presets.begin(); it != temp_presets.end(); ++it) {
int item_id = Append(it->first, *it->second.first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
bool is_enabled = it->second.second;
if (!is_enabled)
set_label_marker(item_id, LABEL_ITEM_DISABLED);
validate_selection(it->first == selected);
}
}
else {
for (std::map<wxString, std::pair<wxBitmap*, bool>>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
int item_id = Append(it->first, *it->second.first);
SetItemTooltip(item_id, preset_descriptions[it->first]);
@ -1311,6 +1380,7 @@ void TabPresetComboBox::update()
validate_selection(it->first == selected);
}
}
}
else {
if (!project_embedded_presets.empty())
{

View File

@ -3026,7 +3026,7 @@ void TabFilament::build()
optgroup->append_line(line);
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value) {
DynamicPrintConfig &filament_config = wxGetApp().preset_bundle->filaments.get_edited_preset().config;
DynamicPrintConfig& filament_config = wxGetApp().preset_bundle->filaments.get_edited_preset().config;
update_dirty();
if (!m_postpone_update_ui && (opt_key == "nozzle_temperature_range_low" || opt_key == "nozzle_temperature_range_high")) {
@ -3037,7 +3037,7 @@ void TabFilament::build()
optgroup = page->new_optgroup(L("Print temperature"), L"param_temperature");
optgroup->append_single_option_line("chamber_temperatures","chamber-temperature");
optgroup->append_single_option_line("chamber_temperatures", "chamber-temperature");
line = { L("Nozzle"), L("Nozzle temperature when printing") };
line.append_option(optgroup->get_option("nozzle_temperature_initial_layer"));
@ -3054,12 +3054,12 @@ void TabFilament::build()
line.append_option(optgroup->get_option("eng_plate_temp"));
optgroup->append_line(line);
line = {L("Smooth PEI Plate / High Temp Plate"), L("Bed temperature when Smooth PEI Plate/High temperature plate is installed. Value 0 means the filament does not support to print on the Smooth PEI Plate/High Temp Plate") };
line = { L("Smooth PEI Plate / High Temp Plate"), L("Bed temperature when Smooth PEI Plate/High temperature plate is installed. Value 0 means the filament does not support to print on the Smooth PEI Plate/High Temp Plate") };
line.append_option(optgroup->get_option("hot_plate_temp_initial_layer"));
line.append_option(optgroup->get_option("hot_plate_temp"));
optgroup->append_line(line);
line = {L("Textured PEI Plate"), L("Bed temperature when Textured PEI Plate is installed. Value 0 means the filament does not support to print on the Textured PEI Plate")};
line = { L("Textured PEI Plate"), L("Bed temperature when Textured PEI Plate is installed. Value 0 means the filament does not support to print on the Textured PEI Plate") };
line.append_option(optgroup->get_option("textured_plate_temp_initial_layer"));
line.append_option(optgroup->get_option("textured_plate_temp"));
optgroup->append_line(line);
@ -3130,7 +3130,7 @@ void TabFilament::build()
optgroup->append_line(line);
optgroup->append_single_option_line("reduce_fan_stop_start_freq", "auto-cooling");
optgroup->append_single_option_line("slow_down_for_layer_cooling", "auto-cooling");
optgroup->append_single_option_line("slow_down_min_speed","auto-cooling");
optgroup->append_single_option_line("slow_down_min_speed", "auto-cooling");
optgroup->append_single_option_line("enable_overhang_bridge_fan", "auto-cooling");
optgroup->append_single_option_line("overhang_fan_threshold", "auto-cooling");
@ -3139,20 +3139,20 @@ void TabFilament::build()
optgroup = page->new_optgroup(L("Auxiliary part cooling fan"), L"param_cooling_fan");
optgroup->append_single_option_line("additional_cooling_fan_speed");
optgroup = page->new_optgroup(L("Exhaust fan"),L"param_cooling_fan");
optgroup = page->new_optgroup(L("Exhaust fan"), L"param_cooling_fan");
optgroup->append_single_option_line("activate_air_filtration");
line = {L("During print"), ""};
line = { L("During print"), "" };
line.append_option(optgroup->get_option("during_print_exhaust_fan_speed"));
optgroup->append_line(line);
line = {L("Complete print"), ""};
line = { L("Complete print"), "" };
line.append_option(optgroup->get_option("complete_print_exhaust_fan_speed"));
optgroup->append_line(line);
//BBS
// add_filament_overrides_page();
add_filament_overrides_page();
#if 0
//page = add_options_page(L("Advanced"), "advanced");
// optgroup = page->new_optgroup(L("Wipe tower parameters"));
@ -3184,7 +3184,7 @@ void TabFilament::build()
optgroup->append_single_option_line(option);
page = add_options_page(L("Notes"), "note");
optgroup = page->new_optgroup(L("Notes"),"note");
optgroup = page->new_optgroup(L("Notes"), "note");
optgroup->label_width = 0;
option = optgroup->get_option("filament_notes");
option.opt.full_width = true;
@ -4401,19 +4401,19 @@ void TabConfig::reload_config()
//this->compatible_widget_reload(m_compatible_prints);
Tab::reload_config();
}
void TabConfig::update_description_lines()
{
Tab::update_description_lines();
if (!m_active_page)
return;
//if (m_active_page->title() == "Cooling" && m_cooling_description_line)
// m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset())));
//BBS
//if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line)
// this->update_volumetric_flow_preset_hints();
}
//void TabConfig::update_description_lines()
//{
// Tab::update_description_lines();
//
// if (!m_active_page)
// return;
//
// //if (m_active_page->title() == "Cooling" && m_cooling_description_line)
// // m_cooling_description_line->SetText(from_u8(PresetHints::cooling_description(m_presets->get_edited_preset())));
// //BBS
// //if (m_active_page->title() == "Filament" && m_volumetric_speed_description_line)
// // this->update_volumetric_flow_preset_hints();
//}
void TabConfig::toggle_options() {
if (!m_active_page)
return;
@ -4422,49 +4422,211 @@ void TabConfig::toggle_options() {
if (m_preset_bundle) {
is_BBL_printer = m_preset_bundle->configs.get_edited_preset().is_bbl_vendor_preset(m_preset_bundle);
}
/* const Preset& preset = m_preset_bundle->configs.get_edited_preset();
bool is_BBL = preset.is_system;*/
//if (m_active_page->title() == "Quality") {
//toggle_line("printable_area", !is_configed_by_BBL);//all printer can entry and view data
//toggle_option("single_extruder_multi_material", have_multiple_extruders);
//BBS: gcode_flavore of BBL printer can't be edited and changed
//toggle_option("gcode_flavor", !is_BBL_printer);
//toggle_option("thumbnail_size", !is_BBL_printer);
//toggle_option("printer_structure", !is_BBL_printer);
//toggle_option("use_relative_e_distances", !is_BBL_printer);
//toggle_option("support_chamber_temp_control", !is_BBL_printer);
//toggle_option("use_firmware_retraction", !is_BBL_printer);
//toggle_option("support_air_filtration", is_BBL_printer);
//auto flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
//bool is_marlin_flavor = flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware;
//// Disable silent mode for non-marlin firmwares.
//toggle_option("silent_mode", is_marlin_flavor);
////BBS: extruder clearance of BBL printer can't be edited.
//for (auto el : { "extruder_clearance_max_radius", "extruder_clearance_height_to_rod", "extruder_clearance_height_to_lid" })
// toggle_option(el, !is_BBL_printer);
//}
/* if (m_active_page->title() == "Strength") {
toggle_line("time_lapse_gcode", m_preset_bundle->configs.get_edited_preset().config.opt_enum<PrinterStructure>("printer_structure") == PrinterStructure::psI3);
toggle_option("thumbnail_size", !is_BBL_printer);
//std::string cde = "1";
//m_preset_bundle->filament_presets
/* for (auto& f : m_preset_bundle->filament_presets) {
cde = f;
}*/
//p->combos_filament
//m_preset_bundle->configs.update_dirty();
//wxString abc = wxString::FromUTF8( m_preset_bundle->configs.get_selected_preset().name);
wxString abc = wxGetApp().get_tab(Preset::TYPE_CONFIG)->get_combo_box()->GetTextLabel();
//wxString abc = wxString::FromUTF8( m_preset_bundle->configs.get_edited_preset().name);
//InfillPattern bcd = m_preset_bundle->configs.get_edited_preset().config.opt_enum<InfillPattern>("top_surface_pattern");
wxString lian_xu = _L("Lian xu");
if (abc.Contains(lian_xu)) {
BitmapCache concentric_cache;
wxBitmap concentric_bmp = *concentric_cache.load_svg("param_concentric", FromDIP(23), FromDIP(23));
BitmapCache zig_cache;
wxBitmap zig_bmp = *zig_cache.load_svg("param_zig-zag", FromDIP(23), FromDIP(23));
BitmapCache monotonic_cache;
wxBitmap monotonic_bmp = *monotonic_cache.load_svg("param_monotonic", FromDIP(23), FromDIP(23));
BitmapCache monotonicline_cache;
wxBitmap monotonicline_bmp = *monotonicline_cache.load_svg("param_monotonicline", FromDIP(23), FromDIP(23));
BitmapCache alignedrectilinear_cache;
wxBitmap alignedrectilinear_bmp = *alignedrectilinear_cache.load_svg("param_alignedrectilinear", FromDIP(23), FromDIP(23));
BitmapCache fiberspiral_cache;
wxBitmap fiberspiral_bmp = *fiberspiral_cache.load_svg("param_fiberspiral", FromDIP(23), FromDIP(23));
BitmapCache grid_cache;
wxBitmap grid_bmp = *grid_cache.load_svg("param_grid", FromDIP(23), FromDIP(23));
BitmapCache line_cache;
wxBitmap line_bmp = *line_cache.load_svg("param_line", FromDIP(23), FromDIP(23));
//BitmapCache cubic_cache;
//wxBitmap cubic_bmp = *cubic_cache.load_svg("param_cubic", FromDIP(23), FromDIP(23));
//BitmapCache triangles_cache;
//wxBitmap triangles_bmp = *triangles_cache.load_svg("param_triangles", FromDIP(23), FromDIP(23));
//BitmapCache tri_cache;
//wxBitmap tri_bmp = *tri_cache.load_svg("param_tri-hexagon", FromDIP(23), FromDIP(23));
//BitmapCache gyroid_cache;
//wxBitmap gyroid_bmp = *gyroid_cache.load_svg("param_gyroid", FromDIP(23), FromDIP(23));
BitmapCache honeycomb_cache;
wxBitmap honeycomb_bmp = *honeycomb_cache.load_svg("param_honeycomb", FromDIP(23), FromDIP(23));
BitmapCache adaptivecubic_cache;
wxBitmap adaptivecubic_bmp = *adaptivecubic_cache.load_svg("param_adaptivecubic", FromDIP(23), FromDIP(23));
BitmapCache dhoneycomb_cache;
wxBitmap dhoneycomb_bmp = *dhoneycomb_cache.load_svg("param_3dhoneycomb", FromDIP(23), FromDIP(23));
{
Field* field = m_active_page->get_field("top_surface_pattern");
if (auto choice = dynamic_cast<Choice*>(field)) {
auto& opt = const_cast<ConfigOptionDef&>(field->m_opt);
auto cb = dynamic_cast<ComboBox*>(choice->window);
auto n = cb->GetValue();
opt.enum_values.clear();
opt.enum_labels.clear();
cb->Clear();
opt.enum_values.push_back("concentric");
opt.enum_values.push_back("zig-zag");
opt.enum_values.push_back("monotonic");
opt.enum_values.push_back("monotonicline");
opt.enum_values.push_back("alignedrectilinear");
opt.enum_values.push_back("fiberspiral");
opt.enum_labels.push_back(L("Concentric"));
cb->Append(_L("Concentric"), concentric_bmp);
opt.enum_labels.push_back(L("Rectilinear"));
cb->Append(_L("Rectilinear"), zig_bmp);
opt.enum_labels.push_back(L("Monotonic"));
cb->Append(_L("Monotonic"), monotonic_bmp);
opt.enum_labels.push_back(L("Monotonic line"));
cb->Append(_L("Monotonic line"), monotonicline_bmp);
opt.enum_labels.push_back(L("Aligned Rectilinear"));
cb->Append(_L("Aligned Rectilinear"), alignedrectilinear_bmp);
opt.enum_labels.push_back(L("Fiber Spiral"));
cb->Append(_L("Fiber Spiral"), fiberspiral_bmp);
cb->SetValue(n);
}
}
{
Field* field = m_active_page->get_field("bottom_surface_pattern");
if (auto choice = dynamic_cast<Choice*>(field)) {
auto& opt = const_cast<ConfigOptionDef&>(field->m_opt);
auto cb = dynamic_cast<ComboBox*>(choice->window);
auto n = cb->GetValue();
opt.enum_values.clear();
opt.enum_labels.clear();
cb->Clear();
opt.enum_values.push_back("concentric");
opt.enum_values.push_back("zig-zag");
opt.enum_values.push_back("monotonic");
opt.enum_values.push_back("monotonicline");
opt.enum_values.push_back("alignedrectilinear");
opt.enum_values.push_back("fiberspiral");
opt.enum_labels.push_back(L("Concentric"));
cb->Append(_L("Concentric"), concentric_bmp);
opt.enum_labels.push_back(L("Rectilinear"));
cb->Append(_L("Rectilinear"), zig_bmp);
opt.enum_labels.push_back(L("Monotonic"));
cb->Append(_L("Monotonic"), monotonic_bmp);
opt.enum_labels.push_back(L("Monotonic line"));
cb->Append(_L("Monotonic line"), monotonicline_bmp);
opt.enum_labels.push_back(L("Aligned Rectilinear"));
cb->Append(_L("Aligned Rectilinear"), alignedrectilinear_bmp);
opt.enum_labels.push_back(L("Fiber Spiral"));
cb->Append(_L("Fiber Spiral"), fiberspiral_bmp);
cb->SetValue(n);
}
}
{
Field * field = m_active_page->get_field("internal_solid_infill_pattern");
if (auto choice = dynamic_cast<Choice*>(field)) {
auto& opt = const_cast<ConfigOptionDef&>(field->m_opt);
auto cb = dynamic_cast<ComboBox*>(choice->window);
auto n = cb->GetValue();
opt.enum_values.clear();
opt.enum_labels.clear();
cb->Clear();
opt.enum_values.push_back("concentric");
opt.enum_values.push_back("zig-zag");
opt.enum_values.push_back("monotonic");
opt.enum_values.push_back("monotonicline");
opt.enum_values.push_back("alignedrectilinear");
opt.enum_values.push_back("fiberspiral");
opt.enum_labels.push_back(L("Concentric"));
cb->Append(_L("Concentric"), concentric_bmp);
opt.enum_labels.push_back(L("Rectilinear"));
cb->Append(_L("Rectilinear"), zig_bmp);
opt.enum_labels.push_back(L("Monotonic"));
cb->Append(_L("Monotonic"), monotonic_bmp);
opt.enum_labels.push_back(L("Monotonic line"));
cb->Append(_L("Monotonic line"), monotonicline_bmp);
opt.enum_labels.push_back(L("Aligned Rectilinear"));
cb->Append(_L("Aligned Rectilinear"), alignedrectilinear_bmp);
opt.enum_labels.push_back(L("Fiber Spiral"));
cb->Append(_L("Fiber Spiral"), fiberspiral_bmp);
cb->SetValue(n);
}
}
{
Field* field = m_active_page->get_field("sparse_infill_pattern");
if (auto choice = dynamic_cast<Choice*>(field)) {
auto& opt = const_cast<ConfigOptionDef&>(field->m_opt);
auto cb = dynamic_cast<ComboBox*>(choice->window);
auto n = cb->GetValue();
opt.enum_values.clear();
opt.enum_labels.clear();
cb->Clear();
opt.enum_values.push_back("concentric");
opt.enum_values.push_back("zig-zag");
opt.enum_values.push_back("grid");
opt.enum_values.push_back("line");
//opt.enum_values.push_back("cubic");
//opt.enum_values.push_back("triangles");
//opt.enum_values.push_back("tri-hexagon");
//opt.enum_values.push_back("gyroid");
opt.enum_values.push_back("honeycomb");
opt.enum_values.push_back("adaptivecubic");
opt.enum_values.push_back("alignedrectilinear");
opt.enum_values.push_back("3dhoneycomb");
opt.enum_values.push_back("fiberspiral");
opt.enum_labels.push_back(L("Concentric"));
cb->Append(_L("Concentric"), concentric_bmp);
opt.enum_labels.push_back(L("Rectilinear"));
cb->Append(_L("Rectilinear"), zig_bmp);
opt.enum_labels.push_back(L("Grid"));
cb->Append(_L("Grid"), grid_bmp);
opt.enum_labels.push_back(L("Line"));
cb->Append(_L("Line"), line_bmp);
//opt.enum_labels.push_back(L("Cubic"));
//cb->Append(_L("Cubic"), cubic_bmp);
//opt.enum_labels.push_back(L("Triangles"));
//cb->Append(_L("Triangles"), triangles_bmp);
//opt.enum_labels.push_back(L("Tri-hexagon"));
//cb->Append(_L("Tri-hexagon"), tri_bmp);
//opt.enum_labels.push_back(L("Gyroid"));
//cb->Append(_L("Gyroid"), gyroid_bmp);
opt.enum_labels.push_back(L("Honeycomb"));
cb->Append(_L("Honeycomb"), honeycomb_bmp);
opt.enum_labels.push_back(L("Adaptive Cubic"));
cb->Append(_L("Adaptive Cubic"), adaptivecubic_bmp);
opt.enum_labels.push_back(L("Aligned Rectilinear"));
cb->Append(_L("Aligned Rectilinear"), alignedrectilinear_bmp);
opt.enum_labels.push_back(L("3D Honeycomb"));
cb->Append(_L("3D Honeycomb"), dhoneycomb_bmp);
opt.enum_labels.push_back(L("Fiber Spiral"));
cb->Append(_L("Fiber Spiral"), fiberspiral_bmp);
cb->SetValue(n);
}
}
}
}
void TabConfig::update() {
//m_update_cnt++;
//update_description_lines();
////BBS: GUI refactor
////Layout();
//m_parent->Layout();
m_update_cnt++;
update_description_lines();
//BBS: GUI refactor
//Layout();
m_parent->Layout();
toggle_options();
m_update_cnt--;

View File

@ -585,7 +585,7 @@ public:
void build() override;
void reload_config() override;
void update_description_lines() override;
//void update_description_lines() override;
void toggle_options() override;
void update() override;
void clear_pages() override;