bernhard-42 / vscode-ocp-cad-viewer

A viewer for OCP based Code-CAD (CadQuery, build123d) integrated into VS Code
Apache License 2.0
96 stars 10 forks source link

Regression in latest version #81

Closed MatthiasJ1 closed 1 month ago

MatthiasJ1 commented 4 months ago

Measure tools does not work if 1d objects are present

s = Circle(1)
show_all(measure_tools=True)

Ok

s = Circle(1)
l = Line((0,0), (1,0))
show_all(measure_tools=True)

The view will be blank and the Tree tab will be glitched.

Screenshot 2024-05-08 at 9 11 34 PM

Notice how the Tree tab is selected but the Material tab is displayed.

bernhard-42 commented 4 months ago

Yes, it's a bug

mngrm3a commented 4 months ago

Idk if it's relevant, but this also blanks the viewer when measure tools are enabled:

class APart(BasePartObject):
    def __init__(
        self,
        size: float,
        rotation: RotationLike = (0, 0, 0),
        align: Align | tuple[Align, Align, Align] = Align.CENTER,
        mode: Mode = Mode.ADD,
    ):
        part = Box(size, size, size)

        super().__init__(part, rotation, align, mode)

        RigidJoint(
            label="j1",
            to_part=self,
            joint_location=Location((0, -size / 2, 0), (90, 0, 0)),
        )

part1 = APart(5)
part2 = APart(5)
part1.joints["j1"].connect_to(part2.joints["j1"])
show_all()
bernhard-42 commented 4 months ago

@mngrm3a This example works for me with and without measure tools. Could it be that you had some other variable with a line left when it showed the blank view?

bernhard-42 commented 1 month ago

fixed in 2.4.0