[Feature Request] [Draft] [UI/UX] Allow to turn dimension arrows on/off individually (#11941)
* Update additional files * The LineColor and LineWidth properties are removed from Text objects. * Arrow properties are added by the ViewProviderDraftAnnotation class only. This avoids code duplication. * gui_annotationstyleeditor.py fix except * view_draft_annotation.py fix except --------- Co-authored-by: Roy-043 <info@b-k-g.nl> Co-authored-by: Roy-043 <70520633+Roy-043@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0eb155ebc9
commit
439cb2122e
@@ -189,7 +189,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
----------
|
||||
symbol: int, optional
|
||||
It defaults to `None`, in which it gets the value from the parameter
|
||||
database, `get_param("dimsymbol")`.
|
||||
database, `get_param("dimsymbolend")`.
|
||||
|
||||
A numerical value defines different markers
|
||||
* 0, `SoSphere`
|
||||
@@ -197,6 +197,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
* 2, `SoSeparator` with a `soCone`
|
||||
* 3, `SoSeparator` with a `SoFaceSet`
|
||||
* 4, `SoSeparator` with a `SoLineSet`, calling `dim_dash`
|
||||
* 5, Nothing
|
||||
* Otherwise, `SoSphere`
|
||||
|
||||
invert: bool, optional
|
||||
@@ -212,7 +213,7 @@ def dim_symbol(symbol=None, invert=False):
|
||||
that will be used as a dimension symbol.
|
||||
"""
|
||||
if symbol is None:
|
||||
symbol = params.get_param("dimsymbol")
|
||||
symbol = params.get_param("dimsymbolend")
|
||||
|
||||
if symbol == 0:
|
||||
# marker = coin.SoMarkerSet()
|
||||
@@ -262,6 +263,8 @@ def dim_symbol(symbol=None, invert=False):
|
||||
return marker
|
||||
elif symbol == 4:
|
||||
return dim_dash((-1.5, -1.5, 0), (1.5, 1.5, 0))
|
||||
elif symbol == 5:
|
||||
return coin.SoSeparator()
|
||||
else:
|
||||
_wrn(translate("draft", "Symbol not implemented. Using a default symbol."))
|
||||
return coin.SoSphere()
|
||||
|
||||
@@ -56,17 +56,20 @@ if App.GuiUp:
|
||||
True if Draft_rc else False
|
||||
|
||||
|
||||
ARROW_TYPES = ["Dot", "Circle", "Arrow", "Tick", "Tick-2"]
|
||||
ARROW_TYPES = ["Dot", "Circle", "Arrow", "Tick", "Tick-2", "None"]
|
||||
DISPLAY_MODES = ["Flat Lines", "Shaded", "Wireframe", "Points"]
|
||||
DRAW_STYLES = ["Solid", "Dashed", "Dotted", "Dashdot"]
|
||||
arrowtypes = ARROW_TYPES
|
||||
|
||||
|
||||
def get_default_annotation_style():
|
||||
arrow_type_index = params.get_param("dimsymbol")
|
||||
arrow_start_type_index = params.get_param("dimsymbolstart")
|
||||
arrow_end_type_index = params.get_param("dimsymbolend")
|
||||
return {
|
||||
"ArrowSize": ("float", params.get_param("arrowsize")),
|
||||
"ArrowType": ("index", arrow_type_index, ARROW_TYPES[arrow_type_index]),
|
||||
"ArrowSizeStart": ("float", params.get_param("arrowsizestart")),
|
||||
"ArrowSizeEnd": ("float", params.get_param("arrowsizeend")),
|
||||
"ArrowTypeStart": ("index", arrow_start_type_index, ARROW_TYPES[arrow_start_type_index]),
|
||||
"ArrowTypeEnd": ("index", arrow_end_type_index, ARROW_TYPES[arrow_end_type_index]),
|
||||
"Decimals": ("int", params.get_param("dimPrecision")),
|
||||
"DimOvershoot": ("float", params.get_param("dimovershoot")),
|
||||
"ExtLines": ("float", params.get_param("extlines")),
|
||||
@@ -85,6 +88,37 @@ def get_default_annotation_style():
|
||||
}
|
||||
|
||||
|
||||
def repair_annotation_style(style):
|
||||
"""Repair a V0.19, V0.20 or < V1.1 style.
|
||||
|
||||
V0.19 and V0.20:
|
||||
Some properties were missing or misspelled.
|
||||
Some float values were wrongly stored as strings.
|
||||
|
||||
V1.0 -> V1.1:
|
||||
ArrowSize has been replaced by ArrowSizeStart and ArrowSizeEnd.
|
||||
ArrowType has been replaced by ArrowTypeStart and ArrowTypeEnd.
|
||||
"""
|
||||
for key in ("ArrowSize", "ArrowType"):
|
||||
if style.get(key) is not None \
|
||||
and style.get(key + "Start") is None \
|
||||
and style.get(key + "End") is None:
|
||||
style[key + "Start"] = style[key]
|
||||
style[key + "End"] = style[key]
|
||||
default = get_default_annotation_style()
|
||||
new = {}
|
||||
for key, val in default.items():
|
||||
if style.get(key) is None:
|
||||
new[key] = val[1]
|
||||
elif type(style[key]) == type(val[1]):
|
||||
new[key] = style[key]
|
||||
elif isinstance(style[key], str):
|
||||
new[key] = float(style[key].replace(",", "."))
|
||||
else:
|
||||
new[key] = val[1]
|
||||
return new
|
||||
|
||||
|
||||
def get_default_shape_style():
|
||||
# Uses the same format as get_default_annotation_style().
|
||||
display_mode_index = params.get_param("DefaultDisplayMode")
|
||||
@@ -1095,13 +1129,13 @@ def toggle_working_plane(obj, action=None, restore=False, dialog=None):
|
||||
"""
|
||||
import FreeCADGui
|
||||
import Draft
|
||||
|
||||
|
||||
# Determine the appropriate context based on object type
|
||||
context = "Arch"
|
||||
obj_type = get_type(obj)
|
||||
if obj_type == "IfcBuildingStorey":
|
||||
context = "NativeIFC"
|
||||
|
||||
|
||||
# Check if the object is already active in its context
|
||||
is_active_arch = (FreeCADGui.ActiveDocument.ActiveView.getActiveObject("Arch") == obj)
|
||||
is_active_ifc = (FreeCADGui.ActiveDocument.ActiveView.getActiveObject("NativeIFC") == obj)
|
||||
|
||||
Reference in New Issue
Block a user