Draft/BIM: Change Continue behavior and caching among commands (#20748)

* Draft: Cache ContinueMode setting for every tool separately

Currently ContinueMode is done to be held globally, so this patch
changes this to cache it inside `user.cfg` for every cmd separately.

* Draft: Add Chained Mode option for Dimension

Added new option under Dimension, although this is simply porting the
existing logic of "Continue" under "Chained Mode", whereas allowing
existing "Continue" mode to retrigger the command instead of placing
Dimensions in a chain.
This commit is contained in:
tetektoza
2025-04-18 17:56:21 +02:00
committed by GitHub
parent 56421bf73d
commit 2a983b587d
8 changed files with 106 additions and 95 deletions

View File

@@ -404,8 +404,8 @@ def _get_param_dictionary():
param_dict["Mod/Draft"] = {
"AnnotationStyleEditorHeight": ("int", 450),
"AnnotationStyleEditorWidth": ("int", 450),
"ChainedMode": ("bool", False),
"CenterPlaneOnView": ("bool", False),
"ContinueMode": ("bool", False),
"CopyMode": ("bool", False),
"DefaultAnnoDisplayMode": ("int", 0),
"DefaultDisplayMode": ("int", 0),
@@ -443,6 +443,35 @@ def _get_param_dictionary():
"useSupport": ("bool", False),
}
param_dict["Mod/Draft/ContinueMode"] = {
# Draft
"Line": ("bool", False),
"Polyline": ("bool", False),
"Arc": ("bool", False),
"Arc_3Points": ("bool", False),
"Circle": ("bool", False),
"Ellipse": ("bool", False),
"Rectangle": ("bool", False),
"Polygon": ("bool", False),
"Bspline": ("bool", False),
"CubicBezCurve": ("bool", False),
"BezCurve": ("bool", False),
"Point": ("bool", False),
"Text": ("bool", False),
"Dimension": ("bool", False),
# Standard operations (Draft)
"Move": ("bool", False),
"Copy": ("bool", False),
"Rotate": ("bool", False),
# Arch/BIM
"Wall": ("bool", False),
"Column": ("bool", False),
"Beam": ("bool", False),
"Panel": ("bool", False),
}
# Arch parameters that are not in the preferences:
param_dict["Mod/Arch"] = {
"applyConstructionStyle": ("bool", True),
@@ -634,7 +663,7 @@ def _get_param_dictionary():
PARAM_DICT = _get_param_dictionary()
def get_param(entry, path="Mod/Draft", ret_default=False):
def get_param(entry, path="Mod/Draft", ret_default=False, silent=False):
"""Return a stored parameter value or its default.
Parameters
@@ -648,13 +677,17 @@ def get_param(entry, path="Mod/Draft", ret_default=False):
ret_default: bool, optional
Defaults to `False`.
If `True`, always return the default value even if a stored value is available.
silent: bool, optional
Defaults to `False`.
If `True`, do not log anything if entry wasn't found.
Returns
-------
bool, float, int or str (if successful) or `None`.
"""
if path not in PARAM_DICT or entry not in PARAM_DICT[path]:
print(f"draftutils.params.get_param: Unable to find '{entry}' in '{path}'")
if not silent:
print(f"draftutils.params.get_param: Unable to find '{entry}' in '{path}'")
return None
param_grp = App.ParamGet("User parameter:BaseApp/Preferences/" + path)
typ, default = PARAM_DICT[path][entry]