示例#1
0
 def GetResources(self):
     return {'Pixmap'  : 'Arch_SectionPlane',
             'Accel': "S, E",
             'MenuText': QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"),
             'ToolTip': QT_TRANSLATE_NOOP("Arch_SectionPlane","Creates a section plane object, including the selected objects")}
示例#2
0
    def setProperties(self,obj):
        """Gives the object properties unique to sites.

        Adds the IFC product properties, and sites' unique properties like
        Terrain.

        You can learn more about properties here:
        https://wiki.freecadweb.org/property
        """

        ArchIFC.IfcProduct.setProperties(self, obj)

        pl = obj.PropertiesList
        if not "Terrain" in pl:
            obj.addProperty("App::PropertyLink","Terrain","Site",QT_TRANSLATE_NOOP("App::Property","The base terrain of this site"))
        if not "Address" in pl:
            obj.addProperty("App::PropertyString","Address","Site",QT_TRANSLATE_NOOP("App::Property","The street and house number of this site, with postal box or apartment number if needed"))
        if not "PostalCode" in pl:
            obj.addProperty("App::PropertyString","PostalCode","Site",QT_TRANSLATE_NOOP("App::Property","The postal or zip code of this site"))
        if not "City" in pl:
            obj.addProperty("App::PropertyString","City","Site",QT_TRANSLATE_NOOP("App::Property","The city of this site"))
        if not "Region" in pl:
            obj.addProperty("App::PropertyString","Region","Site",QT_TRANSLATE_NOOP("App::Property","The region, province or county of this site"))
        if not "Country" in pl:
            obj.addProperty("App::PropertyString","Country","Site",QT_TRANSLATE_NOOP("App::Property","The country of this site"))
        if not "Latitude" in pl:
            obj.addProperty("App::PropertyFloat","Latitude","Site",QT_TRANSLATE_NOOP("App::Property","The latitude of this site"))
        if not "Longitude" in pl:
            obj.addProperty("App::PropertyFloat","Longitude","Site",QT_TRANSLATE_NOOP("App::Property","The latitude of this site"))
        if not "Declination" in pl:
            obj.addProperty("App::PropertyAngle","Declination","Site",QT_TRANSLATE_NOOP("App::Property","Angle between the true North and the North direction in this document"))
        if "NorthDeviation"in pl:
            obj.Declination = obj.NorthDeviation.Value
            obj.removeProperty("NorthDeviation")
        if not "Elevation" in pl:
            obj.addProperty("App::PropertyLength","Elevation","Site",QT_TRANSLATE_NOOP("App::Property","The elevation of level 0 of this site"))
        if not "Url" in pl:
            obj.addProperty("App::PropertyString","Url","Site",QT_TRANSLATE_NOOP("App::Property","A url that shows this site in a mapping website"))
        if not "Additions" in pl:
            obj.addProperty("App::PropertyLinkList","Additions","Site",QT_TRANSLATE_NOOP("App::Property","Other shapes that are appended to this object"))
        if not "Subtractions" in pl:
            obj.addProperty("App::PropertyLinkList","Subtractions","Site",QT_TRANSLATE_NOOP("App::Property","Other shapes that are subtracted from this object"))
        if not "ProjectedArea" in pl:
            obj.addProperty("App::PropertyArea","ProjectedArea","Site",QT_TRANSLATE_NOOP("App::Property","The area of the projection of this object onto the XY plane"))
        if not "Perimeter" in pl:
            obj.addProperty("App::PropertyLength","Perimeter","Site",QT_TRANSLATE_NOOP("App::Property","The perimeter length of this terrain"))
        if not "AdditionVolume" in pl:
            obj.addProperty("App::PropertyVolume","AdditionVolume","Site",QT_TRANSLATE_NOOP("App::Property","The volume of earth to be added to this terrain"))
        if not "SubtractionVolume" in pl:
            obj.addProperty("App::PropertyVolume","SubtractionVolume","Site",QT_TRANSLATE_NOOP("App::Property","The volume of earth to be removed from this terrain"))
        if not "ExtrusionVector" in pl:
            obj.addProperty("App::PropertyVector","ExtrusionVector","Site",QT_TRANSLATE_NOOP("App::Property","An extrusion vector to use when performing boolean operations"))
            obj.ExtrusionVector = FreeCAD.Vector(0,0,-100000)
        if not "RemoveSplitter" in pl:
            obj.addProperty("App::PropertyBool","RemoveSplitter","Site",QT_TRANSLATE_NOOP("App::Property","Remove splitters from the resulting shape"))
        if not "OriginOffset" in pl:
            obj.addProperty("App::PropertyVector","OriginOffset","Site",QT_TRANSLATE_NOOP("App::Property","An optional offset between the model (0,0,0) origin and the point indicated by the geocoordinates"))
        if not hasattr(obj,"Group"):
            obj.addExtension("App::GroupExtensionPython")
        if not "IfcType" in pl:
            obj.addProperty("App::PropertyEnumeration","IfcType","IFC",QT_TRANSLATE_NOOP("App::Property","The type of this object"))
            obj.IfcType = ArchIFC.IfcTypes
            obj.IcfType = "Site"
        if not "TimeZone" in pl:
            obj.addProperty("App::PropertyInteger","TimeZone","Site",QT_TRANSLATE_NOOP("App::Property","The time zone where this site is located"))
        if not "EPWFile" in pl:
            obj.addProperty("App::PropertyFileIncluded","EPWFile","Site",QT_TRANSLATE_NOOP("App::Property","An optional EPW File for the location of this site. Refer to the Site documentation to know how to obtain one"))
        self.Type = "Site"
