Esempio n. 1
0
def makeWall(baseobj=None,
             length=None,
             width=None,
             height=None,
             align="Center",
             name=str(translate("Arch", "Wall"))):
    '''makeWall([obj],[length],[width],[height],[align],[name]): creates a wall based on the
    given object, which can be a sketch, a draft object, a face or a solid, or no object at
    all, then you must provide length, width and height. Align
    can be "Center","Left" or "Right"'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
    _Wall(obj)
    _ViewProviderWall(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
    if length:
        obj.Length = length
    if width:
        obj.Width = width
    if height:
        obj.Height = height
    obj.Align = align
    if obj.Base:
        obj.Base.ViewObject.hide()
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Wall")
    return obj
Esempio n. 2
0
def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name=translate("Arch","Wall")):
    '''makeWall([obj],[length],[width],[height],[align],[face],[name]): creates a wall based on the
    given object, which can be a sketch, a draft object, a face or a solid, or no object at
    all, then you must provide length, width and height. Align can be "Center","Left" or "Right", 
    face can be an index number of a face in the base object to base the wall on.'''
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Wall(obj)
    if FreeCAD.GuiUp:
        _ViewProviderWall(obj.ViewObject)
        obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Wall")

    if baseobj:
        obj.Base = baseobj
    if face:
        obj.Face = face
    if length:
        obj.Length = length
    if width:
        obj.Width = width
    else:
        obj.Width = p.GetFloat("WallWidth",200)
    if height:
        obj.Height = height
    else:
        obj.Height = p.GetFloat("WallHeight",3000)
    obj.Align = align
    if obj.Base and FreeCAD.GuiUp:
        if Draft.getType(obj.Base) != "Space":
            obj.Base.ViewObject.hide()
    return obj
Esempio n. 3
0
def makeStructure(baseobj=None,
                  length=0,
                  width=0,
                  height=0,
                  name=translate("Arch", "Structure")):
    '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a
    structure element based on the given profile object and the given
    extrusion height. If no base object is given, you can also specify
    length and width for a cubic object.'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
    _Structure(obj)
    _ViewProviderStructure(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
        obj.Base.ViewObject.hide()
    if width:
        obj.Width = width
    if height:
        obj.Height = height
    if length:
        obj.Length = length
    if height > length:
        obj.Role = "Column"
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Structure")
    return obj
 def __init__(self, vobj):
     ArchComponent.ViewProviderComponent.__init__(self, vobj)
     vobj.addProperty(
         "App::PropertyBool",
         "ShowNodes",
         "Arch",
         QT_TRANSLATE_NOOP("App::Property", "If the nodes are visible or not"),
     ).ShowNodes = False
     vobj.addProperty(
         "App::PropertyFloat", "NodeLine", "Base", QT_TRANSLATE_NOOP("App::Property", "The width of the nodes line")
     )
     vobj.addProperty(
         "App::PropertyFloat", "NodeSize", "Base", QT_TRANSLATE_NOOP("App::Property", "The size of the node points")
     )
     vobj.addProperty(
         "App::PropertyColor", "NodeColor", "Base", QT_TRANSLATE_NOOP("App::Property", "The color of the nodes line")
     )
     vobj.addProperty(
         "App::PropertyEnumeration",
         "NodeType",
         "Arch",
         QT_TRANSLATE_NOOP("App::Property", "The type of structural node"),
     )
     vobj.NodeColor = (1.0, 1.0, 1.0, 1.0)
     vobj.NodeSize = 6
     vobj.NodeType = ["Linear", "Area"]
     vobj.ShapeColor = ArchCommands.getDefaultColor("Structure")
Esempio n. 5
0
def makeRebar(baseobj,sketch,diameter=None,amount=1,offset=None,name=translate("Arch","Rebar")):
    """makeRebar(baseobj,sketch,[diameter,amount,offset,name]): adds a Reinforcement Bar object
    to the given structural object, using the given sketch as profile."""
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Rebar(obj)
    _ViewProviderRebar(obj.ViewObject)
    if hasattr(sketch,"Support"):
        if sketch.Support:
            if isinstance(sketch.Support,tuple):
                if sketch.Support[0] == baseobj:
                    sketch.Support = None
            elif sketch.Support == baseobj:
                sketch.Support = None
    obj.Base = sketch
    sketch.ViewObject.hide()
    a = baseobj.Armatures
    a.append(obj)
    baseobj.Armatures = a
    if diameter:
        obj.Diameter = diameter
    else:
        obj.Diameter = p.GetFloat("RebarDiameter",6)
    obj.Amount = amount
    if offset:
        obj.OffsetStart = offset
        obj.OffsetEnd = offset
    else:
        obj.OffsetStart = p.GetFloat("RebarOffset",30)
        obj.OffsetEnd = p.GetFloat("RebarOffset",30)
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Rebar")
    return obj
    def __init__(self,vobj):

        vobj.addExtension("Gui::ViewProviderGroupExtensionPython", self)
        #vobj.addExtension("Gui::ViewProviderGeoFeatureGroupExtensionPython", self)
        vobj.Proxy = self
        self.setProperties(vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Helpers")
Esempio n. 7
0
def makeStructure(baseobj=None,length=None,width=None,height=None,name=translate("Arch","Structure")):
    '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a
    structure element based on the given profile object and the given
    extrusion height. If no base object is given, you can also specify
    length and width for a cubic object.'''
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Structure(obj)
    if FreeCAD.GuiUp:
        _ViewProviderStructure(obj.ViewObject)
        obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Structure")
    if baseobj:
        obj.Base = baseobj
        obj.Base.ViewObject.hide()
    if width:
        obj.Width = width
    else:
        obj.Width = p.GetFloat("StructureWidth",100)
    if height:
        obj.Height = height
    else:
        obj.Height = p.GetFloat("StructureHeight",1000)
    if length:
        obj.Length = length
    else:
        if not baseobj:
            # don't set the length if we have a base object, otherwise the lenght X height calc
            # gets wrong
            obj.Length = p.GetFloat("StructureLength",100)
    if height > length:
        obj.Role = "Column"
    return obj
