From d6b3942ad17392eb664125b545d9c708af04d8eb Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Sun, 17 Jul 2022 12:32:08 +0200 Subject: [PATCH] Draft: Fix color handling in make_point.py --- src/Mod/Draft/draftmake/make_point.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Mod/Draft/draftmake/make_point.py b/src/Mod/Draft/draftmake/make_point.py index a0a91d6cd4..843ec2297b 100644 --- a/src/Mod/Draft/draftmake/make_point.py +++ b/src/Mod/Draft/draftmake/make_point.py @@ -45,7 +45,7 @@ def make_point(X=0, Y=0, Z=0, color=None, name="Point", point_size=5): Parameters ---------- - X : + X : float -> X coordinate of the point Base.Vector -> Ignore Y and Z coordinates and create the point from the vector. @@ -59,9 +59,9 @@ def make_point(X=0, Y=0, Z=0, color=None, name="Point", point_size=5): color : (R, G, B) Point color as RGB example to create a colored point: - make_point(0,0,0,(1,0,0)) # color = red + make_point(0, 0, 0, (1, 0, 0)) # color = red example to change the color, make sure values are floats: - p1.ViewObject.PointColor =(0.0,0.0,1.0) + p1.ViewObject.PointColor = (0.0, 0.0, 1.0) """ if not App.ActiveDocument: App.Console.PrintError("No active document. Aborting\n") @@ -76,18 +76,13 @@ def make_point(X=0, Y=0, Z=0, color=None, name="Point", point_size=5): Point(obj, X, Y, Z) - # TODO: Check if this is a repetition: - obj.X = X - obj.Y = Y - obj.Z = Z - if App.GuiUp: ViewProviderPoint(obj.ViewObject) - if hasattr(Gui,"draftToolBar") and (not color): - color = Gui.draftToolBar.getDefaultColor('line') - obj.ViewObject.PointColor = (float(color[0]), float(color[1]), float(color[2])) + if hasattr(Gui,"draftToolBar") and color is None: + color = Gui.draftToolBar.getDefaultColor("line") + if color is not None: + obj.ViewObject.PointColor = (float(color[0]), float(color[1]), float(color[2])) obj.ViewObject.PointSize = point_size - obj.ViewObject.Visibility = True gui_utils.select(obj) return obj