Draft: Housekeeping: call 'make' functions with new name, continued

This commit is contained in:
Roy
2022-02-11 17:21:53 +01:00
committed by Uwe
parent 6953a7cea8
commit 5bbf59141e
10 changed files with 25 additions and 25 deletions

View File

@@ -93,7 +93,7 @@ class Clone(gui_base_original.Modifier):
n = 0
for obj in Gui.Selection.getSelection():
if obj not in nonRepeatList:
_cmd = "Draft.clone"
_cmd = "Draft.make_clone"
_cmd += "("
_cmd += "FreeCAD.ActiveDocument."
_cmd += 'getObject("' + obj.Name + '")'

View File

@@ -126,8 +126,8 @@ class Drawing(gui_base_original.Modifier):
# oldobj = self.page.getObject(name)
# if oldobj:
# self.doc.removeObject(oldobj.Name)
Draft.makeDrawingView(obj, self.page,
otherProjection=otherProjection)
Draft.make_drawing_view(obj, self.page,
otherProjection=otherProjection)
self.doc.recompute()
def createDefaultPage(self):

View File

@@ -122,7 +122,7 @@ class Ellipse(gui_base_original.Creator):
_cmd_list)
else:
# Insert a Draft ellipse
_cmd = 'Draft.makeEllipse'
_cmd = 'Draft.make_ellipse'
_cmd += '('
_cmd += str(r1) + ', ' + str(r2) + ', '
_cmd += 'placement=pl, '

View File

@@ -81,7 +81,7 @@ class Facebinder(gui_base_original.Creator):
App.ActiveDocument.openTransaction("Create Facebinder")
Gui.addModule("Draft")
Gui.doCommand("s = FreeCADGui.Selection.getSelectionEx()")
Gui.doCommand("facebinder = Draft.makeFacebinder(s)")
Gui.doCommand("facebinder = Draft.make_facebinder(s)")
Gui.doCommand('Draft.autogroup(facebinder)')
Gui.doCommand('FreeCAD.ActiveDocument.recompute()')
App.ActiveDocument.commitTransaction()

View File

@@ -237,7 +237,7 @@ class Scale(gui_base_original.Modifier):
str_delta = DraftVecUtils.toString(self.delta)
str_delta_corr = DraftVecUtils.toString(App.Vector(1,1,1) - self.delta)
_cmd = 'Draft.clone'
_cmd = 'Draft.make_clone'
_cmd += '('
_cmd += objects + ', '
_cmd += 'forcedraft=True'

View File

@@ -40,22 +40,22 @@ if App.GuiUp:
def make_clone(obj, delta=None, forcedraft=False):
"""clone(obj,[delta,forcedraft])
Makes a clone of the given object(s).
Makes a clone of the given object(s).
The clone is an exact, linked copy of the given object. If the original
object changes, the final object changes too.
object changes, the final object changes too.
Parameters
----------
obj :
obj :
delta : Base.Vector
Delta Vector to move the clone from the original position.
Delta Vector to move the clone from the original position.
forcedraft : bool
If forcedraft is True, the resulting object is a Draft clone
even if the input object is an Arch object.
"""
prefix = utils.get_param("ClonePrefix","")
@@ -79,7 +79,7 @@ def make_clone(obj, delta=None, forcedraft=False):
cl = Arch.makeComponent()
else:
try:
clonefunc = getattr(Arch,"make"+obj[0].Proxy.Type)
clonefunc = getattr(Arch, "make_" + obj[0].Proxy.Type.lower())
except Exception:
pass # not a standard Arch object... Fall back to Draft mode
else:

View File

@@ -37,10 +37,10 @@ if App.GuiUp:
def make_facebinder(selectionset, name="Facebinder"):
"""makeFacebinder(selectionset, [name])
"""make_facebinder(selectionset, [name])
Creates a Facebinder object from a selection set.
Parameters
----------
selectionset :

View File

@@ -563,7 +563,7 @@ class DraftModification(unittest.TestCase):
_msg(" Drawing view")
_msg(" page={}".format(page.TypeId))
_msg(" template={}".format(page.Template))
obj = Draft.makeDrawingView(prism, page, otherProjection=None)
obj = Draft.make_drawing_view(prism, page, otherProjection=None)
self.assertTrue(obj, "'{}' failed".format(operation))
def test_mirror(self):

View File

@@ -167,23 +167,23 @@ def get_param_type(param):
"precision", "defaultWP", "snapRange", "gridEvery",
"linewidth", "UiMode", "modconstrain", "modsnap",
"maxSnapEdges", "modalt", "HatchPatternResolution",
"snapStyle", "dimstyle", "gridSize","gridTransparency"):
"snapStyle", "dimstyle", "gridSize", "gridTransparency"):
return "int"
elif param in ("constructiongroupname", "textfont",
"patternFile", "template", "snapModes",
"FontFile", "ClonePrefix","overrideUnit",
"FontFile", "ClonePrefix", "overrideUnit",
"labeltype") or "inCommandShortcut" in param:
return "string"
elif param in ("textheight", "tolerance", "gridSpacing",
"arrowsize", "extlines", "dimspacing",
"dimovershoot", "extovershoot","HatchPatternSize"):
"dimovershoot", "extovershoot", "HatchPatternSize"):
return "float"
elif param in ("selectBaseObjects", "alwaysSnap", "grid",
"fillmode", "saveonexit", "maxSnap",
"SvgLinesBlack", "dxfStdSize", "showSnapBar",
"hideSnapBar", "alwaysShowGrid", "renderPolylineWidth",
"showPlaneTracker", "UsePartPrimitives",
"DiscretizeEllipses", "showUnit","coloredGridAxes",
"DiscretizeEllipses", "showUnit", "coloredGridAxes",
"Draft_array_fuse", "Draft_array_Link", "gridBorder"):
return "bool"
elif param in ("color", "constructioncolor",
@@ -509,14 +509,14 @@ def is_clone(obj, objtype=None, recursive=False):
if `obj` is not even a clone.
"""
if isinstance(objtype, list):
return any([isClone(obj, t, recursive) for t in objtype])
return any([is_clone(obj, t, recursive) for t in objtype])
if getType(obj) == "Clone":
if len(obj.Objects) == 1:
if objtype:
if getType(obj.Objects[0]) == objtype:
return True
elif recursive and (getType(obj.Objects[0]) == "Clone"):
return isClone(obj.Objects[0], objtype, recursive)
return is_clone(obj.Objects[0], objtype, recursive)
elif hasattr(obj, "CloneOf"):
if obj.CloneOf:
if objtype:

View File

@@ -1815,7 +1815,7 @@ def drawInsert(insert, num=None, clone=False):
addText(a, attrib=True)
if clone:
if insert.block in blockobjects:
newob = Draft.clone(blockobjects[insert.block])
newob = Draft.make_clone(blockobjects[insert.block])
tsf = FreeCAD.Matrix()
rot = math.radians(insert.rotation)
pos = vec(insert.loc)