示例#3
0
    def Initialize(self):
        """When the workbench is first loaded."""
        def QT_TRANSLATE_NOOP(context, text):
            return text

        import Draft_rc
        import DraftTools
        import DraftGui
        from draftguitools import gui_circulararray
        from draftguitools import gui_polararray
        from draftguitools import gui_orthoarray
        from draftguitools import gui_arrays
        import Arch_rc
        import Arch

        # Set up command lists
        self.archtools = [
            "Arch_Wall", "Arch_Structure", "Arch_Rebar", "Arch_CurtainWall",
            "Arch_BuildingPart", "Arch_Project", "Arch_Site", "Arch_Building",
            "Arch_Floor", "Arch_Reference", "Arch_Window", "Arch_Roof",
            "Arch_AxisTools", "Arch_SectionPlane", "Arch_Space", "Arch_Stairs",
            "Arch_PanelTools", "Arch_Equipment", "Arch_Frame", "Arch_Fence",
            "Arch_Truss", "Arch_Profile", "Arch_MaterialTools",
            "Arch_Schedule", "Arch_PipeTools", "Arch_CutPlane", "Arch_CutLine",
            "Arch_Add", "Arch_Remove", "Arch_Survey"
        ]
        self.utilities = [
            "Arch_Component", "Arch_CloneComponent", "Arch_SplitMesh",
            "Arch_MeshToShape", "Arch_SelectNonSolidMeshes",
            "Arch_RemoveShape", "Arch_CloseHoles", "Arch_MergeWalls",
            "Arch_Check", "Arch_ToggleIfcBrepFlag", "Arch_3Views",
            "Arch_IfcSpreadsheet", "Arch_ToggleSubs"
        ]

        # Add the rebar tools from the Reinforcement addon, if available
        try:
            import RebarTools
        except Exception:
            pass
        else:

            class RebarGroupCommand:
                def GetCommands(self):
                    return tuple(RebarTools.RebarCommands + ["Arch_Rebar"])

                def GetResources(self):
                    _tooltip = ("Create various types of rebars, "
                                "including U-shaped, L-shaped, and stirrup")
                    return {
                        'MenuText': QT_TRANSLATE_NOOP("Arch", 'Rebar tools'),
                        'ToolTip': QT_TRANSLATE_NOOP("Arch", _tooltip)
                    }

                def IsActive(self):
                    return not FreeCAD.ActiveDocument is None

            FreeCADGui.addCommand('Arch_RebarTools', RebarGroupCommand())
            self.archtools[2] = "Arch_RebarTools"

        # Set up Draft command lists
        import draftutils.init_tools as it
        self.draft_drawing_commands = it.get_draft_drawing_commands()
        self.draft_annotation_commands = it.get_draft_annotation_commands()
        self.draft_modification_commands = it.get_draft_modification_commands()
        self.draft_context_commands = it.get_draft_context_commands()
        self.draft_line_commands = it.get_draft_line_commands()
        self.draft_utility_commands = it.get_draft_utility_commands()

        # Set up toolbars
        self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "Arch tools"),
                           self.archtools)
        self.appendToolbar(QT_TRANSLATE_NOOP("Draft", "Draft creation tools"),
                           self.draft_drawing_commands)
        self.appendToolbar(
            QT_TRANSLATE_NOOP("Draft", "Draft annotation tools"),
            self.draft_annotation_commands)
        self.appendToolbar(
            QT_TRANSLATE_NOOP("Draft", "Draft modification tools"),
            self.draft_modification_commands)

        # Set up menus
        self.appendMenu([
            QT_TRANSLATE_NOOP("arch", "&Arch"),
            QT_TRANSLATE_NOOP("arch", "Utilities")
        ], self.utilities)
        self.appendMenu(QT_TRANSLATE_NOOP("arch", "&Arch"), self.archtools)

        self.appendMenu([
            QT_TRANSLATE_NOOP("arch", "&Draft"),
            QT_TRANSLATE_NOOP("arch", "Creation")
        ], self.draft_drawing_commands)
        self.appendMenu([
            QT_TRANSLATE_NOOP("arch", "&Draft"),
            QT_TRANSLATE_NOOP("arch", "Annotation")
        ], self.draft_annotation_commands)
        self.appendMenu([
            QT_TRANSLATE_NOOP("arch", "&Draft"),
            QT_TRANSLATE_NOOP("arch", "Modification")
        ], self.draft_modification_commands)
        self.appendMenu([
            QT_TRANSLATE_NOOP("arch", "&Draft"),
            QT_TRANSLATE_NOOP("arch", "Utilities")
        ], self.draft_utility_commands + self.draft_context_commands)
        FreeCADGui.addIconPath(":/icons")
        FreeCADGui.addLanguagePath(":/translations")

        # Set up preferences pages
        if hasattr(FreeCADGui, "draftToolBar"):
            if not hasattr(FreeCADGui.draftToolBar, "loadedArchPreferences"):
                FreeCADGui.addPreferencePage(":/ui/preferences-arch.ui",
                                             QT_TRANSLATE_NOOP("Arch", "Arch"))
                FreeCADGui.addPreferencePage(
                    ":/ui/preferences-archdefaults.ui",
                    QT_TRANSLATE_NOOP("Arch", "Arch"))
                FreeCADGui.draftToolBar.loadedArchPreferences = True
            if not hasattr(FreeCADGui.draftToolBar, "loadedPreferences"):
                FreeCADGui.addPreferencePage(
                    ":/ui/preferences-draft.ui",
                    QT_TRANSLATE_NOOP("Draft", "Draft"))
                FreeCADGui.addPreferencePage(
                    ":/ui/preferences-draftsnap.ui",
                    QT_TRANSLATE_NOOP("Draft", "Draft"))
                FreeCADGui.addPreferencePage(
                    ":/ui/preferences-draftvisual.ui",
                    QT_TRANSLATE_NOOP("Draft", "Draft"))
                FreeCADGui.addPreferencePage(
                    ":/ui/preferences-drafttexts.ui",
                    QT_TRANSLATE_NOOP("Draft", "Draft"))
                FreeCADGui.draftToolBar.loadedPreferences = True

        FreeCAD.Console.PrintLog('Loading Arch workbench, done.\n')
示例#4
0
    def setProperties(self,obj):

        pl = obj.PropertiesList
        if not "Radius" in pl:
            obj.addProperty("App::PropertyLength",      "Radius",        "PipeConnector", QT_TRANSLATE_NOOP("App::Property","The curvature radius of this connector"))
        if not "Pipes" in pl:
            obj.addProperty("App::PropertyLinkList",    "Pipes",         "PipeConnector", QT_TRANSLATE_NOOP("App::Property","The pipes linked by this connector"))
        if not "ConnectorType" in pl:
            obj.addProperty("App::PropertyEnumeration", "ConnectorType", "PipeConnector", QT_TRANSLATE_NOOP("App::Property","The type of this connector"))
            obj.ConnectorType = ["Corner","Tee"]
            obj.setEditorMode("ConnectorType",1)
        self.Type = "PipeConnector"
