mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-11 05:29:02 +08:00
Remove debugging utility function
CURA-7951
This commit is contained in:
parent
3e39bbdabd
commit
afc1ba78f5
@ -329,116 +329,3 @@ class GridArrange(Arranger):
|
|||||||
disc_x = ((x - self._build_volume_bounding_box.left) / self._build_volume_bounding_box.width) * 2.0 - 1.0
|
disc_x = ((x - self._build_volume_bounding_box.left) / self._build_volume_bounding_box.width) * 2.0 - 1.0
|
||||||
disc_y = ((y - self._build_volume_bounding_box.back) / self._build_volume_bounding_box.depth) * 2.0 - 1.0
|
disc_y = ((y - self._build_volume_bounding_box.back) / self._build_volume_bounding_box.depth) * 2.0 - 1.0
|
||||||
return disc_x, disc_y
|
return disc_x, disc_y
|
||||||
|
|
||||||
def _drawDebugSvg(self):
|
|
||||||
with open("Builvolume_test.svg", "w") as f:
|
|
||||||
build_volume_bounding_box = self._build_volume_bounding_box
|
|
||||||
|
|
||||||
f.write(
|
|
||||||
f"<svg xmlns='http://www.w3.org/2000/svg' viewBox='{build_volume_bounding_box.left - 100} {build_volume_bounding_box.back - 100} {build_volume_bounding_box.width + 200} {build_volume_bounding_box.depth + 200}'>\n")
|
|
||||||
|
|
||||||
if self._build_volume.getShape() == "elliptic":
|
|
||||||
f.write(
|
|
||||||
f"""
|
|
||||||
<ellipse
|
|
||||||
cx='{(build_volume_bounding_box.left + build_volume_bounding_box.right) * 0.5}'
|
|
||||||
cy='{(build_volume_bounding_box.back + build_volume_bounding_box.front) * 0.5}'
|
|
||||||
rx='{build_volume_bounding_box.width * 0.5}'
|
|
||||||
ry='{build_volume_bounding_box.depth * 0.5}'
|
|
||||||
fill=\"lightgrey\"
|
|
||||||
/>
|
|
||||||
""")
|
|
||||||
else:
|
|
||||||
f.write(
|
|
||||||
f"""
|
|
||||||
<rect
|
|
||||||
x='{build_volume_bounding_box.left}'
|
|
||||||
y='{build_volume_bounding_box.back}'
|
|
||||||
width='{build_volume_bounding_box.width}'
|
|
||||||
height='{build_volume_bounding_box.depth}'
|
|
||||||
fill=\"lightgrey\"
|
|
||||||
/>
|
|
||||||
""")
|
|
||||||
|
|
||||||
for polygon in self._build_volume.getDisallowedAreas():
|
|
||||||
# Extract individual points and convert them to tuples
|
|
||||||
|
|
||||||
path_data = ""
|
|
||||||
for [x,y] in polygon.getPoints():
|
|
||||||
path_data += f"{x},{y} "
|
|
||||||
|
|
||||||
f.write(
|
|
||||||
f"""
|
|
||||||
<polygon
|
|
||||||
points='{path_data}'
|
|
||||||
fill='#ff648888'
|
|
||||||
stroke='black'
|
|
||||||
stroke-width='2'
|
|
||||||
/>
|
|
||||||
""")
|
|
||||||
|
|
||||||
for grid_x in range(-10, 100):
|
|
||||||
for grid_y in range(-10, 100):
|
|
||||||
if (grid_x, grid_y) in self._allowed_grid_idx:
|
|
||||||
fill_color = "rgba(0, 255, 0, 0.5)"
|
|
||||||
elif (grid_x, grid_y) in self._build_plate_grid_ids:
|
|
||||||
fill_color = "rgba(255, 165, 0, 0.5)"
|
|
||||||
else:
|
|
||||||
fill_color = "rgba(255, 0, 0, 0.5)"
|
|
||||||
|
|
||||||
coord_grid_x, coord_grid_y = self._gridSpaceToCoordSpace(grid_x, grid_y)
|
|
||||||
f.write(
|
|
||||||
f"""
|
|
||||||
<rect
|
|
||||||
x="{coord_grid_x + self._margin_x * 0.5}"
|
|
||||||
y="{coord_grid_y + self._margin_y * 0.5}"
|
|
||||||
width="{self._grid_width - self._margin_x}"
|
|
||||||
height="{self._grid_height - self._margin_y}"
|
|
||||||
fill="{fill_color}"
|
|
||||||
stroke="black"
|
|
||||||
/>
|
|
||||||
""")
|
|
||||||
f.write(f"""
|
|
||||||
<text
|
|
||||||
font-size="4"
|
|
||||||
text-anchor="middle"
|
|
||||||
alignment-baseline="middle"
|
|
||||||
x="{coord_grid_x + self._grid_width * 0.5}"
|
|
||||||
y="{coord_grid_y + self._grid_height * 0.5}"
|
|
||||||
>
|
|
||||||
{grid_x},{grid_y}
|
|
||||||
</text>
|
|
||||||
""")
|
|
||||||
for node in self._fixed_nodes:
|
|
||||||
bounding_box = node.getBoundingBox()
|
|
||||||
f.write(f"""
|
|
||||||
<rect
|
|
||||||
x="{bounding_box.left}"
|
|
||||||
y="{bounding_box.back}"
|
|
||||||
width="{bounding_box.width}"
|
|
||||||
height="{bounding_box.depth}"
|
|
||||||
fill="red"
|
|
||||||
/>
|
|
||||||
""")
|
|
||||||
|
|
||||||
f.write(f"""
|
|
||||||
<circle
|
|
||||||
cx="{self._offset_x}"
|
|
||||||
cy="{self._offset_y}"
|
|
||||||
r="2"
|
|
||||||
stroke="red"
|
|
||||||
fill="none"
|
|
||||||
/>""")
|
|
||||||
|
|
||||||
# coord_build_plate_center_x = self._build_volume_bounding_box.width * 0.5 + self._build_volume_bounding_box.left
|
|
||||||
# coord_build_plate_center_y = self._build_volume_bounding_box.depth * 0.5 + self._build_volume_bounding_box.back
|
|
||||||
# f.write(f"""
|
|
||||||
# <circle
|
|
||||||
# cx="{coord_build_plate_center_x}"
|
|
||||||
# cy="{coord_build_plate_center_y}"
|
|
||||||
# r="2"
|
|
||||||
# stroke="blue"
|
|
||||||
# fill="none"
|
|
||||||
# />""")
|
|
||||||
|
|
||||||
f.write(f"</svg>")
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user