• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python shipUtils.Units类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中shipUtils.Units的典型用法代码示例。如果您正苦于以下问题:Python Units类的具体用法?Python Units怎么用?Python Units使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Units类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: clampAngle

 def clampAngle(self, widget, val_min, val_max, val):
     if val >= val_min and val <= val_max:
         return val
     input_format = USys.getAngleFormat()
     val = min(val_max, max(val_min, val))
     qty = Units.Quantity('{} deg'.format(val))
     widget.setText(input_format.format(
         qty.getValueAs(USys.getLengthUnits()).Value))
     return val
开发者ID:biki89,项目名称:FreeCAD_sf_master,代码行数:9,代码来源:TaskPanel.py


示例2: clampVal

 def clampVal(self, widget, val_min, val_max, val):
     if val >= val_min and val <= val_max:
         return val
     input_format = USys.getLengthFormat()
     val = min(val_max, max(val_min, val))
     qty = Units.Quantity('{} m'.format(val))
     widget.setText(Locale.toString(input_format.format(
         qty.getValueAs(USys.getLengthUnits()).Value)))
     return val
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:9,代码来源:TaskPanel.py


示例3: onData

    def onData(self, value):
        """ Method called when the tool input data is touched.
        @param value Changed value.
        """
        if not self.ship:
            return

        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.draft = self.widget(QtGui.QLineEdit, "Draft")
        form.trim = self.widget(QtGui.QLineEdit, "Trim")

        # Get the values (or fix them in bad setting case)
        try:
            draft = Units.Quantity(Locale.fromString(
                form.draft.text())).getValueAs('m').Value
        except:
            draft = self.ship.Draft.getValueAs(USys.getLengthUnits()).Value
            input_format = USys.getLengthFormat()
            qty = Units.Quantity('{} m'.format(draft))
            widget.setText(Locale.toString(input_format.format(
                qty.getValueAs(USys.getLengthUnits()).Value)))
        try:
            trim = Units.Quantity(Locale.fromString(
                form.trim.text())).getValueAs('deg').Value
        except:
            trim = 0.0
            input_format = USys.getAngleFormat()
            qty = Units.Quantity('{} deg'.format(trim))
            widget.setText(Locale.toString(input_format.format(
                qty.getValueAs(USys.getLengthUnits()).Value)))

        bbox = self.ship.Shape.BoundBox
        draft_min = bbox.ZMin / Units.Metre.Value
        draft_max = bbox.ZMax / Units.Metre.Value
        draft = self.clampLength(form.draft, draft_min, draft_max, draft)

        trim_min = -180.0
        trim_max = 180.0
        trim = self.clampAngle(form.trim, trim_min, trim_max, trim)

        self.onUpdate()
        self.preview.update(draft, trim, self.ship)
开发者ID:Fabracoder,项目名称:FreeCAD_sf_master,代码行数:43,代码来源:TaskPanel.py


示例4: accept

    def accept(self):
        """Create the ship instance"""
        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.ship = self.widget(QtGui.QComboBox, "Ship")
        form.weight = self.widget(QtGui.QLineEdit, "Weight")

        # Create the object
        ship = self.ships[form.ship.currentIndex()]
        obj = App.ActiveDocument.addObject("Part::FeaturePython", "Weight")
        weight = Instance.Weight(obj, self.shapes, ship)
        Instance.ViewProviderWeight(obj.ViewObject)

        # Set the mass/density
        m_unit = USys.getMassUnits()
        l_unit = USys.getLengthUnits()
        qty = Units.parseQuantity(form.weight.text())
        if self.elem_type == 1:
            w_unit = m_unit
            obj.Mass = qty.getValueAs(w_unit).Value
        elif self.elem_type == 2:
            w_unit = m_unit + '/' + l_unit
            obj.LineDens = qty.getValueAs(w_unit).Value
        elif self.elem_type == 3:
            w_unit = m_unit + '/' + l_unit + '^2'
            obj.AreaDens = qty.getValueAs(w_unit).Value
        elif self.elem_type == 4:
            w_unit = m_unit + '/' + l_unit + '^3'
            obj.Dens = qty.getValueAs(w_unit).Value

        # Set it as a child of the ship
        weights = ship.Weights[:]
        weights.append(obj.Name)
        ship.Weights = weights

        App.ActiveDocument.recompute()
        return True