Esempio n. 8
0
def makePanel(baseobj=None,
              length=0,
              width=0,
              thickness=0,
              placement=None,
              name="Panel"):
    '''makePanel([obj],[length],[width],[thickness],[placement]): creates a
    panel element based on the given profile object and the given
    extrusion thickness. If no base object is given, you can also specify
    length and width for a simple cubic object.'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
    obj.Label = translate("Arch", name)
    _Panel(obj)
    _ViewProviderPanel(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
        obj.Base.ViewObject.hide()
    if width:
        obj.Width = width
    if thickness:
        obj.Thickness = thickness
    if length:
        obj.Length = length
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Panel")
    return obj
Esempio n. 9
0
def makeWall(baseobj=None,length=None,width=None,height=None,align="Center",face=None,name=translate("Arch","Wall")):
    '''makeWall([obj],[length],[width],[height],[align],[face],[name]): creates a wall based on the
    given object, which can be a sketch, a draft object, a face or a solid, or no object at
    all, then you must provide length, width and height. Align can be "Center","Left" or "Right", 
    face can be an index number of a face in the base object to base the wall on.'''
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Wall(obj)
    _ViewProviderWall(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
    if face:
        obj.Face = face
    if length:
        obj.Length = length
    if width:
        obj.Width = width
    else:
        obj.Width = p.GetFloat("WallWidth",200)
    if height:
        obj.Height = height
    else:
        obj.Height = p.GetFloat("WallHeight",3000)
    obj.Align = align
    if obj.Base:
        if Draft.getType(obj.Base) != "Space":
            obj.Base.ViewObject.hide()
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Wall")
    return obj
Esempio n. 10
0
 def __init__(self, vobj):
     ArchComponent.ViewProviderComponent.__init__(self, vobj)
     vobj.addProperty("App::PropertyString", "RebarShape", "Arch",
                      QT_TRANSLATE_NOOP("App::Property",
                                        "Shape of rebar")).RebarShape
     vobj.ShapeColor = ArchCommands.getDefaultColor("Rebar")
     vobj.setEditorMode("RebarShape", 2)
def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structure"):
    '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a
    structure element based on the given profile object and the given
    extrusion height. If no base object is given, you can also specify
    length and width for a cubic object.'''
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    obj.Label = translate("Arch",name)
    _Structure(obj)
    if FreeCAD.GuiUp:
        _ViewProviderStructure(obj.ViewObject)
        obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Structure")
    if baseobj:
        obj.Base = baseobj
        if FreeCAD.GuiUp:
            obj.Base.ViewObject.hide()
    if width:
        obj.Width = width
    else:
        obj.Width = p.GetFloat("StructureWidth",100)
    if height:
        obj.Height = height
    else:
        obj.Height = p.GetFloat("StructureHeight",1000)
    if length:
        obj.Length = length
    else:
        if not baseobj:
            # don't set the length if we have a base object, otherwise the lenght X height calc
            # gets wrong
            obj.Length = p.GetFloat("StructureLength",100)
    if height > length:
        obj.Role = "Column"
    return obj
