Add Draft workbench to .pre-commit-config (#24664)
* Add Draft workbench to .pre-commit-config * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -63,10 +63,14 @@ def is_group(obj):
|
||||
Otherwise returns `False`.
|
||||
"""
|
||||
typ = utils.get_type(obj)
|
||||
return ((obj.isDerivedFrom("App::DocumentObjectGroup")
|
||||
and typ != "LayerContainer")
|
||||
or typ in ("Project", "Site", "Building",
|
||||
"Floor", "BuildingPart", "Space"))
|
||||
return (obj.isDerivedFrom("App::DocumentObjectGroup") and typ != "LayerContainer") or typ in (
|
||||
"Project",
|
||||
"Site",
|
||||
"Building",
|
||||
"Floor",
|
||||
"BuildingPart",
|
||||
"Space",
|
||||
)
|
||||
|
||||
|
||||
def get_group_names(doc=None):
|
||||
@@ -171,26 +175,23 @@ def get_windows(obj):
|
||||
for o in obj.OutList:
|
||||
out.extend(get_windows(o))
|
||||
for i in obj.InList:
|
||||
if (utils.get_type(i.getLinkedObject()) == "Window"
|
||||
or utils.is_clone(obj, "Window")):
|
||||
if utils.get_type(i.getLinkedObject()) == "Window" or utils.is_clone(obj, "Window"):
|
||||
if hasattr(i, "Hosts"):
|
||||
if obj in i.Hosts:
|
||||
out.append(i)
|
||||
elif (utils.get_type(i) == "Rebar"
|
||||
or utils.is_clone(obj, "Rebar")):
|
||||
elif utils.get_type(i) == "Rebar" or utils.is_clone(obj, "Rebar"):
|
||||
if hasattr(i, "Host"):
|
||||
if obj == i.Host:
|
||||
out.append(i)
|
||||
elif (utils.get_type(obj.getLinkedObject()) in ("Window", "Rebar")
|
||||
or utils.is_clone(obj, ["Window", "Rebar"])):
|
||||
elif utils.get_type(obj.getLinkedObject()) in ("Window", "Rebar") or utils.is_clone(
|
||||
obj, ["Window", "Rebar"]
|
||||
):
|
||||
out.append(obj)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def get_group_contents(objectslist,
|
||||
walls=False, addgroups=False,
|
||||
spaces=False, noarchchild=False):
|
||||
def get_group_contents(objectslist, walls=False, addgroups=False, spaces=False, noarchchild=False):
|
||||
"""Return a list of objects from expanding the input groups.
|
||||
|
||||
The function accepts any type of object, although it is most useful
|
||||
@@ -239,15 +240,12 @@ def get_group_contents(objectslist,
|
||||
for obj in objectslist:
|
||||
if obj:
|
||||
if is_group(obj):
|
||||
if addgroups or (spaces
|
||||
and utils.get_type(obj) == "Space"):
|
||||
if addgroups or (spaces and utils.get_type(obj) == "Space"):
|
||||
newlist.append(obj)
|
||||
if not (noarchchild
|
||||
and utils.get_type(obj) in ("Building",
|
||||
"BuildingPart")):
|
||||
newlist.extend(get_group_contents(obj.Group,
|
||||
walls, addgroups,
|
||||
spaces, noarchchild))
|
||||
if not (noarchchild and utils.get_type(obj) in ("Building", "BuildingPart")):
|
||||
newlist.extend(
|
||||
get_group_contents(obj.Group, walls, addgroups, spaces, noarchchild)
|
||||
)
|
||||
else:
|
||||
# print("adding ", obj.Name)
|
||||
newlist.append(obj)
|
||||
@@ -263,15 +261,11 @@ def get_group_contents(objectslist,
|
||||
return cleanlist
|
||||
|
||||
|
||||
def getGroupContents(objectslist,
|
||||
walls=False, addgroups=False,
|
||||
spaces=False, noarchchild=False):
|
||||
def getGroupContents(objectslist, walls=False, addgroups=False, spaces=False, noarchchild=False):
|
||||
"""Return a list of objects from groups. DEPRECATED."""
|
||||
utils.use_instead("get_group_contents")
|
||||
|
||||
return get_group_contents(objectslist,
|
||||
walls, addgroups,
|
||||
spaces, noarchchild)
|
||||
return get_group_contents(objectslist, walls, addgroups, spaces, noarchchild)
|
||||
|
||||
|
||||
def get_movable_children(objectslist, recursive=True, _donelist=[]):
|
||||
@@ -313,19 +307,28 @@ def get_movable_children(objectslist, recursive=True, _donelist=[]):
|
||||
_donelist.append(obj.Name)
|
||||
|
||||
# Skips some objects that should never move their children
|
||||
if utils.get_type(obj) not in ("App::Part", "PartDesign::Body",
|
||||
"Clone", "SectionPlane",
|
||||
"Facebinder", "BuildingPart", "App::Link"):
|
||||
if utils.get_type(obj) not in (
|
||||
"App::Part",
|
||||
"PartDesign::Body",
|
||||
"Clone",
|
||||
"SectionPlane",
|
||||
"Facebinder",
|
||||
"BuildingPart",
|
||||
"App::Link",
|
||||
):
|
||||
children = obj.OutList
|
||||
if (hasattr(obj, "Proxy") and obj.Proxy
|
||||
and hasattr(obj.Proxy, "getSiblings")
|
||||
and utils.get_type(obj) != "Window"):
|
||||
if (
|
||||
hasattr(obj, "Proxy")
|
||||
and obj.Proxy
|
||||
and hasattr(obj.Proxy, "getSiblings")
|
||||
and utils.get_type(obj) != "Window"
|
||||
):
|
||||
# children.extend(obj.Proxy.getSiblings(obj))
|
||||
pass
|
||||
|
||||
for child in children:
|
||||
if hasattr(child, "MoveWithHost") and child.MoveWithHost:
|
||||
if hasattr(obj, "CloneOf") and obj.CloneOf:
|
||||
if hasattr(obj, "CloneOf") and obj.CloneOf:
|
||||
if obj.CloneOf.Name != child.Name:
|
||||
added.append(child)
|
||||
else:
|
||||
@@ -342,4 +345,5 @@ def getMovableChildren(objectslist, recursive=True):
|
||||
utils.use_instead("get_movable_children")
|
||||
return get_movable_children(objectslist, recursive)
|
||||
|
||||
|
||||
## @}
|
||||
|
||||
Reference in New Issue
Block a user