开发者ID:DanielDTR,项目名称:FreeCAD_sf_master,代码行数:37,代码来源:TaskPanel.py


示例5: initValues

    def initValues(self):
        """ Set initial values for fields
        """
        selObjs = Gui.Selection.getSelection()
        if not selObjs:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A ship instance must be selected before using this tool (no"
                " objects selected)",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True
        for i in range(0, len(selObjs)):
            obj = selObjs[i]
            props = obj.PropertiesList
            try:
                props.index("IsShip")
            except ValueError:
                continue
            if obj.IsShip:
                if self.ship:
                    msg = QtGui.QApplication.translate(
                        "ship_console",
                        "More than one ship have been selected (the extra"
                        " ships will be ignored)",
                        None,
                        QtGui.QApplication.UnicodeUTF8)
                    App.Console.PrintWarning(msg + '\n')
                    break
                self.ship = obj
        if not self.ship:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A ship instance must be selected before using this tool (no"
                " valid ship found at the selected objects)",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True

        length_format = USys.getLengthFormat()
        angle_format = USys.getAngleFormat()

        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.draft = self.widget(QtGui.QLineEdit, "Draft")
        form.trim = self.widget(QtGui.QLineEdit, "Trim")
        form.num = self.widget(QtGui.QSpinBox, "Num")
        form.draft.setText(Locale.toString(length_format.format(
            self.ship.Draft.getValueAs(USys.getLengthUnits()).Value)))
        form.trim.setText(Locale.toString(angle_format.format(0.0)))
        # Try to use saved values
        props = self.ship.PropertiesList
        try:
            props.index("AreaCurveDraft")
            form.draft.setText(Locale.toString(length_format.format(
                self.ship.AreaCurveDraft.getValueAs(
                    USys.getLengthUnits()).Value)))
        except:
            pass
        try:
            props.index("AreaCurveTrim")
            form.trim.setText(Locale.toString(angle_format.format(
                self.ship.AreaCurveTrim.getValueAs(
                    USys.getAngleUnits()).Value)))
        except ValueError:
            pass
        try:
            props.index("AreaCurveNum")
            form.num.setValue(self.ship.AreaCurveNum)
        except ValueError:
            pass
        # Update GUI
        draft = Units.Quantity(form.draft.text()).getValueAs('m').Value
        trim = Units.Quantity(form.trim.text()).getValueAs('deg').Value
        self.preview.update(draft, trim, self.ship)
        self.onUpdate()
        return False
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:79,代码来源:TaskPanel.py


示例6: initValues

    def initValues(self):
        """Setup the initial values"""
        # Ensure that there are at least one valid object to generate the
        # weight
        selObjs = Gui.Selection.getSelection()
        self.shapes = []
        if not selObjs:
            msg = QtGui.QApplication.translate(
                "ship_weight",
                "Weight objects can only be created on top of its geometry"
                " (no objects selected)",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True
        for obj in selObjs:
            try:
                self.shapes.append(obj.Shape)
            except:
                continue
        if not len(self.shapes):
            msg = QtGui.QApplication.translate(
                "ship_weight",
                "No geometrical shapes found in the selected objects",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True

        # Get the element type
        # 0 = unknow, 1 = vertex, 2 = line, 3 = face, 4 = solids
        self.elem_type = 0
        for shape in self.shapes:
            # Doing it in this way we are protected under strange entities,
            # and we are prepared to add higher level type of entities in the
            # future, just in case...
            try:
                if len(shape.Solids):
                    self.elem_type = max(4, self.elem_type)
            except:
                pass
            try:
                if len(shape.Faces):
                    self.elem_type = max(3, self.elem_type)
            except:
                pass
            try:
                if len(shape.Edges):
                    self.elem_type = max(2, self.elem_type)
            except:
                pass
            try:
                if len(shape.Vertexes):
                    self.elem_type = max(1, self.elem_type)
            except:
                pass
        # Could it happens???
        if self.elem_type == 0:
            msg = QtGui.QApplication.translate(
                "ship_weight",
                "Unknow object shapes selected",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True

        # Ensure as well that exist at least one valid ship to create the
        # entity inside it
        self.ships = []
        for obj in App.ActiveDocument.Objects:
            try:
                if obj.IsShip:
                    self.ships.append(obj)
            except:
                continue
        if not len(self.ships):
            msg = QtGui.QApplication.translate(
                "ship_weight",
                "There are not ship objects to create weights into them",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True

        # Fill the ships combo box
        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.ship = self.widget(QtGui.QComboBox, "Ship")
        form.weight = self.widget(QtGui.QLineEdit, "Weight")
        icon = QtGui.QIcon(QtGui.QPixmap(":/icons/Ship_Instance.svg"))
        form.ship.clear()
        for ship in self.ships:
            form.ship.addItem(icon, ship.Label)
        form.ship.setCurrentIndex(0)

        # Initialize the 0 mass/density string field
        m_unit = USys.getMassUnits()
        l_unit = USys.getLengthUnits()
        if self.elem_type == 1:
            w_unit = m_unit
#.........这里部分代码省略.........
开发者ID:DanielDTR,项目名称:FreeCAD_sf_master,代码行数:101,代码来源:TaskPanel.py


示例7: initValues

    def initValues(self):
        """ Set initial values for fields
        """
        # Look for selected loading conditions (Spreadsheets)
        self.lc = None
        selObjs = Gui.Selection.getSelection()
        if not selObjs:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A loading condition instance must be selected before using" " this tool (no objects selected)",
                None,
                QtGui.QApplication.UnicodeUTF8,
            )
            App.Console.PrintError(msg + "\n")
            return True
        for i in range(len(selObjs)):
            obj = selObjs[i]
            try:
                if obj.TypeId != "Spreadsheet::Sheet":
                    continue
            except ValueError:
                continue
            # Check if it is a Loading condition:
            # B1 cell must be a ship
            # B2 cell must be the loading condition itself
            doc = App.ActiveDocument
            try:
                if obj not in doc.getObjectsByLabel(obj.get("B2")):
                    continue
                ships = doc.getObjectsByLabel(obj.get("B1"))
                if len(ships) != 1:
                    if len(ships) == 0:
                        msg = QtGui.QApplication.translate(
                            "ship_console",
                            "Wrong Ship label! (no instances labeled as" "'{}' found)",
                            None,
                            QtGui.QApplication.UnicodeUTF8,
                        )
                        App.Console.PrintError(msg + "\n".format(obj.get("B1")))
                    else:
                        msg = QtGui.QApplication.translate(
                            "ship_console",
                            "Ambiguous Ship label! ({} instances labeled as" "'{}' found)",
                            None,
                            QtGui.QApplication.UnicodeUTF8,
                        )
                        App.Console.PrintError(msg + "\n".format(len(ships), obj.get("B1")))
                    continue
                ship = ships[0]
                if ship is None or not ship.PropertiesList.index("IsShip"):
                    continue
            except ValueError:
                continue
            # Let's see if several loading conditions have been selected (and
            # prompt a warning)
            if self.lc:
                msg = QtGui.QApplication.translate(
                    "ship_console",
                    "More than one loading condition have been selected (the"
                    " extra loading conditions will be ignored)",
                    None,
                    QtGui.QApplication.UnicodeUTF8,
                )
                App.Console.PrintWarning(msg + "\n")
                break
            self.lc = obj
            self.ship = ship
        if not self.lc:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A loading condition instance must be selected before using"
                " this tool (no valid loading condition found at the selected"
                " objects)",
                None,
                QtGui.QApplication.UnicodeUTF8,
            )
            App.Console.PrintError(msg + "\n")
            return True

        # We have a valid loading condition, let's set the initial field values
        angle_format = USys.getAngleFormat()
        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.angle = self.widget(QtGui.QLineEdit, "Angle")
        form.n_points = self.widget(QtGui.QSpinBox, "NumPoints")
        form.var_trim = self.widget(QtGui.QCheckBox, "VariableTrim")
        form.angle.setText(Locale.toString(angle_format.format(90.0)))
        # Try to use saved values
        props = self.ship.PropertiesList
        try:
            props.index("GZAngle")
            form.angle.setText(
                Locale.toString(angle_format.format(self.ship.GZAngle.getValueAs(USys.getAngleUnits()).Value))
            )
        except:
            pass
        try:
            props.index("GZNumPoints")
            form.n_points.setValue(self.ship.GZNumPoints)
        except ValueError:
#.........这里部分代码省略.........
开发者ID:caceres,项目名称:FreeCAD,代码行数:101,代码来源:TaskPanel.py


示例8: onData

    def onData(self, value):
        """ Method called when input data is changed.
         @param value Changed value.
        """
        if not self.ship:
            return
        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.trim = self.widget(QtGui.QLineEdit, "Trim")
        form.minDraft = self.widget(QtGui.QLineEdit, "MinDraft")
        form.maxDraft = self.widget(QtGui.QLineEdit, "MaxDraft")

        # Get the values (or fix them in bad setting case)
        try:
            trim = Units.Quantity(form.trim.text()).getValueAs('deg').Value
        except:
            trim = 0.0
            input_format = USys.getAngleFormat()
            qty = Units.Quantity('{} deg'.format(trim))
            form.trim.setText(input_format.format(
                qty.getValueAs(USys.getLengthUnits()).Value))
        try:
            min_draft = Units.Quantity(
                form.minDraft.text()).getValueAs('m').Value
        except:
            min_draft = 0.9 * self.ship.Draft.getValueAs('m').Value
            input_format = USys.getLengthFormat()
            qty = Units.Quantity('{} m'.format(min_draft))
            form.minDraft.setText(input_format.format(
                qty.getValueAs(USys.getLengthUnits()).Value))
        try:
            max_draft = Units.Quantity(
                form.minDraft.text()).getValueAs('m').Value
        except:
            max_draft = 0.9 * self.ship.Draft.getValueAs('m').Value
            input_format = USys.getLengthFormat()
            qty = Units.Quantity('{} m'.format(max_draft))
            form.maxDraft.setText(input_format.format(
                qty.getValueAs(USys.getLengthUnits()).Value))

        # Clamp the values to the bounds
        bbox = self.ship.Shape.BoundBox
        draft_min = bbox.ZMin / Units.Metre.Value
        draft_max = bbox.ZMax / Units.Metre.Value
        min_draft = self.clampLength(form.minDraft,
                                     draft_min,
                                     draft_max,
                                     min_draft)
        max_draft = self.clampLength(form.maxDraft,
                                     draft_min,
                                     draft_max,
                                     max_draft)
        trim_min = -180.0
        trim_max = 180.0
        trim = self.clampAngle(form.trim, trim_min, trim_max, trim)

        # Clamp draft values to assert that the minimum value is lower than
        # the maximum one
        min_draft = self.clampLength(form.minDraft,
                                     draft_min,
                                     max_draft,
                                     min_draft)
        max_draft = self.clampLength(form.maxDraft,
                                     min_draft,
                                     draft_max,
                                     max_draft)
开发者ID:CobraElDiablo,项目名称:FreeCAD_sf_master,代码行数:66,代码来源:TaskPanel.py


示例9: initValues

    def initValues(self):
        """ Set initial values for fields
        """
        mw = self.getMainWindow()
        form = mw.findChild(QtGui.QWidget, "TaskPanel")
        form.trim = self.widget(QtGui.QLineEdit, "Trim")
        form.minDraft = self.widget(QtGui.QLineEdit, "MinDraft")
        form.maxDraft = self.widget(QtGui.QLineEdit, "MaxDraft")
        form.nDraft = self.widget(QtGui.QSpinBox, "NDraft")

        selObjs = Gui.Selection.getSelection()
        if not selObjs:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A ship instance must be selected before using this tool (no"
                " objects selected)",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True
        for i in range(len(selObjs)):
            obj = selObjs[i]
            props = obj.PropertiesList
            try:
                props.index("IsShip")
            except ValueError:
                continue
            if obj.IsShip:
                if self.ship:
                    msg = QtGui.QApplication.translate(
                        "ship_console",
                        "More than one ship have been selected (the extra"
                        " ships will be ignored)",
                        None,
                        QtGui.QApplication.UnicodeUTF8)
                    App.Console.PrintWarning(msg + '\n')
                    break
                self.ship = obj

        if not self.ship:
            msg = QtGui.QApplication.translate(
                "ship_console",
                "A ship instance must be selected before using this tool (no"
                " valid ship found at the selected objects)",
                None,
                QtGui.QApplication.UnicodeUTF8)
            App.Console.PrintError(msg + '\n')
            return True

        props = self.ship.PropertiesList

        length_format = USys.getLengthFormat()
        angle_format = USys.getAngleFormat()

        try:
            props.index("HydrostaticsTrim")
            form.trim.setText(angle_format.format(
                self.ship.HydrostaticsTrim.getValueAs(
                    USys.getLengthUnits()).Value))
        except ValueError:
            form.trim.setText(angle_format.format(0.0))

        try:
            props.index("HydrostaticsMinDraft")
            form.minDraft.setText(length_format.format(
                self.ship.HydrostaticsMinDraft.getValueAs(
                    USys.getLengthUnits()).Value))
        except ValueError:
            form.minDraft.setText(length_format.format(
                0.9 * self.ship.Draft.getValueAs('m').Value))
        try:
            props.index("HydrostaticsMaxDraft")
            form.maxDraft.setText(length_format.format(
                self.ship.HydrostaticsMaxDraft.getValueAs(
                    USys.getLengthUnits()).Value))
        except ValueError:
            form.maxDraft.setText(length_format.format(
                1.1 * self.ship.Draft.getValueAs('m').Value))

        try:
            props.index("HydrostaticsNDraft")
            form.nDraft.setValue(self.ship.HydrostaticsNDraft)
        except ValueError:
            pass

        return False
开发者ID:CobraElDiablo,项目名称:FreeCAD_sf_master,代码行数:86,代码来源:TaskPanel.py


示例10: getVolume

    def getVolume(self, fp, level, return_shape=False):
        """Return the fluid volume inside the tank, provided the filling level.

        Keyword arguments:
        fp -- Part::FeaturePython object affected.
        level -- Percentage of filling level (interval [0, 1]).
        return_shape -- False if the tool should return the fluid volume value,
        True if the tool should return the volume shape.
        """
        if level <= 0.0:
            if return_shape:
                return Part.Vertex()
            return Units.Quantity(0.0, Units.Volume)
        if level >= 1.0:
            if return_shape:
                return fp.Shape.copy()
            return Units.Quantity(fp.Shape.Volume, Units.Volume)

        # Build up the cutting box
        bbox = fp.Shape.BoundBox
        dx = bbox.XMax - bbox.XMin
        dy = bbox.YMax - bbox.YMin
        dz = bbox.ZMax - bbox.ZMin

        box = App.ActiveDocument.addObject("Part::Box","Box")
        length_format = USys.getLengthFormat()
        box.Placement = Placement(Vector(bbox.XMin - dx,
                                         bbox.YMin - dy,
                                         bbox.ZMin - dz),
                                  Rotation(App.Vector(0,0,1),0))
        box.Length = length_format.format(3.0 * dx)
        box.Width = length_format.format(3.0 * dy)
        box.Height = length_format.format((1.0 + level) * dz)

        # Create a new object on top of a copy of the tank shape
        Part.show(fp.Shape.copy())
        tank = App.ActiveDocument.Objects[-1]

        # Compute the common boolean operation
        App.ActiveDocument.recompute()
        common = App.activeDocument().addObject("Part::MultiCommon",
                                                "TankVolHelper")
        common.Shapes = [tank, box]
        App.ActiveDocument.recompute()
        if len(common.Shape.Solids) == 0:
            # The common operation is failing, let's try moving a bit the free
            # surface
            msg = QtGui.QApplication.translate(
                "ship_console",
                "Tank volume operation failed. The tool is retrying that"
                " slightly moving the free surface position",
                None)
            App.Console.PrintWarning(msg + '\n')
            rand_bounds = 0.01 * dz
            i = 0
            while len(common.Shape.Solids) == 0 and i < COMMON_BOOLEAN_ITERATIONS:
                i += 1
                box.Height = length_format.format(
                    (1.0 + level) * dz + random.uniform(-random_bounds,
                                                        random_bounds))
                App.ActiveDocument.recompute()

        if return_shape:
            ret_value = common.Shape.copy()
        else:
            ret_value = Units.Quantity(common.Shape.Volume, Units.Volume)

        App.ActiveDocument.removeObject(common.Name)
        App.ActiveDocument.removeObject(tank.Name)
        App.ActiveDocument.removeObject(box.Name)
        App.ActiveDocument.recompute()

        return ret_value
开发者ID:AjinkyaDahale,项目名称:FreeCAD,代码行数:73,代码来源:TankInstance.py


示例11: getUnderwaterSide

def getUnderwaterSide(shape, force=True):
    """Get the underwater shape, simply cropping the provided shape by the z=0
    free surface plane.

    Position arguments:
    shape -- Solid shape to be cropped

    Keyword arguments:
    force -- True if in case the common boolean operation fails, i.e. returns
    no solids, the tool should retry it slightly moving the free surface. False
    otherwise. (True by default)

    Returned value:
    Cropped shape. It is not modifying the input shape
    """
    # Convert the shape into an active object
    Part.show(shape)
    orig = App.ActiveDocument.Objects[-1]

    bbox = shape.BoundBox
    xmin = bbox.XMin
    xmax = bbox.XMax
    ymin = bbox.YMin
    ymax = bbox.YMax
    zmin = bbox.ZMin
    zmax = bbox.ZMax

    # Create the "sea" box to intersect the ship
    L = xmax - xmin
    B = ymax - ymin
    H = zmax - zmin

    box = App.ActiveDocument.addObject("Part::Box","Box")
    length_format = USys.getLengthFormat()
    box.Placement = Placement(Vector(xmin - L, ymin - B, zmin - H),
                              Rotation(App.Vector(0,0,1),0))
    box.Length = length_format.format(3.0 * L)
    box.Width = length_format.format(3.0 * B)
    box.Height = length_format.format(- zmin + H)

    App.ActiveDocument.recompute()
    common = App.activeDocument().addObject("Part::MultiCommon",
                                            "UnderwaterSideHelper")
    common.Shapes = [orig, box]
    App.ActiveDocument.recompute()
    if force and len(common.Shape.Solids) == 0:
        # The common operation is failing, let's try moving a bit the free
        # surface
        msg = QtGui.QApplication.translate(
            "ship_console",
            "Boolean operation failed when trying to get the underwater side."
            " The tool is retrying such operation slightly moving the free"
            " surface position",
            None,
            QtGui.QApplication.UnicodeUTF8)
        App.Console.PrintWarning(msg + '\n')
        random_bounds = 0.01 * H
        i = 0
        while len(common.Shape.Solids) == 0 and i < COMMON_BOOLEAN_ITERATIONS:
            i += 1
            box.Height = length_format.format(
                - zmin + H + random.uniform(-random_bounds, random_bounds))
            App.ActiveDocument.recompute() 

    out = common.Shape
    App.ActiveDocument.removeObject(common.Name)
    App.ActiveDocument.removeObject(orig.Name)
    App.ActiveDocument.removeObject(box.Name)
    App.ActiveDocument.recompute()
    return out
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:70,代码来源:Tools.py



注:本文中的shipUtils.Units类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.flags4appversions函数代码示例发布时间:2022-05-27
下一篇:
Python shipUtils.Translator类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap