[ArchWall] Disable Input (ReadyOny) if Base (ArchSketch) Provided
To avoid confusion, attributes e.g. Align, Width, Offset, Override (Align/ Width/ Offset) would be disabled, if Base object is ArchSketch which provided the above information FC Forum Discussion : https://forum.freecad.org/viewtopic.php?t=87721&start=30#p763761
This commit is contained in:
+60
-6
@@ -159,29 +159,29 @@ class _Wall(ArchComponent.Component):
|
||||
if not "Length" in lp:
|
||||
obj.addProperty("App::PropertyLength","Length","Wall",QT_TRANSLATE_NOOP("App::Property","The length of this wall. Not used if this wall is based on an underlying object"))
|
||||
if not "Width" in lp:
|
||||
obj.addProperty("App::PropertyLength","Width","Wall",QT_TRANSLATE_NOOP("App::Property","The width of this wall. Not used if this wall is based on a face"))
|
||||
obj.addProperty("App::PropertyLength","Width","Wall",QT_TRANSLATE_NOOP("App::Property","The width of this wall. Not used if this wall is based on a face. Disabled and ignored if Base object (ArchSketch) provides the information."))
|
||||
|
||||
# To be combined into Width when PropertyLengthList is available
|
||||
if not "OverrideWidth" in lp:
|
||||
obj.addProperty("App::PropertyFloatList","OverrideWidth","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Width attribute to set width of each segment of wall. Ignored if Base object provides Widths information, with getWidths() method (If a value is zero, the value of 'Width' will be followed). [ENHANCEMENT by ArchSketch] GUI 'Edit Wall Segment Width' Tool is provided in external SketchArch Add-on to let users to set the values interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used.")) # see DraftGeomUtils.offsetwire()
|
||||
obj.addProperty("App::PropertyFloatList","OverrideWidth","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Width attribute to set width of each segment of wall. Disabled and ignored if Base object (ArchSketch) provides Widths information, with getWidths() method (If a value is zero, the value of 'Width' will be followed). [ENHANCEMENT by ArchSketch] GUI 'Edit Wall Segment Width' Tool is provided in external SketchArch Add-on to let users to set the values interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used.")) # see DraftGeomUtils.offsetwire()
|
||||
if not "OverrideAlign" in lp:
|
||||
obj.addProperty("App::PropertyStringList","OverrideAlign","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Align attribute to set align of each segment of wall. Ignored if Base object provides Aligns information, with getAligns() method (If a value is not 'Left, Right, Center', the value of 'Align' will be followed). [ENHANCEMENT by ArchSketch] GUI 'Edit Wall Segment Align' Tool is provided in external SketchArch Add-on to let users to set the values interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used.")) # see DraftGeomUtils.offsetwire()
|
||||
obj.addProperty("App::PropertyStringList","OverrideAlign","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Align attribute to set align of each segment of wall. Disabled and ignored if Base object (ArchSketch) provides Aligns information, with getAligns() method (If a value is not 'Left, Right, Center', the value of 'Align' will be followed). [ENHANCEMENT by ArchSketch] GUI 'Edit Wall Segment Align' Tool is provided in external SketchArch Add-on to let users to set the values interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used.")) # see DraftGeomUtils.offsetwire()
|
||||
if not "OverrideOffset" in lp:
|
||||
obj.addProperty("App::PropertyFloatList","OverrideOffset","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Offset attribute to set offset of each segment of wall. Ignored if Base object provides Offsets information, with getOffsets() method (If a value is zero, the value of 'Offset' will be followed). [ENHANCED by ArchSketch] GUI 'Edit Wall Segment Offset' Tool is provided in external Add-on ('SketchArch') to let users to select the edges interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used. Property is ignored if Base ArchSketch provided the selected edges. ")) # see DraftGeomUtils.offsetwire()
|
||||
obj.addProperty("App::PropertyFloatList","OverrideOffset","Wall",QT_TRANSLATE_NOOP("App::Property","This overrides Offset attribute to set offset of each segment of wall. Disabled and ignored if Base object (ArchSketch) provides Offsets information, with getOffsets() method (If a value is zero, the value of 'Offset' will be followed). [ENHANCED by ArchSketch] GUI 'Edit Wall Segment Offset' Tool is provided in external Add-on ('SketchArch') to let users to select the edges interactively. 'Toponaming-Tolerant' if ArchSketch is used in Base (and SketchArch Add-on is installed). Warning : Not 'Toponaming-Tolerant' if just Sketch is used. Property is ignored if Base ArchSketch provided the selected edges. ")) # see DraftGeomUtils.offsetwire()
|
||||
if not "Height" in lp:
|
||||
obj.addProperty("App::PropertyLength","Height","Wall",QT_TRANSLATE_NOOP("App::Property","The height of this wall. Keep 0 for automatic. Not used if this wall is based on a solid"))
|
||||
if not "Area" in lp:
|
||||
obj.addProperty("App::PropertyArea","Area","Wall",QT_TRANSLATE_NOOP("App::Property","The area of this wall as a simple Height * Length calculation"))
|
||||
obj.setEditorMode("Area",1)
|
||||
if not "Align" in lp:
|
||||
obj.addProperty("App::PropertyEnumeration","Align","Wall",QT_TRANSLATE_NOOP("App::Property","The alignment of this wall on its base object, if applicable"))
|
||||
obj.addProperty("App::PropertyEnumeration","Align","Wall",QT_TRANSLATE_NOOP("App::Property","The alignment of this wall on its base object, if applicable. Disabled and ignored if Base object (ArchSketch) provides the information."))
|
||||
obj.Align = ['Left','Right','Center']
|
||||
if not "Normal" in lp:
|
||||
obj.addProperty("App::PropertyVector","Normal","Wall",QT_TRANSLATE_NOOP("App::Property","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)"))
|
||||
if not "Face" in lp:
|
||||
obj.addProperty("App::PropertyInteger","Face","Wall",QT_TRANSLATE_NOOP("App::Property","The face number of the base object used to build this wall"))
|
||||
if not "Offset" in lp:
|
||||
obj.addProperty("App::PropertyDistance","Offset","Wall",QT_TRANSLATE_NOOP("App::Property","The offset between this wall and its baseline (only for left and right alignments)"))
|
||||
obj.addProperty("App::PropertyDistance","Offset","Wall",QT_TRANSLATE_NOOP("App::Property","The offset between this wall and its baseline (only for left and right alignments). Disabled and ignored if Base object (ArchSketch) provides the information."))
|
||||
|
||||
# See getExtrusionData(), removeSplitters are no longer used
|
||||
#if not "Refine" in lp:
|
||||
@@ -215,6 +215,33 @@ class _Wall(ArchComponent.Component):
|
||||
ArchComponent.Component.onDocumentRestored(self,obj)
|
||||
self.setProperties(obj)
|
||||
|
||||
if Draft.getType(obj.Base) == "ArchSketch":
|
||||
if hasattr(obj,"Width"):
|
||||
obj.setEditorMode("Width", ["ReadOnly"])
|
||||
if hasattr(obj,"Align"):
|
||||
obj.setEditorMode("Align", ["ReadOnly"])
|
||||
if hasattr(obj,"Offset"):
|
||||
obj.setEditorMode("Offset", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideWidth"):
|
||||
obj.setEditorMode("OverrideWidth", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideAlign"):
|
||||
obj.setEditorMode("OverrideAlign", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideOffset"):
|
||||
obj.setEditorMode("OverrideOffset", ["ReadOnly"])
|
||||
else:
|
||||
if hasattr(obj,"Width"):
|
||||
obj.setEditorMode("Width", 0)
|
||||
if hasattr(obj,"Align"):
|
||||
obj.setEditorMode("Align", 0)
|
||||
if hasattr(obj,"Offset"):
|
||||
obj.setEditorMode("Offset", 0)
|
||||
if hasattr(obj,"OverrideWidth"):
|
||||
obj.setEditorMode("OverrideWidth", 0)
|
||||
if hasattr(obj,"OverrideAlign"):
|
||||
obj.setEditorMode("OverrideAlign", 0)
|
||||
if hasattr(obj,"OverrideOffset"):
|
||||
obj.setEditorMode("OverrideOffset", 0)
|
||||
|
||||
def execute(self,obj):
|
||||
"""Method run when the object is recomputed.
|
||||
|
||||
@@ -486,6 +513,33 @@ class _Wall(ArchComponent.Component):
|
||||
else:
|
||||
FreeCAD.Console.PrintError(translate("Arch","Error: Unable to modify the base object of this wall")+"\n")
|
||||
|
||||
if Draft.getType(obj.Base) == "ArchSketch":
|
||||
if hasattr(obj,"Width"):
|
||||
obj.setEditorMode("Width", ["ReadOnly"])
|
||||
if hasattr(obj,"Align"):
|
||||
obj.setEditorMode("Align", ["ReadOnly"])
|
||||
if hasattr(obj,"Offset"):
|
||||
obj.setEditorMode("Offset", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideWidth"):
|
||||
obj.setEditorMode("OverrideWidth", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideAlign"):
|
||||
obj.setEditorMode("OverrideAlign", ["ReadOnly"])
|
||||
if hasattr(obj,"OverrideOffset"):
|
||||
obj.setEditorMode("OverrideOffset", ["ReadOnly"])
|
||||
else:
|
||||
if hasattr(obj,"Width"):
|
||||
obj.setEditorMode("Width", 0)
|
||||
if hasattr(obj,"Align"):
|
||||
obj.setEditorMode("Align", 0)
|
||||
if hasattr(obj,"Offset"):
|
||||
obj.setEditorMode("Offset", 0)
|
||||
if hasattr(obj,"OverrideWidth"):
|
||||
obj.setEditorMode("OverrideWidth", 0)
|
||||
if hasattr(obj,"OverrideAlign"):
|
||||
obj.setEditorMode("OverrideAlign", 0)
|
||||
if hasattr(obj,"OverrideOffset"):
|
||||
obj.setEditorMode("OverrideOffset", 0)
|
||||
|
||||
self.hideSubobjects(obj,prop)
|
||||
ArchComponent.Component.onChanged(self,obj,prop)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user