Esempio n. 12
0
    def __init__(self, vobj):

        vobj.addExtension("Gui::ViewProviderGroupExtensionPython", self)
        #vobj.addExtension("Gui::ViewProviderGeoFeatureGroupExtensionPython", self)
        vobj.Proxy = self
        self.setProperties(vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Helpers")
Esempio n. 13
0
    def colorize(self, obj, force=False):

        "setting different part colors"

        if not obj.Shape or not obj.Shape.Solids:
            return
        basecolor = obj.ViewObject.ShapeColor
        basetransparency = obj.ViewObject.Transparency / 100.0
        panelcolor = ArchCommands.getDefaultColor("WindowGlass")
        paneltransparency = 0.7
        if hasattr(obj, "Material") and obj.Material and hasattr(
                obj.Material, "Materials"):
            if obj.Material.Names:
                if "Frame" in obj.Material.Names:
                    mat = obj.Material.Materials[obj.Material.Names.index(
                        "Frame")]
                    if ('DiffuseColor' in mat.Material) and (
                            "(" in mat.Material['DiffuseColor']):
                        basecolor = tuple([
                            float(f) for f in
                            mat.Material['DiffuseColor'].strip("()").split(",")
                        ])
                if "Glass panel" in obj.Material.Names:
                    mat = obj.Material.Materials[obj.Material.Names.index(
                        "Glass panel")]
                    if ('DiffuseColor' in mat.Material) and (
                            "(" in mat.Material['DiffuseColor']):
                        panelcolor = tuple([
                            float(f) for f in
                            mat.Material['DiffuseColor'].strip("()").split(",")
                        ])
                    if ('Transparency' in mat.Material):
                        paneltransparency = float(
                            mat.Material['Transparency']) / 100.0
                elif "Solid panel" in obj.Material.Names:
                    mat = obj.Material.Materials[obj.Material.Names.index(
                        "Solid panel")]
                    if ('DiffuseColor' in mat.Material) and (
                            "(" in mat.Material['DiffuseColor']):
                        panelcolor = tuple([
                            float(f) for f in
                            mat.Material['DiffuseColor'].strip("()").split(",")
                        ])
                    paneltransparency = 0
        basecolor = basecolor[:3] + (basetransparency, )
        panelcolor = panelcolor[:3] + (paneltransparency, )
        colors = []
        nmullions = obj.VerticalMullionNumber + obj.HorizontalMullionNumber + obj.DiagonalMullionNumber
        for i, solid in enumerate(obj.Shape.Solids):
            for _ in solid.Faces:
                if i < nmullions:
                    colors.append(basecolor)
                else:
                    colors.append(panelcolor)
        if self.areDifferentColors(colors,
                                   obj.ViewObject.DiffuseColor) or force:
            obj.ViewObject.DiffuseColor = colors
Esempio n. 14
0
 def __init__(self,vobj):
     ArchComponent.ViewProviderComponent.__init__(self,vobj)
     vobj.addProperty("App::PropertyBool","ShowNodes","Arch","If the nodes are visible or not").ShowNodes = False
     vobj.addProperty("App::PropertyFloat","NodeLine","Base","The width of the nodes line")
     vobj.addProperty("App::PropertyFloat","NodeSize","Base","The size of the node points")
     vobj.addProperty("App::PropertyColor","NodeColor","Base","The color of the nodes line")
     vobj.NodeColor = (1.0,1.0,1.0,1.0)
     vobj.NodeSize = 6
     vobj.ShapeColor = ArchCommands.getDefaultColor("Structure")
Esempio n. 15
0
 def __init__(self, vobj):
     super(ViewProviderRebarCommon, self).__init__(vobj)
     pl = vobj.PropertiesList
     if "RebarShape" not in pl:
         vobj.addProperty(
             "App::PropertyString", "RebarShape", "Rebar Shape",
             QT_TRANSLATE_NOOP("App::Property",
                               "Shape of rebar")).RebarShape
         vobj.setEditorMode("RebarShape", 2)
     vobj.ShapeColor = ArchCommands.getDefaultColor("Rebar")
Esempio n. 16
0
 def __init__(self,vobj):
     ArchComponent.ViewProviderComponent.__init__(self,vobj)
     vobj.addProperty("App::PropertyBool","ShowNodes","Arch",QT_TRANSLATE_NOOP("App::Property","If the nodes are visible or not")).ShowNodes = False
     vobj.addProperty("App::PropertyFloat","NodeLine","Base",QT_TRANSLATE_NOOP("App::Property","The width of the nodes line"))
     vobj.addProperty("App::PropertyFloat","NodeSize","Base",QT_TRANSLATE_NOOP("App::Property","The size of the node points"))
     vobj.addProperty("App::PropertyColor","NodeColor","Base",QT_TRANSLATE_NOOP("App::Property","The color of the nodes line"))
     vobj.addProperty("App::PropertyEnumeration","NodeType","Arch",QT_TRANSLATE_NOOP("App::Property","The type of structural node"))
     vobj.NodeColor = (1.0,1.0,1.0,1.0)
     vobj.NodeSize = 6
     vobj.NodeType = ["Linear","Area"]
     vobj.ShapeColor = ArchCommands.getDefaultColor("Structure")
Esempio n. 17
0
    def __init__(self,vobj):

        ArchComponent.ViewProviderComponent.__init__(self,vobj)
        self.setProperties(vobj)
        prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
        vobj.Transparency = prefs.GetInt("defaultSpaceTransparency",85)
        vobj.LineWidth = Draft.getParam("linewidth")
        vobj.LineColor = ArchCommands.getDefaultColor("Space")
        vobj.DrawStyle = ["Solid","Dashed","Dotted","Dashdot"][prefs.GetInt("defaultSpaceStyle",2)]
        if prefs.GetInt("defaultSpaceTransparency",85) == 100:
            vobj.DisplayMode = "Wireframe"
Esempio n. 18
0
 def __init__(self, vobj):
     ArchComponent.ViewProviderComponent.__init__(self, vobj)
     vobj.addProperty("App::PropertyBool", "ShowNodes", "Arch",
                      "If the nodes are visible or not").ShowNodes = False
     vobj.addProperty("App::PropertyFloat", "NodeLine", "Base",
                      "The width of the nodes line")
     vobj.addProperty("App::PropertyFloat", "NodeSize", "Base",
                      "The size of the node points")
     vobj.addProperty("App::PropertyColor", "NodeColor", "Base",
                      "The color of the nodes line")
     vobj.NodeColor = (1.0, 1.0, 1.0, 1.0)
     vobj.NodeSize = 6
     vobj.ShapeColor = ArchCommands.getDefaultColor("Structure")
Esempio n. 19
0
 def colorize(self, obj):
     "setting different part colors"
     print "Colorizing ", obj.Shape.Solids
     colors = []
     base = obj.ViewObject.ShapeColor
     for i in range(len(obj.Shape.Solids)):
         ccol = base
         typeidx = (i * 5) + 1
         if typeidx < len(obj.WindowParts):
             typ = obj.WindowParts[typeidx]
             if typ == WindowPartTypes[2]:  # transparent parts
                 ccol = ArchCommands.getDefaultColor("WindowGlass")
         for f in obj.Shape.Solids[i].Faces:
             colors.append(ccol)
     print "colors: ", colors
     obj.ViewObject.DiffuseColor = colors
Esempio n. 20
0
def makeStructure(baseobj=None,length=1,width=1,height=1,name=str(translate("Arch","Structure"))):
    '''makeStructure([obj],[length],[width],[heigth],[swap]): creates a
    structure element based on the given profile object and the given
    extrusion height. If no base object is given, you can also specify
    length and width for a cubic object.'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Structure(obj)
    _ViewProviderStructure(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
        obj.Base.ViewObject.hide()
    obj.Width = width
    obj.Height = height
    obj.Length = length
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Structure")
    return obj
Esempio n. 21
0
 def colorize(self,obj):
     "setting different part colors"
     print "Colorizing ", obj.Shape.Solids
     colors = []
     base = obj.ViewObject.ShapeColor
     for i in range(len(obj.Shape.Solids)):
         ccol = base
         typeidx = (i*5)+1
         if typeidx < len(obj.WindowParts):
             typ = obj.WindowParts[typeidx]
             if typ == WindowPartTypes[2]: # transparent parts
                 ccol = ArchCommands.getDefaultColor("WindowGlass")
         for f in obj.Shape.Solids[i].Faces:
             colors.append(ccol)
     print "colors: ",colors
     obj.ViewObject.DiffuseColor = colors
Esempio n. 22
0
def makeWall(baseobj=None,width=None,height=None,align="Center",name=str(translate("Arch","Wall"))):
    '''makeWall(obj,[width],[height],[align],[name]): creates a wall based on the
    given object, which can be a sketch, a draft object, a face or a solid. align
    can be "Center","Left" or "Right"'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Wall(obj)
    _ViewProviderWall(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
    if width:
        obj.Width = width
    if height:
        obj.Height = height
    obj.Align = align
    if obj.Base:
        obj.Base.ViewObject.hide()
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Wall")
    return obj
Esempio n. 23
0
def makePanel(baseobj=None,length=0,width=0,thickness=0,placement=None,name=translate("Arch","Panel")):
    '''makePanel([obj],[length],[width],[thickness],[placement]): creates a
    panel element based on the given profile object and the given
    extrusion thickness. If no base object is given, you can also specify
    length and width for a simple cubic object.'''
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Panel(obj)
    _ViewProviderPanel(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
        obj.Base.ViewObject.hide()
    if width:
        obj.Width = width
    if thickness:
        obj.Thickness = thickness
    if length:
        obj.Length = length
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Panel")
    return obj
def makeWindow(baseobj=None,width=None,name=str(translate("Arch","Window"))):
    '''makeWindow(obj,[name]): creates a window based on the
    given object'''
    if baseobj:
        if Draft.getType(baseobj) == "Window":
            obj = Draft.clone(baseobj)
            return obj
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
    _Window(obj)
    _ViewProviderWindow(obj.ViewObject)
    if baseobj:
        obj.Base = baseobj
        if width:
            obj.WindowParts = ["Default","Panel","Wire0",str(width),"0"]
        else:
            obj.WindowParts = makeDefaultWindowPart(baseobj)
    if obj.Base:
        obj.Base.ViewObject.DisplayMode = "Wireframe"
        obj.Base.ViewObject.hide()
    obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Window")
    return obj
Esempio n. 25
0
def makeRebar(baseobj,
              sketch,
              diameter=None,
              amount=1,
              offset=None,
              name="Rebar"):
    """makeRebar(baseobj,sketch,[diameter,amount,offset,name]): adds a Reinforcement Bar object
    to the given structural object, using the given sketch as profile."""
    p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
    obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", name)
    obj.Label = translate("Arch", name)
    _Rebar(obj)
    if FreeCAD.GuiUp:
        _ViewProviderRebar(obj.ViewObject)
        obj.ViewObject.ShapeColor = ArchCommands.getDefaultColor("Rebar")
    if hasattr(sketch, "Support"):
        if sketch.Support:
            if isinstance(sketch.Support, tuple):
                if sketch.Support[0] == baseobj:
                    sketch.Support = None
            elif sketch.Support == baseobj:
                sketch.Support = None
    obj.Base = sketch
    if FreeCAD.GuiUp:
        sketch.ViewObject.hide()
    a = baseobj.Armatures
    a.append(obj)
    baseobj.Armatures = a
    if diameter:
        obj.Diameter = diameter
    else:
        obj.Diameter = p.GetFloat("RebarDiameter", 6)
    obj.Amount = amount
    if offset:
        obj.OffsetStart = offset
        obj.OffsetEnd = offset
    else:
        obj.OffsetStart = p.GetFloat("RebarOffset", 30)
        obj.OffsetEnd = p.GetFloat("RebarOffset", 30)
    return obj
Esempio n. 26
0
    def setProperties(self,vobj):

        pl = vobj.PropertiesList
        d = 0
        if "DisplaySize" in pl:
            d = vobj.DisplaySize.Value
            vobj.removeProperty("DisplaySize")
        if not "DisplayLength" in pl:
            vobj.addProperty("App::PropertyLength","DisplayLength","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The display length of this section plane"))
            if d:
                vobj.DisplayLength = d
            else:
                vobj.DisplayLength = 1000
        if not "DisplayHeight" in pl:
            vobj.addProperty("App::PropertyLength","DisplayHeight","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The display height of this section plane"))
            if d:
                vobj.DisplayHeight = d
            else:
                vobj.DisplayHeight = 1000
        if not "ArrowSize" in pl:
            vobj.addProperty("App::PropertyLength","ArrowSize","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The size of the arrows of this section plane"))
            vobj.ArrowSize = 50
        if not "Transparency" in pl:
            vobj.addProperty("App::PropertyPercent","Transparency","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The transparency of this object"))
            vobj.Transparency = 85
        if not "LineWidth" in pl:
            vobj.addProperty("App::PropertyFloat","LineWidth","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The line width of this object"))
            vobj.LineWidth = 1
        if not "CutDistance" in pl:
            vobj.addProperty("App::PropertyLength","CutDistance","SectionPlane",QT_TRANSLATE_NOOP("App::Property","Show the cut in the 3D view"))
        if not "LineColor" in pl:
            vobj.addProperty("App::PropertyColor","LineColor","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The color of this object"))
            vobj.LineColor = ArchCommands.getDefaultColor("Helpers")
        if not "CutView" in pl:
            vobj.addProperty("App::PropertyBool","CutView","SectionPlane",QT_TRANSLATE_NOOP("App::Property","Show the cut in the 3D view"))
        if not "CutMargin" in pl:
            vobj.addProperty("App::PropertyLength","CutMargin","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The distance between the cut plane and the actual view cut (keep this a very small value but not zero)"))
            vobj.CutMargin = 1
    def setProperties(self,vobj):

        pl = vobj.PropertiesList
        d = 0
        if "DisplaySize" in pl:
            d = vobj.DisplaySize.Value
            vobj.removeProperty("DisplaySize")
        if not "DisplayLength" in pl:
            vobj.addProperty("App::PropertyLength","DisplayLength","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The display length of this section plane"))
            if d:
                vobj.DisplayLength = d
            else:
                vobj.DisplayLength = 1000
        if not "DisplayHeight" in pl:
            vobj.addProperty("App::PropertyLength","DisplayHeight","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The display height of this section plane"))
            if d:
                vobj.DisplayHeight = d
            else:
                vobj.DisplayHeight = 1000
        if not "ArrowSize" in pl:
            vobj.addProperty("App::PropertyLength","ArrowSize","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The size of the arrows of this section plane"))
            vobj.ArrowSize = 50
        if not "Transparency" in pl:
            vobj.addProperty("App::PropertyPercent","Transparency","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The transparency of this object"))
            vobj.Transparency = 85
        if not "LineWidth" in pl:
            vobj.addProperty("App::PropertyFloat","LineWidth","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The line width of this object"))
            vobj.LineWidth = 1
        if not "CutDistance" in pl:
            vobj.addProperty("App::PropertyLength","CutDistance","SectionPlane",QT_TRANSLATE_NOOP("App::Property","Show the cut in the 3D view"))
        if not "LineColor" in pl:
            vobj.addProperty("App::PropertyColor","LineColor","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The color of this object"))
            vobj.LineColor = ArchCommands.getDefaultColor("Helpers")
        if not "CutView" in pl:
            vobj.addProperty("App::PropertyBool","CutView","SectionPlane",QT_TRANSLATE_NOOP("App::Property","Show the cut in the 3D view"))
        if not "CutMargin" in pl:
            vobj.addProperty("App::PropertyLength","CutMargin","SectionPlane",QT_TRANSLATE_NOOP("App::Property","The distance between the cut plane and the actual view cut (keep this a very small value but not zero)"))
            vobj.CutMargin = 1
