Arch: More bugfixes
This commit is contained in:
parent
73ee872301
commit
a26daf5d23
|
@ -308,16 +308,23 @@ class ViewProviderComponent:
|
|||
return False
|
||||
|
||||
class ArchSelectionObserver:
|
||||
def __init__(self,origin,watched):
|
||||
def __init__(self,origin,watched,hide=True,nextCommand=None):
|
||||
self.origin = origin
|
||||
self.watched = watched
|
||||
self.hide = hide
|
||||
self.nextCommand = nextCommand
|
||||
def addSelection(self,document, object, element, position):
|
||||
if object == self.watched.Name:
|
||||
if not element:
|
||||
print "closing Sketch edit"
|
||||
self.origin.ViewObject.Transparency = 0
|
||||
self.origin.ViewObject.Selectable = True
|
||||
self.watched.ViewObject.hide()
|
||||
if self.hide:
|
||||
self.origin.ViewObject.Transparency = 0
|
||||
self.origin.ViewObject.Selectable = True
|
||||
self.watched.ViewObject.hide()
|
||||
FreeCADGui.activateWorkbench("ArchWorkbench")
|
||||
FreeCADGui.Selection.removeObserver(FreeCAD.ArchObserver)
|
||||
if self.nextCommand:
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
FreeCADGui.Selection.addSelection(self.watched)
|
||||
FreeCADGui.runCommand(self.nextCommand)
|
||||
del FreeCAD.ArchObserver
|
||||
|
|
|
@ -234,6 +234,7 @@ class _ArchDrawingView:
|
|||
svgf = Drawing.projectToSVG(base,DraftVecUtils.neg(direction))
|
||||
if svgf:
|
||||
svgf = svgf.replace('stroke-width="0.35"','stroke-width="' + str(linewidth) + 'px"')
|
||||
svgf = svgf.replace('stroke-width:0.01','stroke-width:' + str(linewidth) + 'px')
|
||||
svg += svgf
|
||||
|
||||
result = ''
|
||||
|
|
|
@ -574,7 +574,7 @@ class Renderer:
|
|||
svg += '" '
|
||||
svg += 'stroke="#000000" '
|
||||
svg += 'stroke-width="' + str(linewidth) + '" '
|
||||
svg += 'style="stroke-width:0.01;'
|
||||
svg += 'style="stroke-width:' + str(linewidth) + ';'
|
||||
svg += 'stroke-miterlimit:1;'
|
||||
svg += 'stroke-linejoin:round;'
|
||||
svg += 'stroke-dasharray:none;'
|
||||
|
@ -598,7 +598,7 @@ class Renderer:
|
|||
svg += '" '
|
||||
svg += 'stroke="#000000" '
|
||||
svg += 'stroke-width="' + str(linewidth) + '" '
|
||||
svg += 'style="stroke-width:0.01;'
|
||||
svg += 'style="stroke-width:' + str(linewidth) + ';'
|
||||
svg += 'stroke-miterlimit:1;'
|
||||
svg += 'stroke-linejoin:round;'
|
||||
svg += 'stroke-dasharray:none;'
|
||||
|
|
|
@ -256,7 +256,10 @@ class _Wall(ArchComponent.Component):
|
|||
str(translate("Arch","The alignment of this wall on its base object, if applicable")))
|
||||
obj.addProperty("App::PropertyVector","Normal","Base",
|
||||
str(translate("Arch","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")))
|
||||
obj.addProperty("App::PropertyBool","ForceWire","Base",
|
||||
str(translate("Arch","If True, if this wall is based on a face, it will use its border wire as trace, and disconsider the face.")))
|
||||
obj.Align = ['Left','Right','Center']
|
||||
obj.ForceWire = False
|
||||
self.Type = "Wall"
|
||||
obj.Width = 0.1
|
||||
obj.Height = 0
|
||||
|
@ -265,7 +268,6 @@ class _Wall(ArchComponent.Component):
|
|||
self.createGeometry(obj)
|
||||
|
||||
def onChanged(self,obj,prop):
|
||||
print prop
|
||||
if prop in ["Base","Height","Width","Align","Additions","Subtractions"]:
|
||||
self.createGeometry(obj)
|
||||
|
||||
|
@ -359,7 +361,7 @@ class _Wall(ArchComponent.Component):
|
|||
base = obj.Base.Shape.copy()
|
||||
if base.Solids:
|
||||
pass
|
||||
elif base.Faces:
|
||||
elif base.Faces and (not obj.ForceWire):
|
||||
if height:
|
||||
norm = normal.multiply(height)
|
||||
base = base.extrude(norm)
|
||||
|
@ -372,6 +374,13 @@ class _Wall(ArchComponent.Component):
|
|||
else:
|
||||
temp = sh
|
||||
base = temp
|
||||
elif base.Edges:
|
||||
wire = Part.Wire(base.Edges)
|
||||
sh = getbase(wire)
|
||||
if sh:
|
||||
base = sh
|
||||
else:
|
||||
FreeCAD.Console.PrintError(str(translate("Arch","Error: Invalid base object")))
|
||||
|
||||
for app in obj.Additions:
|
||||
if hasattr(app,"Shape"):
|
||||
|
@ -399,7 +408,7 @@ class _Wall(ArchComponent.Component):
|
|||
try:
|
||||
base = base.removeSplitter()
|
||||
except:
|
||||
print "Wall: Error removing splitter"
|
||||
FreeCAD.Console.PrintError(str(translate("Arch","Error removing splitter from wall shape")))
|
||||
obj.Shape = base
|
||||
if not DraftGeomUtils.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
|
|
@ -92,6 +92,8 @@ class _CommandWindow:
|
|||
if Draft.getType(sel[0]) == "Wall":
|
||||
FreeCADGui.activateWorkbench("SketcherWorkbench")
|
||||
FreeCADGui.runCommand("Sketcher_NewSketch")
|
||||
FreeCAD.ArchObserver = ArchComponent.ArchSelectionObserver(sel[0],FreeCAD.ActiveDocument.Objects[-1],hide=False,nextCommand="Arch_Window")
|
||||
FreeCADGui.Selection.addObserver(FreeCAD.ArchObserver)
|
||||
else:
|
||||
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Window")))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
|
|
Loading…
Reference in New Issue
Block a user