Skip to content

Commit

Permalink
Merge pull request #17272 from Ultimaker/CURA-11293_fix_disallowed_areas
Browse files Browse the repository at this point in the history
[CURA-11293] fix disallowed areas
  • Loading branch information
casperlamboo authored Nov 10, 2023
2 parents 0c78cdb + 0196334 commit 5d33745
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 16 deletions.
18 changes: 9 additions & 9 deletions cura/BuildVolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,20 +489,20 @@ def _buildDisallowedAreaMesh(self, min_w: float, max_w: float, min_h: float, max
if not self._disallowed_areas:
return None

bounding_box = Polygon(numpy.array([[min_w, min_d], [min_w, max_d], [max_w, max_d], [max_w, min_d]], numpy.float32))

mb = MeshBuilder()
color = self._disallowed_area_color
for polygon in self._disallowed_areas:
points = polygon.getPoints()
if len(points) == 0:
intersection = polygon.intersectionConvexHulls(bounding_box)
points = numpy.flipud(intersection.getPoints())
if len(points) < 3:
continue

first = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height,
self._clamp(points[0][1], min_d, max_d))
previous_point = Vector(self._clamp(points[0][0], min_w, max_w), disallowed_area_height,
self._clamp(points[0][1], min_d, max_d))
for point in points:
new_point = Vector(self._clamp(point[0], min_w, max_w), disallowed_area_height,
self._clamp(point[1], min_d, max_d))
first = Vector(points[0][0], disallowed_area_height, points[0][1])
previous_point = Vector(points[1][0], disallowed_area_height, points[1][1])
for point in points[2:]:
new_point = Vector(point[0], disallowed_area_height, point[1])
mb.addFace(first, previous_point, new_point, color=color)
previous_point = new_point