Esempio n. 28
0
    def __init__(self,vobj):

        ArchComponent.ViewProviderComponent.__init__(self,vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Wall")
Esempio n. 29
0
    def __init__(self, vobj):

        ArchComponent.ViewProviderComponent.__init__(self, vobj)
        self.setProperties(vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Rebar")
Esempio n. 30
0
    def __init__(self,vobj):

        ArchComponent.ViewProviderComponent.__init__(self,vobj)
        self.setProperties(vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Structure")
Esempio n. 31
0
    def setProperties(self, vobj):

        ts = FreeCAD.ParamGet(
            "User parameter:BaseApp/Preferences/Mod/Draft").GetFloat(
                "textheight", 350)
        pl = vobj.PropertiesList
        if not "BubbleSize" in pl:
            vobj.addProperty(
                "App::PropertyLength", "BubbleSize", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The size of the axis bubbles"))
            vobj.BubbleSize = ts * 1.42
        if not "NumberingStyle" in pl:
            vobj.addProperty(
                "App::PropertyEnumeration", "NumberingStyle", "Axis",
                QT_TRANSLATE_NOOP("App::Property", "The numbering style"))
            vobj.NumberingStyle = [
                "1,2,3", "01,02,03", "001,002,003", "A,B,C", "a,b,c",
                "I,II,III", "L0,L1,L2"
            ]
            vobj.NumberingStyle = "1,2,3"
        if not "DrawStyle" in pl:
            vobj.addProperty(
                "App::PropertyEnumeration", "DrawStyle", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The type of line to draw this axis"))
            vobj.DrawStyle = ["Solid", "Dashed", "Dotted", "Dashdot"]
        vobj.DrawStyle = "Dashdot"
        if not "BubblePosition" in pl:
            vobj.addProperty(
                "App::PropertyEnumeration", "BubblePosition", "Axis",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Where to add bubbles to this axis: Start, end, both or none"
                ))
            vobj.BubblePosition = [
                "Start", "End", "Both", "None", "Arrow left", "Arrow right",
                "Bar left", "Bar right"
            ]
        if not "LineWidth" in pl:
            vobj.addProperty(
                "App::PropertyFloat", "LineWidth", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The line width to draw this axis"))
            vobj.LineWidth = 1
        if not "LineColor" in pl:
            vobj.addProperty(
                "App::PropertyColor", "LineColor", "Axis",
                QT_TRANSLATE_NOOP("App::Property", "The color of this axis"))
        vobj.LineColor = ArchCommands.getDefaultColor("Helpers")
        if not "StartNumber" in pl:
            vobj.addProperty(
                "App::PropertyInteger", "StartNumber", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The number of the first axis"))
            vobj.StartNumber = 1
        if not "FontName" in pl:
            vobj.addProperty(
                "App::PropertyFont", "FontName", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The font to use for texts"))
            vobj.FontName = Draft.getParam("textfont", "Arial,Sans")
        if not "FontSize" in pl:
            vobj.addProperty(
                "App::PropertyLength", "FontSize", "Axis",
                QT_TRANSLATE_NOOP("App::Property", "The font size"))
            vobj.FontSize = ts
        if not "ShowLabel" in pl:
            vobj.addProperty(
                "App::PropertyBool", "ShowLabel", "Axis",
                QT_TRANSLATE_NOOP("App::Property", "If true, show the labels"))
        if not "LabelOffset" in pl:
            vobj.addProperty(
                "App::PropertyPlacement", "LabelOffset", "Axis",
                QT_TRANSLATE_NOOP("App::Property",
                                  "A transformation to apply to each label"))
Esempio n. 32
0
    def __init__(self,vobj):

        ArchComponent.ViewProviderComponent.__init__(self,vobj)
        vobj.ShapeColor = ArchCommands.getDefaultColor("Wall")
Esempio n. 33
0
 def __init__(self,vobj):
     ArchComponent.ViewProviderComponent.__init__(self,vobj)
     vobj.addProperty("App::PropertyString","RebarShape","Arch",QT_TRANSLATE_NOOP("App::Property","Shape of rebar")).RebarShape
     vobj.ShapeColor = ArchCommands.getDefaultColor("Rebar")
     vobj.setEditorMode("RebarShape",2)