示例#5
0
    def setProperties(self, obj):

        pl = obj.PropertiesList
        if not "Diameter" in pl:
            obj.addProperty(
                "App::PropertyLength", "Diameter", "Rebar",
                QT_TRANSLATE_NOOP("App::Property", "The diameter of the bar"))
        if not "OffsetStart" in pl:
            obj.addProperty(
                "App::PropertyLength", "OffsetStart", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The distance between the border of the beam and the first bar (concrete cover)."
                ))
        if not "OffsetEnd" in pl:
            obj.addProperty(
                "App::PropertyLength", "OffsetEnd", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The distance between the border of the beam and the last bar (concrete cover)."
                ))
        if not "Amount" in pl:
            obj.addProperty(
                "App::PropertyInteger", "Amount", "Rebar",
                QT_TRANSLATE_NOOP("App::Property", "The amount of bars"))
        if not "Spacing" in pl:
            obj.addProperty(
                "App::PropertyLength", "Spacing", "Rebar",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The spacing between the bars"))
            obj.setEditorMode("Spacing", 1)
        if not "Distance" in pl:
            obj.addProperty(
                "App::PropertyLength", "Distance", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The total distance to span the rebars over. Keep 0 to automatically use the host shape size."
                ))
        if not "Direction" in pl:
            obj.addProperty(
                "App::PropertyVector", "Direction", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The direction to use to spread the bars. Keep (0,0,0) for automatic direction."
                ))
        if not "Rounding" in pl:
            obj.addProperty(
                "App::PropertyFloat", "Rounding", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The fillet to apply to the angle of the base profile. This value is multiplied by the bar diameter."
                ))
        if not "PlacementList" in pl:
            obj.addProperty(
                "App::PropertyPlacementList", "PlacementList", "Rebar",
                QT_TRANSLATE_NOOP("App::Property",
                                  "List of placement of all the bars"))
        if not "Host" in pl:
            obj.addProperty(
                "App::PropertyLink", "Host", "Rebar",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The structure object that hosts this rebar"))
        if not "CustomSpacing" in pl:
            obj.addProperty(
                "App::PropertyString", "CustomSpacing", "Rebar",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The custom spacing of rebar"))
        if not "Length" in pl:
            obj.addProperty(
                "App::PropertyDistance", "Length", "Rebar",
                QT_TRANSLATE_NOOP("App::Property", "Length of a single rebar"))
            obj.setEditorMode("Length", 1)
        if not "TotalLength" in pl:
            obj.addProperty(
                "App::PropertyDistance", "TotalLength", "Rebar",
                QT_TRANSLATE_NOOP("App::Property",
                                  "Total length of all rebars"))
            obj.setEditorMode("TotalLength", 1)
        self.Type = "Rebar"
示例#6
0
 def GetResources(self):
     """Set icon, menu and tooltip."""
     return {'Pixmap': 'Draft_AddToGroup',
             'MenuText': QT_TRANSLATE_NOOP("Draft_AddToGroup","Move to group")+"...",
             'ToolTip': QT_TRANSLATE_NOOP("Draft_AddToGroup","Moves the selected objects to an existing group, or removes them from any group.\nCreate a group first to use this tool.")}
示例#7
0
    def GetResources(self):

        return {'Pixmap'  : 'Arch_Pipe',
                'MenuText': QT_TRANSLATE_NOOP("Arch_Pipe","Pipe"),
                'Accel': "P, I",
                'ToolTip': QT_TRANSLATE_NOOP("Arch_Pipe","Creates a pipe object from a given Wire or Line")}
示例#8
0
    def setProperties(self, obj):

        pl = obj.PropertiesList
        if not "Boundaries" in pl:
            obj.addProperty(
                "App::PropertyLinkSubList", "Boundaries", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The objects that make the boundaries of this space object"
                ))
        if not "Area" in pl:
            obj.addProperty(
                "App::PropertyArea", "Area", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The computed floor area of this space"))
        if not "FinishFloor" in pl:
            obj.addProperty(
                "App::PropertyString", "FinishFloor", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The finishing of the floor of this space"))
        if not "FinishWalls" in pl:
            obj.addProperty(
                "App::PropertyString", "FinishWalls", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The finishing of the walls of this space"))
        if not "FinishCeiling" in pl:
            obj.addProperty(
                "App::PropertyString", "FinishCeiling", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The finishing of the ceiling of this space"))
        if not "Group" in pl:
            obj.addProperty(
                "App::PropertyLinkList", "Group", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Objects that are included inside this space, such as furniture"
                ))
        if not "SpaceType" in pl:
            obj.addProperty(
                "App::PropertyEnumeration", "SpaceType", "Space",
                QT_TRANSLATE_NOOP("App::Property", "The type of this space"))
            obj.SpaceType = SpaceTypes
        if not "FloorThickness" in pl:
            obj.addProperty(
                "App::PropertyLength", "FloorThickness", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The thickness of the floor finish"))
        if not "Zone" in pl:
            obj.addProperty(
                "App::PropertyLink", "Zone", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "A zone this space is part of"))
        if not "NumberOfPeople" in pl:
            obj.addProperty(
                "App::PropertyInteger", "NumberOfPeople", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The number of people who typically occupy this space"))
        if not "LightingPower" in pl:
            obj.addProperty(
                "App::PropertyFloat", "LightingPower", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The electric power needed to light this space in Watts"))
        if not "EquipmentPower" in pl:
            obj.addProperty(
                "App::PropertyFloat", "EquipmentPower", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The electric power needed by the equipment of this space in Watts"
                ))
        if not "AutoPower" in pl:
            obj.addProperty(
                "App::PropertyBool", "AutoPower", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "If True, Equipment Power will be automatically filled by the equipment included in this space"
                ))
        if not "Conditioning" in pl:
            obj.addProperty(
                "App::PropertyEnumeration", "Conditioning", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The type of air conditioning of this space"))
            obj.Conditioning = ConditioningTypes
        if not "Internal" in pl:
            obj.addProperty(
                "App::PropertyBool", "Internal", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Specifies if this space is internal or external"))
            obj.Internal = True
        self.Type = "Space"
        obj.setEditorMode("HorizontalArea", 2)
示例#9
0
    def setProperties(self, vobj):

        pl = vobj.PropertiesList
        if not "Text" in pl:
            vobj.addProperty(
                "App::PropertyStringList", "Text", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The text to show. Use $area, $label, $tag, $floor, $walls, $ceiling to insert the respective data"
                ))
            vobj.Text = ["$label", "$area"]
        if not "FontName" in pl:
            vobj.addProperty(
                "App::PropertyFont", "FontName", "Space",
                QT_TRANSLATE_NOOP("App::Property", "The name of the font"))
            vobj.FontName = Draft.getParam("textfont", "")
        if not "TextColor" in pl:
            vobj.addProperty(
                "App::PropertyColor", "TextColor", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The color of the area text"))
            vobj.TextColor = (0.0, 0.0, 0.0, 1.0)
        if not "FontSize" in pl:
            vobj.addProperty(
                "App::PropertyLength", "FontSize", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The size of the text font"))
            vobj.FontSize = Draft.getParam("textheight", 10)
        if not "FirstLine" in pl:
            vobj.addProperty(
                "App::PropertyLength", "FirstLine", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The size of the first line of text"))
            vobj.FirstLine = Draft.getParam("textheight", 10)
        if not "LineSpacing" in pl:
            vobj.addProperty(
                "App::PropertyFloat", "LineSpacing", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The space between the lines of text"))
            vobj.LineSpacing = 1.0
        if not "TextPosition" in pl:
            vobj.addProperty(
                "App::PropertyVectorDistance", "TextPosition", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The position of the text. Leave (0,0,0) for automatic position"
                ))
        if not "TextAlign" in pl:
            vobj.addProperty(
                "App::PropertyEnumeration", "TextAlign", "Space",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The justification of the text"))
            vobj.TextAlign = ["Left", "Center", "Right"]
        if not "Decimals" in pl:
            vobj.addProperty(
                "App::PropertyInteger", "Decimals", "Space",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The number of decimals to use for calculated texts"))
            vobj.Decimals = Draft.getParam("dimPrecision", 2)
        if not "ShowUnit" in pl:
            vobj.addProperty(
                "App::PropertyBool", "ShowUnit", "Space",
                QT_TRANSLATE_NOOP("App::Property", "Show the unit suffix"))
            vobj.ShowUnit = Draft.getParam("showUnit", True)
示例#10
0
    def setProperties(self, vobj):

        pl = vobj.PropertiesList
        if not "LineWidth" in pl:
            vobj.addProperty(
                "App::PropertyFloat", "LineWidth", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The line width of this object"))
            vobj.LineWidth = 1
        if not "OverrideUnit" in pl:
            vobj.addProperty(
                "App::PropertyString", "OverrideUnit", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property",
                                  "An optional unit to express levels"))
        if not "DisplayOffset" in pl:
            vobj.addProperty(
                "App::PropertyPlacement", "DisplayOffset", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "A transformation to apply to the level mark"))
        if not "ShowLevel" in pl:
            vobj.addProperty(
                "App::PropertyBool", "ShowLevel", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property", "If true, show the level"))
            vobj.ShowLevel = True
        if not "ShowUnit" in pl:
            vobj.addProperty(
                "App::PropertyBool", "ShowUnit", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property",
                                  "If true, show the unit on the level tag"))
        if not "SetWorkingPlane" in pl:
            vobj.addProperty(
                "App::PropertyBool", "SetWorkingPlane", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "If true, when activated, the working plane will automatically adapt to this level"
                ))
            vobj.SetWorkingPlane = True
        if not "OriginOffset" in pl:
            vobj.addProperty(
                "App::PropertyBool", "OriginOffset", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "If true, when activated, Display offset will affect the origin mark too"
                ))
        if not "ShowLabel" in pl:
            vobj.addProperty(
                "App::PropertyBool", "ShowLabel", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "If true, when activated, the object's label is displayed")
            )
            vobj.ShowLabel = True
        if not "FontName" in pl:
            vobj.addProperty(
                "App::PropertyFont", "FontName", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The font to be used for texts"))
            vobj.FontName = Draft.getParam("textfont", "Arial")
        if not "FontSize" in pl:
            vobj.addProperty(
                "App::PropertyLength", "FontSize", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property", "The font size of texts"))
            vobj.FontSize = Draft.getParam("textheight", 2.0)
        if not "ViewData" in pl:
            vobj.addProperty(
                "App::PropertyFloatList", "ViewData", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Camera position data associated with this object"))
        if not "RestoreView" in pl:
            vobj.addProperty(
                "App::PropertyBool", "RestoreView", "BuildingPart",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "If set, the view stored in this object will be restored on double-click"
                ))
        if not "DiffuseColor" in pl:
            vobj.addProperty(
                "App::PropertyColorList", "DiffuseColor", "BuildingPart",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The individual face colors"))
示例#11
0
 def GetResources(self):
     return {'Pixmap'  : 'Arch_Frame',
             'MenuText': QT_TRANSLATE_NOOP("Arch_Frame","Frame"),
             'Accel': "F, R",
             'ToolTip': QT_TRANSLATE_NOOP("Arch_Frame","Creates a frame object from a planar 2D object and a profile")}
示例#12
0
    def __init__(self, obj):
        super(ReinforcementCustom, self).__init__(obj)
        self.Type = "ReinforcementCustom"

        pl = obj.PropertiesList

        # New properties

        # direction
        # is not only direction but startpoint too
        # TODO might be later given by a straight edge
        if "Direction" not in pl:
            obj.addProperty(
                "App::PropertyVector", "Direction", "Reinforcement",
                QT_TRANSLATE_NOOP("App::Property",
                                  ("The direction to use to spread the bars. "
                                   "Keep (0,0,0) for automatic direction.")))
        obj.Direction = FreeCAD.Vector(0, 0, 1)

        # length of the rebar distrbution
        # later if we use a edge too, 0 indicates the use of the edge length
        if "Distance" not in pl:
            obj.addProperty(
                "App::PropertyLength",
                "Distance",
                "Reinforcement",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    (
                        "The total distance to span the rebars over. "
                        # "Keep 0 to automatically use the host shape size."
                    )))
        obj.Distance = 400
        obj.setEditorMode("Amount", 1)

        # concrete cover start
        if "OffsetStart" not in pl:
            obj.addProperty(
                "App::PropertyLength",
                "OffsetStart",
                "ArrayOfRebars",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    ("The distance between the start of the "
                     "reinforcement and the first bar (concrete cover).")),
            )
        obj.OffsetStart = 0

        # concrete cover end
        if "OffsetEnd" not in pl:
            obj.addProperty(
                "App::PropertyLength",
                "OffsetEnd",
                "ArrayOfRebars",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    ("The distance between the end of the "
                     "reinforcement and the last bar (concrete cover).")),
            )
        obj.OffsetEnd = 0

        # custom spacing
        if "CustomSpacing" not in pl:
            obj.addProperty(
                "App::PropertyString", "CustomSpacing", "ArrayOfRebars",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The custom spacing of rebars."))
示例#13
0
class Camera(PointableFeatureMixin, FeatureBase):
    """A camera for rendering.

    This object allows to record camera settings from the Coin camera, and to
    reuse them for rendering.

    Camera Orientation is defined by a Rotation Axis and a Rotation Angle,
    applied to 'default camera'.
    Default camera looks from (0,0,1) towards the origin (target is (0,0,-1),
    and the up direction is (0,1,0).

    For more information, see Coin documentation, Camera section.
    <https://developer.openinventor.com/UserGuides/Oiv9/Inventor_Mentor/Cameras_and_Lights/Cameras.html>
    """

    VIEWPROVIDER = "ViewProviderCamera"

    PROPERTIES = {
        "Projection":
        Prop(
            "App::PropertyEnumeration",
            "Camera",
            QT_TRANSLATE_NOOP("Render",
                              "Type of projection: Perspective/Orthographic"),
            ("Perspective", "Orthographic"),
        ),
        "ViewportMapping":
        Prop(
            "App::PropertyEnumeration",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "(See Coin documentation)"),
            VIEWPORTMAPPINGENUM,
        ),
        "AspectRatio":
        Prop(
            "App::PropertyFloat",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "Ratio width/height of the camera."),
            1.0,
        ),
        "NearDistance":
        Prop(
            "App::PropertyDistance",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "Near distance, for clipping"),
            0.0,
        ),
        "FarDistance":
        Prop(
            "App::PropertyDistance",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "Far distance, for clipping"),
            200.0,
        ),
        "FocalDistance":
        Prop(
            "App::PropertyDistance",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "Focal distance"),
            100.0,
        ),
        "Height":
        Prop(
            "App::PropertyLength",
            "Camera",
            QT_TRANSLATE_NOOP("Render", "Height, for orthographic camera"),
            5.0,
        ),
        "HeightAngle":
        Prop(
            "App::PropertyAngle",
            "Camera",
            QT_TRANSLATE_NOOP(
                "Render",
                "Height angle, for perspective camera, in "
                "degrees. Important: This value will be sent as "
                "'Field of View' to the renderers.",
            ),
            60,
        ),
    }

    def on_create_cb(self, fpo, viewp, **kwargs):
        """Complete 'create' (callback)."""
        if App.GuiUp:
            viewp.set_camera_from_gui()
        else:
            set_cam_from_coin_string(fpo, DEFAULT_CAMERA_STRING)
示例#14
0
class ViewProviderCamera(CoinShapeViewProviderMixin,
                         PointableViewProviderMixin, ViewProviderBase):
    """View Provider of Camera class."""

    ICON = ":/icons/camera-photo.svg"
    CONTEXT_MENU = [
        CtxMenuItem(
            QT_TRANSLATE_NOOP("Render", "Set GUI to this camera"),
            "set_gui_from_camera",
        ),
        CtxMenuItem(
            QT_TRANSLATE_NOOP("Render", "Set this camera to GUI"),
            "set_camera_from_gui",
        ),
    ]
    SIZE = 5
    HEIGHT = 10
    COIN_SHAPE_POINTS = (
        (-SIZE * 2, +SIZE, 0),  # Front rectangle
        (+SIZE * 2, +SIZE, 0),  # Front rectangle
        (+SIZE * 2, -SIZE, 0),  # Front rectangle
        (-SIZE * 2, -SIZE, 0),  # Front rectangle
        (-SIZE * 2, +SIZE, 0),  # Front rectangle
        (-SIZE * 2, +SIZE, 0),  # Left triangle
        (0, 0, HEIGHT * 2),  # Left triangle
        (-SIZE * 2, -SIZE, 0),  # Left triangle
        (+SIZE * 2, +SIZE, 0),  # Right triangle
        (0, 0, HEIGHT * 2),  # Right triangle
        (+SIZE * 2, -SIZE, 0),  # Right triangle
        (-SIZE * 1.8, 1.2 * +SIZE, 0),  # Up triangle (arrow)
        (0, 1.4 * +SIZE, 0),  # Up triangle (arrow)
        (+SIZE * 1.8, 1.2 * +SIZE, 0),  # Up triangle (arrow)
        (-SIZE * 1.8, 1.2 * +SIZE, 0),  # Up triangle (arrow)
    )
    COIN_SHAPE_VERTICES = [5, 3, 3, 4]
    COIN_SHAPE_WIREFRAME = True

    def set_camera_from_gui(self):
        """Set this camera from GUI camera."""
        assert App.GuiUp, "Cannot set camera from GUI: GUI is down"
        fpo = self.fpo
        node = Gui.ActiveDocument.ActiveView.getCameraNode()
        typ = node.getTypeId()
        if typ == coin.SoPerspectiveCamera.getClassTypeId():
            fpo.Projection = "Perspective"
            fpo.HeightAngle = degrees(float(node.heightAngle.getValue()))
        elif typ == coin.SoOrthographicCamera.getClassTypeId():
            fpo.Projection = "Orthographic"
            fpo.Height = float(node.height.getValue())
        else:
            raise ValueError("Unknown camera type")

        pos = App.Vector(node.position.getValue())
        rot = App.Rotation(*node.orientation.getValue().getValue())
        fpo.Placement = App.Placement(pos, rot)

        fpo.NearDistance = float(node.nearDistance.getValue())
        fpo.FarDistance = float(node.farDistance.getValue())
        fpo.FocalDistance = float(node.focalDistance.getValue())
        fpo.AspectRatio = float(node.aspectRatio.getValue())
        index = node.viewportMapping.getValue()
        fpo.ViewportMapping = VIEWPORTMAPPINGENUM[index]

    def set_gui_from_camera(self):
        """Set GUI camera to this camera."""
        assert App.GuiUp, "Cannot set GUI from camera: GUI is down"

        fpo = self.fpo

        Gui.ActiveDocument.ActiveView.setCameraType(fpo.Projection)

        node = Gui.ActiveDocument.ActiveView.getCameraNode()

        node.position.setValue(fpo.Placement.Base)
        rot = fpo.Placement.Rotation
        axis = coin.SbVec3f(rot.Axis.x, rot.Axis.y, rot.Axis.z)
        node.orientation.setValue(axis, rot.Angle)

        node.nearDistance.setValue(float(fpo.NearDistance))
        node.farDistance.setValue(float(fpo.FarDistance))
        node.focalDistance.setValue(float(fpo.FocalDistance))
        node.aspectRatio.setValue(float(fpo.AspectRatio))
        node.viewportMapping.setValue(getattr(node, fpo.ViewportMapping))

        if fpo.Projection == "Orthographic":
            node.height.setValue(float(fpo.Height))
        elif fpo.Projection == "Perspective":
            node.heightAngle.setValue(radians(float(fpo.HeightAngle)))
示例#15
0
 def GetResources(self):
     """Set icon, menu and tooltip."""
     return {'Pixmap': 'Draft_AddNamedGroup',
             'MenuText': QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "Add a new named group"),
             'ToolTip': QT_TRANSLATE_NOOP("Draft_AddNamedGroup", "Add a new group with a given name.")}
示例#16
0
 def GetResources(self):
     return {'Pixmap'  : 'Arch_Panel',
             'MenuText': QT_TRANSLATE_NOOP("Arch_Panel","Panel"),
             'Accel': "P, A",
             'ToolTip': QT_TRANSLATE_NOOP("Arch_Panel","Creates a panel object from scratch or from a selected object (sketch, wire, face or solid)")}
示例#17
0
 def __init__(self):
     super(AddToGroup, self).__init__(name=translate("draft","Add to group"))
     self.ungroup = QT_TRANSLATE_NOOP("Draft_AddToGroup","Ungroup")
     #add new group string option
     self.addNewGroupStr = "+ " + translate("draft", "Add new group")
示例#18
0
    def __init__(self):
        self.name = "Circular array"
        _log(
            translate("draft", "Task panel:") +
            " {}".format(translate("draft", "Circular array")))

        # The .ui file must be loaded into an attribute
        # called `self.form` so that it is displayed in the task panel.
        ui_file = ":/ui/TaskPanel_CircularArray.ui"
        self.form = Gui.PySideUic.loadUi(ui_file)

        icon_name = "Draft_CircularArray"
        svg = ":/icons/" + icon_name
        pix = QtGui.QPixmap(svg)
        icon = QtGui.QIcon.fromTheme(icon_name, QtGui.QIcon(svg))
        self.form.setWindowIcon(icon)
        self.form.setWindowTitle(translate("draft", "Circular array"))

        self.form.label_icon.setPixmap(pix.scaled(32, 32))

        # -------------------------------------------------------------------
        # Default values for the internal function,
        # and for the task panel interface
        start_distance = U.Quantity(50.0, App.Units.Length)
        length_unit = start_distance.getUserPreferred()[2]

        self.r_distance = 2 * start_distance.Value
        self.tan_distance = start_distance.Value

        self.form.spinbox_r_distance.setProperty('rawValue', self.r_distance)
        self.form.spinbox_r_distance.setProperty('unit', length_unit)
        self.form.spinbox_tan_distance.setProperty('rawValue',
                                                   self.tan_distance)
        self.form.spinbox_tan_distance.setProperty('unit', length_unit)

        self.number = 3
        self.symmetry = 1

        self.form.spinbox_number.setValue(self.number)
        self.form.spinbox_symmetry.setValue(self.symmetry)

        # TODO: the axis is currently fixed, it should be editable
        # or selectable from the task panel
        self.axis = App.Vector(0, 0, 1)

        start_point = U.Quantity(0.0, App.Units.Length)
        length_unit = start_point.getUserPreferred()[2]

        self.center = App.Vector(start_point.Value, start_point.Value,
                                 start_point.Value)

        self.form.input_c_x.setProperty('rawValue', self.center.x)
        self.form.input_c_x.setProperty('unit', length_unit)
        self.form.input_c_y.setProperty('rawValue', self.center.y)
        self.form.input_c_y.setProperty('unit', length_unit)
        self.form.input_c_z.setProperty('rawValue', self.center.z)
        self.form.input_c_z.setProperty('unit', length_unit)

        self.fuse = utils.get_param("Draft_array_fuse", False)
        self.use_link = utils.get_param("Draft_array_Link", True)

        self.form.checkbox_fuse.setChecked(self.fuse)
        self.form.checkbox_link.setChecked(self.use_link)
        # -------------------------------------------------------------------

        # Some objects need to be selected before we can execute the function.
        self.selection = None

        # This is used to test the input of the internal function.
        # It should be changed to True before we can execute the function.
        self.valid_input = False

        self.set_widget_callbacks()

        self.tr_true = QT_TRANSLATE_NOOP("Draft", "True")
        self.tr_false = QT_TRANSLATE_NOOP("Draft", "False")

        # The mask is not used at the moment, but could be used in the future
        # by a callback to restrict the coordinates of the pointer.
        self.mask = ""
示例#19
0
    def __init__(self, obj):
        lead_styles = [
            QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Arc"),
            QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Tangent"),
            QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Perpendicular"),
        ]
        self.obj = obj
        obj.addProperty(
            "App::PropertyLink",
            "Base",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "The base path to modify"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "LeadIn",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Calculate roll-on to path"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "LeadOut",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Calculate roll-off from path"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "KeepToolDown",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Keep the Tool Down in Path"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "UseMachineCRC",
            "Path",
            QT_TRANSLATE_NOOP(
                "App::Property",
                "Use Machine Cutter Radius Compensation /Tool Path Offset G41/G42",
            ),
        )
        obj.addProperty(
            "App::PropertyDistance",
            "Length",
            "Path",
            QT_TRANSLATE_NOOP("App::Property",
                              "Length or Radius of the approach"),
        )
        obj.addProperty(
            "App::PropertyEnumeration",
            "StyleOn",
            "Path",
            QT_TRANSLATE_NOOP("App::Property",
                              "The Style of motion into the Path"),
        )
        obj.StyleOn = lead_styles
        obj.addProperty(
            "App::PropertyEnumeration",
            "StyleOff",
            "Path",
            QT_TRANSLATE_NOOP("App::Property",
                              "The Style of motion out of the Path"),
        )
        obj.StyleOff = lead_styles
        obj.addProperty(
            "App::PropertyEnumeration",
            "RadiusCenter",
            "Path",
            QT_TRANSLATE_NOOP("App::Property",
                              "The Mode of Point Radiusoffset or Center"),
        )
        obj.RadiusCenter = [
            QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Radius"),
            QT_TRANSLATE_NOOP("Path_DressupLeadInOut", "Center"),
        ]
        obj.Proxy = self
        obj.addProperty(
            "App::PropertyDistance",
            "ExtendLeadIn",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Extends LeadIn distance"),
        )
        obj.addProperty(
            "App::PropertyDistance",
            "ExtendLeadOut",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Extends LeadOut distance"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "RapidPlunge",
            "Path",
            QT_TRANSLATE_NOOP("App::Property", "Perform plunges with G0"),
        )
        obj.addProperty(
            "App::PropertyBool",
            "IncludeLayers",
            "Path",
            QT_TRANSLATE_NOOP("App::Property",
                              "Apply LeadInOut to layers within an operation"),
        )

        self.wire = None
        self.rapids = None
示例#20
0
                        hasFace = True
                        break

        if hasFace:
            self.form.processCircles.show()
            self.form.processHoles.show()
            self.form.processPerimeter.show()
        else:
            self.form.processCircles.hide()
            self.form.processHoles.hide()
            self.form.processPerimeter.hide()

    def registerSignalHandlers(self, obj):
        self.form.useCompensation.stateChanged.connect(self.updateVisibility)


# Eclass

Command = PathOpGui.SetupOperation(
    "Profile",
    PathProfile.Create,
    TaskPanelOpPage,
    "Path_Contour",
    QT_TRANSLATE_NOOP("Path", "Profile"),
    QT_TRANSLATE_NOOP(
        "Path", "Profile entire model, selected face(s) or selected edge(s)"),
    PathProfile.SetupProperties,
)

FreeCAD.Console.PrintLog("Loading PathProfileFacesGui... done\n")
示例#21
0
    def GetResources(self):

        return {'Pixmap'  : 'Arch_PipeConnector',
                'MenuText': QT_TRANSLATE_NOOP("Arch_PipeConnector","Connector"),
                'Accel': "P, C",
                'ToolTip': QT_TRANSLATE_NOOP("Arch_Pipe","Creates a connector between 2 or 3 selected pipes")}
示例#22
0
 def __init__(self,obj):
     ArchFloor._Floor.__init__(self,obj)
     obj.addProperty("App::PropertyEnumeration","BuildingType","Arch",QT_TRANSLATE_NOOP("App::Property","The type of this building"))
     self.Type = "Building"
     obj.setEditorMode('Height',2)
     obj.BuildingType = BuildingTypes
示例#23
0
 def GetResources(self):
     return { 'MenuText': QT_TRANSLATE_NOOP("Arch_PipeTools",'Pipe tools'),
              'ToolTip': QT_TRANSLATE_NOOP("Arch_PipeTools",'Pipe tools')
            }
示例#24
0
 def GetResources(self):
     """Set icon, menu and tooltip."""
     return {'Pixmap': 'Draft_SelectGroup',
             'MenuText': QT_TRANSLATE_NOOP("Draft_SelectGroup", "Select group"),
             'ToolTip': QT_TRANSLATE_NOOP("Draft_SelectGroup", "Selects the contents of selected groups. For selected non-group objects, the contents of the group they are in is selected.")}
示例#25
0
    def GetResources(self):

        return {'Pixmap'  : 'Arch_Site',
                'MenuText': QT_TRANSLATE_NOOP("Arch_Site","Site"),
                'Accel': "S, I",
                'ToolTip': QT_TRANSLATE_NOOP("Arch_Site","Creates a site object including selected objects.")}
示例#26
0
 def GetResources(self):
     """Set icon, menu and tooltip."""
     return {'Pixmap': 'Draft_AutoGroup',
             'MenuText': QT_TRANSLATE_NOOP("Draft_AutoGroup", "Autogroup"),
             'ToolTip': QT_TRANSLATE_NOOP("Draft_AutoGroup", "Select a group to add all Draft and Arch objects to.")}
示例#27
0
        """When leaving the workbench."""
        if hasattr(FreeCADGui, "draftToolBar"):
            FreeCADGui.draftToolBar.Deactivated()
        if hasattr(FreeCADGui, "Snapper"):
            FreeCADGui.Snapper.hide()
        FreeCAD.Console.PrintLog("Arch workbench deactivated.\n")

    def ContextMenu(self, recipient):
        """Define an optional custom context menu."""
        self.appendContextMenu("Utilities", self.draft_context_commands)

    def GetClassName(self):
        """Type of workbench."""
        return "Gui::PythonWorkbench"


FreeCADGui.addWorkbench(ArchWorkbench)

# Preference pages for importing and exporting various file formats
# are independent of the loading of the workbench and can be loaded at startup
import Arch_rc
from PySide.QtCore import QT_TRANSLATE_NOOP
FreeCADGui.addPreferencePage(":/ui/preferences-ifc.ui",
                             QT_TRANSLATE_NOOP("Draft", "Import-Export"))
FreeCADGui.addPreferencePage(":/ui/preferences-ifc-export.ui",
                             QT_TRANSLATE_NOOP("Draft", "Import-Export"))
FreeCADGui.addPreferencePage(":/ui/preferences-dae.ui",
                             QT_TRANSLATE_NOOP("Draft", "Import-Export"))

FreeCAD.__unit_test__ += ["TestArch"]
示例#28
0
 def GetResources(self):
     """Set icon, menu and tooltip."""
     return {'Pixmap': 'Draft_AddConstruction',
             'MenuText': QT_TRANSLATE_NOOP("Draft_AddConstruction", "Add to Construction group"),
             'ToolTip': QT_TRANSLATE_NOOP("Draft_AddConstruction", "Adds the selected objects to the construction group,\nand changes their appearance to the construction style.\nIt creates a construction group if it doesn't exist.")}
示例#29
0
    def setProperties(self,obj):

        pl = obj.PropertiesList
        if not "TrussAngle" in pl:
            obj.addProperty("App::PropertyAngle","TrussAngle","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The angle of the truss"))
            obj.setEditorMode("TrussAngle",1)
        if not "SlantType" in pl:
            obj.addProperty("App::PropertyEnumeration","SlantType","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The slant type of this truss"))
            obj.SlantType = ["Simple","Double"]
        if not "Normal" in pl:
            obj.addProperty("App::PropertyVector","Normal","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The normal direction of this truss"))
            obj.Normal = FreeCAD.Vector(0,0,1)
        if not "HeightStart" in pl:
            obj.addProperty("App::PropertyLength","HeightStart","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The height of the truss at the start position"))
            obj.HeightStart = 100
        if not "HeightEnd" in pl:
            obj.addProperty("App::PropertyLength","HeightEnd","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The height of the truss at the end position"))
            obj.HeightEnd = 200
        if not "StrutStartOffset" in pl:
            obj.addProperty("App::PropertyDistance","StrutStartOffset","Truss",
                            QT_TRANSLATE_NOOP("App::Property","An optional start offset for the top strut"))
        if not "StrutEndOffset" in pl:
            obj.addProperty("App::PropertyDistance","StrutEndOffset","Truss",
                            QT_TRANSLATE_NOOP("App::Property","An optional end offset for the top strut"))
        if not "StrutHeight" in pl:
            obj.addProperty("App::PropertyLength","StrutHeight","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The height of the main top and bottom elements of the truss"))
            obj.StrutHeight = 10
        if not "StrutWidth" in pl:
            obj.addProperty("App::PropertyLength","StrutWidth","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The width of the main top and bottom elements of the truss"))
            obj.StrutWidth = 5
        if not "RodType" in pl:
            obj.addProperty("App::PropertyEnumeration","RodType","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The type of the middle element of the truss"))
            obj.RodType = ["Round","Square"]
        if not "RodDirection" in pl:
            obj.addProperty("App::PropertyEnumeration","RodDirection","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The direction of the rods"))
            obj.RodDirection = ["Forward","Backward"]
        if not "RodSize" in pl:
            obj.addProperty("App::PropertyLength","RodSize","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The diameter or side of the rods"))
            obj.RodSize = 2
        if not "RodSections" in pl:
            obj.addProperty("App::PropertyInteger","RodSections","Truss",
                            QT_TRANSLATE_NOOP("App::Property","The number of rod sections"))
            obj.RodSections = 3
        if not "RodEnd" in pl:
            obj.addProperty("App::PropertyBool","RodEnd","Truss",
                            QT_TRANSLATE_NOOP("App::Property","If the truss has a rod at its endpoint or not"))
        if not "RodMode" in pl:
            obj.addProperty("App::PropertyEnumeration","RodMode","Truss",
                            QT_TRANSLATE_NOOP("App::Property","How to draw the rods"))
            obj.RodMode = rodmodes
        self.Type = "Truss"