Expand Down
3 changes: 0 additions & 3 deletions resources/definitions/ultimaker_method_base.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,19 +320,16 @@
"layer_start_y": { "value": "sum(extruderValues('machine_extruder_start_pos_y')) / len(extruderValues('machine_extruder_start_pos_y'))" },
"machine_acceleration": { "default_value": 3000 },
"machine_center_is_zero": { "value": true },
"machine_depth": { "default_value": 190 },
"machine_end_gcode": { "default_value": "" },
"machine_extruder_count": { "default_value": 2 },
"machine_gcode_flavor": { "default_value": "Griffin" },
"machine_heated_bed": { "default_value": false },
"machine_heated_build_volume": { "default_value": true },
"machine_height": { "default_value": 196 },
"machine_min_cool_heat_time_window": { "value": 15 },
"machine_name": { "default_value": "UltiMaker Method" },
"machine_nozzle_cool_down_speed": { "value": 0.8 },
"machine_nozzle_heat_up_speed": { "value": 3.5 },
"machine_start_gcode": { "default_value": "" },
"machine_width": { "default_value": 150 },
"material_bed_temperature": { "enabled": "machine_heated_bed" },
"material_bed_temperature_layer_0": { "enabled": "machine_heated_bed" },
"material_final_print_temperature": { "value": "material_print_temperature-10" },
Expand Down
38 changes: 36 additions & 2 deletions resources/definitions/ultimaker_methodx.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"platform_offset": [
0,
0,
0
16
],
"platform_texture": "MakerbotMethod.png",
"preferred_material": "ultimaker_absr_175",
Expand All @@ -83,6 +83,40 @@
},
"overrides":
{
"machine_name": { "default_value": "UltiMaker Method X" }
"machine_depth": { "default_value": 236.48 },
"machine_disallowed_areas":
{
"default_value": [
[
[-141.65, -118.11],
[141.65, -118.11],
[141.65, -95],
[-141.65, -95]
],
[
[-141.65, 118.37],
[141.65, 118.37],
[141.65, 95],
[-141.65, 95]
],
[
[-141.65, -118.11],
[-75, -118.11],
[-75, 118.37],
[-141.65, 118.37]
],
[
[75, -118.11],
[141.65, -118.11],
[141.65, 118.37],
[75, 118.37]
]
]
},
"machine_height": { "default_value": 196 },
"machine_name": { "default_value": "UltiMaker Method X" },
"machine_width": { "default_value": 283.3 },
"prime_tower_position_x": { "value": "(150 / 2 + resolveOrValue('prime_tower_size') / 2) if resolveOrValue('machine_shape') == 'elliptic' else (150 - (resolveOrValue('prime_tower_base_size') if (resolveOrValue('adhesion_type') == 'raft' or resolveOrValue('prime_tower_brim_enable')) else 0) - max(max(extruderValues('travel_avoid_distance')) + max(extruderValues('support_offset')) + (extruderValue(skirt_brim_extruder_nr, 'skirt_brim_line_width') * extruderValue(skirt_brim_extruder_nr, 'skirt_line_count') * extruderValue(skirt_brim_extruder_nr, 'initial_layer_line_width_factor') / 100 + extruderValue(skirt_brim_extruder_nr, 'skirt_gap') if resolveOrValue('adhesion_type') == 'skirt' else 0) + (resolveOrValue('draft_shield_dist') if resolveOrValue('draft_shield_enabled') else 0), max(map(abs, extruderValues('machine_nozzle_offset_x'))), 1)) - (150 / 2 if resolveOrValue('machine_center_is_zero') else 0)" },
"prime_tower_position_y": { "value": "190 - prime_tower_size - (resolveOrValue('prime_tower_base_size') if (resolveOrValue('adhesion_type') == 'raft' or resolveOrValue('prime_tower_brim_enable')) else 0) - max(max(extruderValues('travel_avoid_distance')) + max(extruderValues('support_offset')) + (extruderValue(skirt_brim_extruder_nr, 'skirt_brim_line_width') * extruderValue(skirt_brim_extruder_nr, 'skirt_line_count') * extruderValue(skirt_brim_extruder_nr, 'initial_layer_line_width_factor') / 100 + extruderValue(skirt_brim_extruder_nr, 'skirt_gap') if resolveOrValue('adhesion_type') == 'skirt' else 0) + (resolveOrValue('draft_shield_dist') if resolveOrValue('draft_shield_enabled') else 0), max(map(abs, extruderValues('machine_nozzle_offset_y'))), 1) - (190 / 2 if resolveOrValue('machine_center_is_zero') else 0)" }
}
}
35 changes: 33 additions & 2 deletions resources/definitions/ultimaker_methodxl.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,43 @@
},
"overrides":
{
"machine_depth": { "default_value": 305 },
"machine_depth": { "default_value": 320 },
"machine_disallowed_areas":
{
"default_value": [
[
[-204, -160],
[204, -160],
[204, -152.5],
[-204, -152.5]
],
[
[-204, 160],
[204, 160],
[204, 152.5],
[-204, 152.5]
],
[
[-205, -160],
[-152.5, -160],
[-152.5, 160],
[-205, 160]
],
[
[152.5, -160],
[205, -160],
[205, 160],
[152.5, 160]
]
]
},
"machine_heated_bed": { "default_value": true },
"machine_height": { "default_value": 317 },
"machine_name": { "default_value": "UltiMaker Method XL" },
"machine_width": { "default_value": 305 },
"machine_width": { "default_value": 410 },
"material_shrinkage_percentage_z": { "resolve": "sum(extruderValues(\"material_shrinkage_percentage_z\")) / len(extruderValues(\"material_shrinkage_percentage_z\"))" },
"prime_tower_position_x": { "value": "(305 - (resolveOrValue('prime_tower_base_size') if (resolveOrValue('adhesion_type') == 'raft' or resolveOrValue('prime_tower_brim_enable')) else 0) - max(max(extruderValues('travel_avoid_distance')) + max(extruderValues('support_offset')) + (extruderValue(skirt_brim_extruder_nr, 'skirt_brim_line_width') * extruderValue(skirt_brim_extruder_nr, 'skirt_line_count') * extruderValue(skirt_brim_extruder_nr, 'initial_layer_line_width_factor') / 100 + extruderValue(skirt_brim_extruder_nr, 'skirt_gap') if resolveOrValue('adhesion_type') == 'skirt' else 0) + (resolveOrValue('draft_shield_dist') if resolveOrValue('draft_shield_enabled') else 0), max(map(abs, extruderValues('machine_nozzle_offset_x'))), 1)) - (305 / 2)" },
"prime_tower_position_y": { "value": "305 - prime_tower_size - (resolveOrValue('prime_tower_base_size') if (resolveOrValue('adhesion_type') == 'raft' or resolveOrValue('prime_tower_brim_enable')) else 0) - max(max(extruderValues('travel_avoid_distance')) + max(extruderValues('support_offset')) + (extruderValue(skirt_brim_extruder_nr, 'skirt_brim_line_width') * extruderValue(skirt_brim_extruder_nr, 'skirt_line_count') * extruderValue(skirt_brim_extruder_nr, 'initial_layer_line_width_factor') / 100 + extruderValue(skirt_brim_extruder_nr, 'skirt_gap') if resolveOrValue('adhesion_type') == 'skirt' else 0) + (resolveOrValue('draft_shield_dist') if resolveOrValue('draft_shield_enabled') else 0), max(map(abs, extruderValues('machine_nozzle_offset_y'))), 1) - (305 / 2)" },
"speed_travel": { "value": 500 }
}
}

0 comments on commit 5d33745

Please sign in to comment.