示例#30
0
    def setProperties(self, obj):

        pl = obj.PropertiesList
        if not "Terrain" in pl:
            obj.addProperty(
                "App::PropertyLink", "Terrain", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The base terrain of this site"))
        if not "Address" in pl:
            obj.addProperty(
                "App::PropertyString", "Address", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The street and house number of this site"))
        if not "PostalCode" in pl:
            obj.addProperty(
                "App::PropertyString", "PostalCode", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The postal or zip code of this site"))
        if not "City" in pl:
            obj.addProperty(
                "App::PropertyString", "City", "Site",
                QT_TRANSLATE_NOOP("App::Property", "The city of this site"))
        if not "Country" in pl:
            obj.addProperty(
                "App::PropertyString", "Country", "Site",
                QT_TRANSLATE_NOOP("App::Property", "The country of this site"))
        if not "Latitude" in pl:
            obj.addProperty(
                "App::PropertyFloat", "Latitude", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The latitude of this site"))
        if not "Longitude" in pl:
            obj.addProperty(
                "App::PropertyFloat", "Longitude", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The latitude of this site"))
        if not "Declination" in pl:
            obj.addProperty(
                "App::PropertyAngle", "Declination", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Angle between the true North and the North direction in this document"
                ))
        if "NorthDeviation" in pl:
            obj.Declination = obj.NorthDeviation.Value
            obj.removeProperty("NorthDeviation")
        if not "Elevation" in pl:
            obj.addProperty(
                "App::PropertyLength", "Elevation", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The elevation of level 0 of this site"))
        if not "Url" in pl:
            obj.addProperty(
                "App::PropertyString", "Url", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "A url that shows this site in a mapping website"))
        if not "Additions" in pl:
            obj.addProperty(
                "App::PropertyLinkList", "Additions", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Other shapes that are appended to this object"))
        if not "Subtractions" in pl:
            obj.addProperty(
                "App::PropertyLinkList", "Subtractions", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "Other shapes that are subtracted from this object"))
        if not "ProjectedArea" in pl:
            obj.addProperty(
                "App::PropertyArea", "ProjectedArea", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The area of the projection of this object onto the XY plane"
                ))
        if not "Perimeter" in pl:
            obj.addProperty(
                "App::PropertyLength", "Perimeter", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "The perimeter length of this terrain"))
        if not "AdditionVolume" in pl:
            obj.addProperty(
                "App::PropertyVolume", "AdditionVolume", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The volume of earth to be added to this terrain"))
        if not "SubtractionVolume" in pl:
            obj.addProperty(
                "App::PropertyVolume", "SubtractionVolume", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "The volume of earth to be removed from this terrain"))
        if not "ExtrusionVector" in pl:
            obj.addProperty(
                "App::PropertyVector", "ExtrusionVector", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "An extrusion vector to use when performing boolean operations"
                ))
            obj.ExtrusionVector = FreeCAD.Vector(0, 0, -100000)
        if not "RemoveSplitter" in pl:
            obj.addProperty(
                "App::PropertyBool", "RemoveSplitter", "Site",
                QT_TRANSLATE_NOOP("App::Property",
                                  "Remove splitters from the resulting shape"))
        if not "OriginOffset" in pl:
            obj.addProperty(
                "App::PropertyVector", "OriginOffset", "Site",
                QT_TRANSLATE_NOOP(
                    "App::Property",
                    "An optional offset between the model (0,0,0) origin and the point indicated by the geocoordinates"
                ))
        if not hasattr(obj, "Group"):
            obj.addExtension("App::GroupExtensionPython", self)
        self.Type = "Site"
        obj.setEditorMode('Height', 2)