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

Python shipUtils.Translator类代码示例

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

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



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

示例1: accept

 def accept(self):
     msg = Translator.translate("Building data...\n")
     App.Console.PrintMessage(msg)
     # Get GUI data
     endTime = self.form.time.value()
     output  = []
     output.append(self.form.output.value())
     output.append(self.form.outputType.currentIndex())
     devId   = self.form.device.currentIndex() - 1 # First is not OpenCL
     # Get OpenCL device
     device = None
     count  = 0
     platforms = cl.get_platforms()
     for p in platforms:
         devs = p.get_devices()
         for d in devs:
             if count == devId:
                 device = d
             count = count + 1
     # Get free surfaces data
     FSMesh = SimInstance.FSMesh(self.sim)
     wData  = self.sim.Waves
     wDir   = self.sim.Waves_Dir
     waves  = []
     for i in range(0,len(wData)):
         waves.append([wData[i].x, wData[i].y, wData[i].z, wDir[i]])
     msg = Translator.translate("Launching simulation...\n")
     App.Console.PrintMessage(msg)
     # Build simulation thread
     simulator = Sim(device, endTime, output, FSMesh, waves)
     simulator.start()
     msg = Translator.translate("Done!\n")
     App.Console.PrintMessage(msg)
     return True
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:34,代码来源:TaskPanel.py


示例2: retranslateUi

 def retranslateUi(self):
     """ Set user interface locale strings. 
     """
     self.form.setWindowTitle(Translator.translate("Create a new ship"))
     self.form.findChild(QtGui.QLabel, "LengthLabel").setText(Translator.translate("Length"))
     self.form.findChild(QtGui.QLabel, "BeamLabel").setText(Translator.translate("Beam"))
     self.form.findChild(QtGui.QLabel, "DraftLabel").setText(Translator.translate("Draft"))
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:7,代码来源:TaskPanel.py


示例3: initValues

 def initValues(self):
     """ Set initial values for fields
     """
     # Get selected objects
     selObjs  = Geometry.getSelectedObjs()
     if not selObjs:
         msg = Translator.translate("Ship instance must be selected (no object selected)\n")
         App.Console.PrintError(msg)
         return True
     for i in range(0,len(selObjs)):
         obj = selObjs[i]
         # Test if is a ship instance
         props = obj.PropertiesList
         try:
             props.index("IsShip")
         except ValueError:
             continue
         if obj.IsShip:
             # Test if another ship already selected
             if self.ship:
                 msg = Translator.translate("More than one ship selected (extra ship will be neglected)\n")
                 App.Console.PrintWarning(msg)
                 break
             self.ship = obj
     # Test if any valid ship was selected
     if not self.ship:
         msg = Translator.translate("Ship instance must be selected (no valid ship found at selected objects)\n")
         App.Console.PrintError(msg)
         return True
     # Load sections (if exist)
     self.loadSections()
     msg = Translator.translate("Ready to work\n")
     App.Console.PrintMessage(msg)
     return False
开发者ID:Koelie2,项目名称:freecad,代码行数:34,代码来源:TaskPanel.py


示例4: Initialize

 def Initialize(self):
     from shipUtils import Translator
     # ToolBar
     list = ["Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics"]
     self.appendToolbar("Ship design",list)
     list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
     self.appendToolbar("Weights",list)
     # Simulation stuff only if pyOpenCL & numpy are present
     hasOpenCL = True
     hasNumpy  = True
     try:
         import pyopencl
     except ImportError:
         hasOpenCL = False
         msg = Translator.translate("pyOpenCL not installed, ship simulations disabled\n")
         App.Console.PrintWarning(msg)
     try:
         import numpy
     except ImportError:
         hasNumpy = False
         msg = Translator.translate("numpy not installed, ship simulations disabled\n")
         App.Console.PrintWarning(msg)
     if hasOpenCL and hasNumpy:
         list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
         self.appendToolbar("Simulation",list)
     
     # Menu
     list = ["Ship_LoadExample", "Ship_CreateShip", "Ship_OutlineDraw", "Ship_AreasCurve", "Ship_Hydrostatics"]
     self.appendMenu("Ship design",list)
     list = ["Ship_Weights", "Ship_CreateTank", "Ship_GZ"]
     self.appendMenu("Weights",list)
     if hasOpenCL and hasNumpy:
         list = ["Ship_CreateSim", "Ship_RunSim", "Ship_StopSim"]
         self.appendMenu("Simulation",list)
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:34,代码来源:InitGui.py


示例5: __init__

 def __init__(self, obj, fsMeshData, waves):
     """ Creates a new simulation instance on active document.
     @param obj Created Part::FeaturePython object.
     @param fsMeshData [L,B,N] Free surface mesh data, with lenght 
     (x), Beam (y) and desired number of points.
     @param waves [[A,T,phi,heading],] Waves involved 
     """
     # Add uniqueness property to identify Tank instances
     obj.addProperty("App::PropertyBool","IsShipSimulation","ShipSimulation", str(Translator.translate("True if is a valid ship simulation instance"))).IsShipSimulation=True
     # Compute free surface mesh
     self.createFSMesh(obj,fsMeshData)
     self.computeWaves(obj,waves)
     # Store waves
     obj.addProperty("App::PropertyVectorList","Waves","ShipSimulation", str(Translator.translate("Waves (Amplitude,period,phase)"))).Waves=[]
     obj.addProperty("App::PropertyFloatList","Waves_Dir","ShipSimulation", str(Translator.translate("Waves direction (0 deg to stern waves)"))).Waves_Dir=[]
     w = []
     d = []
     for i in range(0,len(waves)):
         w.append(Vector(waves[i][0], waves[i][1], waves[i][2]))
         d.append(waves[i][3])
     obj.Waves = w
     obj.Waves_Dir = d
     # Add shapes
     shape = self.computeShape(obj)
     if not shape:
         obj.IsShipSimulation=False
         return
     obj.Shape = shape
     obj.Proxy = self
开发者ID:c-lutaud,项目名称:FreeCAD_sf_master,代码行数:29,代码来源:SimInstance.py


示例6: retranslateUi

 def retranslateUi(self):
     """ Set user interface locale strings. 
     """
     self.form.setWindowTitle(Translator.translate("Plot hydrostatics"))
     self.form.findChild(QtGui.QLabel, "TrimLabel").setText(Translator.translate("Trim"))
     self.form.findChild(QtGui.QLabel, "MinDraftLabel").setText(Translator.translate("Minimum draft"))
     self.form.findChild(QtGui.QLabel, "MaxDraftLabel").setText(Translator.translate("Maximum draft"))
     self.form.findChild(QtGui.QLabel, "NDraftLabel").setText(Translator.translate("Number of points"))
开发者ID:Koelie2,项目名称:freecad,代码行数:8,代码来源:TaskPanel.py


示例7: onTanksSelection

 def onTanksSelection(self):
     """ Called when tanks are selected or deselected.
     """
     # Set displacement label
     disp = self.computeDisplacement()
     self.form.disp.setText(Translator.translate("Displacement") + ' = %g [kg]' % (disp[0]))
     # Set draft label
     draft = self.computeDraft(disp[0], self.form.trim.value())
     self.form.draft.setText(Translator.translate("Draft") + ' = %g [m]' % (draft[0]))
开发者ID:Koelie2,项目名称:freecad,代码行数:9,代码来源:TaskPanel.py


示例8: onUpdate

 def onUpdate(self):
     """ Called when update displacement and draft is requested.
     """
     # Set displacement label
     disp = self.computeDisplacement()
     self.form.disp.setText(Translator.translate("Displacement") + ' = %g [kg]' % (disp[0]))
     # Set draft label
     draft = self.computeDraft(disp[0], self.form.trim.value())
     self.form.draft.setText(Translator.translate("Draft") + ' = %g [m]' % (draft[0]))
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:9,代码来源:TaskPanel.py


示例9: initValues

 def initValues(self):
     """ Set initial values for fields
     """
     # Get objects
     selObjs  = Geometry.getSelectedObjs()
     if not selObjs:
         msg = Translator.translate("Ship instance must be selected (no object selected)\n")
         App.Console.PrintError(msg)
         return True
     for i in range(0,len(selObjs)):
         obj = selObjs[i]
         # Test if is a ship instance
         props = obj.PropertiesList
         try:
             props.index("IsShip")
         except ValueError:
             continue
         if obj.IsShip:
             # Test if another ship already selected
             if self.ship:
                 msg = Translator.translate("More than one ship selected (extra ship will be neglected)\n")
                 App.Console.PrintWarning(msg)
                 break
             self.ship = obj
     # Test if any valid ship was selected
     if not self.ship:
         msg = Translator.translate("Ship instance must be selected (no valid ship found at selected objects)\n")
         App.Console.PrintError(msg)
         return True
     # Get bounds
     bbox = self.ship.Shape.BoundBox
     self.form.draft.setMaximum(bbox.ZMax)
     self.form.draft.setMinimum(bbox.ZMin)
     self.form.draft.setValue(self.ship.Draft)
     # Try to use saved values
     props = self.ship.PropertiesList
     flag = True
     try:
         props.index("AreaCurveDraft")
     except ValueError:
         flag = False
     if flag:
         self.form.draft.setValue(self.ship.AreaCurveDraft)
     flag = True
     try:
         props.index("AreaCurveTrim")
     except ValueError:
         flag = False
     if flag:
         self.form.trim.setValue(self.ship.AreaCurveTrim)
     # Update GUI
     self.preview.update(self.form.draft.value(), self.form.trim.value(), self.ship)
     self.onUpdate()
     msg = Translator.translate("Ready to work\n")
     App.Console.PrintMessage(msg)
     return False
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:56,代码来源:TaskPanel.py


示例10: retranslateUi

 def retranslateUi(self):
     """ Set user interface locale strings. 
     """
     self.form.setWindowTitle(Translator.translate("Create a new tank"))
     name = Translator.translate("Filling level") + " (%)"
     self.form.findChild(QtGui.QLabel, "LevelLabel").setText(name)
     name = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">\n<html><body>'
     name = name + Translator.translate("Density")
     name = name + '(kg/m<span style=" vertical-align:super;">3</span>)</body></html>'
     self.form.findChild(QtGui.QLabel, "DensityLabel").setText(name)
开发者ID:archri,项目名称:freecad,代码行数:10,代码来源:TaskPanel.py


示例11: saveData

 def saveData(self, ship, trim, drafts):
     """ Write data file.
     @param ship Selected ship instance
     @param trim Trim in degrees.
     @param drafts List of drafts to be performed.
     @return True if error happens.
     """
     # Open the file
     filename = self.path + 'hydrostatics.dat'
     try:
         Output = open(filename, "w")
     except IOError:
         msg = Translator.translate("Can't write '" + filename + "' file.\n")
         FreeCAD.Console.PrintError(msg)
         return True
     # Print header
     Output.write(header)
     Output.write(" #\n")
     Output.write(" # File automatically exported by FreeCAD-Ship\n")
     Output.write(" # This file contains transversal areas data, filled with following columns:\n")
     Output.write(" #  1: Ship displacement [ton]\n")
     Output.write(" #  2: Draft [m]\n")
     Output.write(" #  3: Wetted surface [m2]\n")
     Output.write(" #  4: 1cm triming ship moment [ton m]\n")
     Output.write(" #  5: Bouyance center x coordinate\n")
     Output.write(" #  6: Floating area\n")
     Output.write(" #  7: KBt\n")
     Output.write(" #  8: BMt\n")
     Output.write(" #  9: Cb (block coefficient)\n")
     Output.write(" # 10: Cf (Floating coefficient)\n")
     Output.write(" # 11: Cm (Main frame coefficient)\n")
     Output.write(" #\n")
     Output.write(" #################################################################\n")
     # Get external faces
     faces = self.externalFaces(ship.Shape)
     if len(faces) == 0:
         msg = Translator.translate("Can't detect external faces from ship object.\n")
         FreeCAD.Console.PrintError(msg)
     else:
         faces = Part.makeShell(faces)
     # Print data
     FreeCAD.Console.PrintMessage("Computing hydrostatics...\n")
     for i in range(0,len(drafts)):
         FreeCAD.Console.PrintMessage("\t%d / %d\n" % (i+1, len(drafts)))
         draft = drafts[i]
         point = Tools.Point(ship,faces,draft,trim)
         string = "%f %f %f %f %f %f %f %f %f %f %f\n" % (point.disp, point.draft, point.wet, point.mom, point.xcb, point.farea, point.KBt, point.BMt, point.Cb, point.Cf, point.Cm)
         Output.write(string)
     # Close file
     Output.close()
     self.dataFile = filename
     msg = Translator.translate("Data saved at '" + self.dataFile + "'.\n")
     FreeCAD.Console.PrintMessage(msg)
     return False
开发者ID:c-lutaud,项目名称:FreeCAD_sf_master,代码行数:54,代码来源:Plot.py


示例12: initValues

 def initValues(self):
     """ Get selected geometry.
     @return False if sucessfully values initialized.
     """
     # Get selected objects
     selObjs = FreeCADGui.Selection.getSelection()
     if not selObjs:
         msg = Translator.translate("Ship instance must be selected (no object selected)\n")
         App.Console.PrintError(msg)
         return True
     for i in range(0, len(selObjs)):
         obj = selObjs[i]
         # Test if is a ship instance
         props = obj.PropertiesList
         try:
             props.index("IsShip")
         except ValueError:
             continue
         if obj.IsShip:
             # Test if another ship already selected
             if self.ship:
                 msg = Translator.translate("More than one ship selected (extra ship will be neglected)\n")
                 App.Console.PrintWarning(msg)
                 break
             self.ship = obj
     # Test if any valid ship was selected
     if not self.ship:
         msg = Translator.translate("Ship instance must be selected (no valid ship found at selected objects)\n")
         App.Console.PrintError(msg)
         return True
     # Get weights
     w = weights(self.ship)
     # Set the items
     self.form.weights.setRowCount(len(w) + 1)
     for i in range(0, len(w)):
         item = QtGui.QTableWidgetItem(w[i][0])
         self.form.weights.setItem(i, 0, item)
         string = "%g" % (w[i][1])
         item = QtGui.QTableWidgetItem(string)
         self.form.weights.setItem(i, 1, item)
         string = "%g" % (w[i][2].x)
         item = QtGui.QTableWidgetItem(string)
         self.form.weights.setItem(i, 2, item)
         string = "%g" % (w[i][2].y)
         item = QtGui.QTableWidgetItem(string)
         self.form.weights.setItem(i, 3, item)
         string = "%g" % (w[i][2].z)
         item = QtGui.QTableWidgetItem(string)
         self.form.weights.setItem(i, 4, item)
     msg = Translator.translate("Ready to work\n")
     App.Console.PrintMessage(msg)
     return False
开发者ID:archri,项目名称:freecad,代码行数:52,代码来源:TaskPanel.py


示例13: save

 def save(self):
     """ Saves data into ship instance.
     """
     props = self.ship.PropertiesList
     try:
         props.index("AreaCurveDraft")
     except ValueError:
         self.ship.addProperty("App::PropertyFloat","AreaCurveDraft","Ship", str(Translator.translate("Areas curve draft selected [m]")))
     self.ship.AreaCurveDraft = self.form.draft.value()
     try:
         props.index("AreaCurveTrim")
     except ValueError:
         self.ship.addProperty("App::PropertyFloat","AreaCurveTrim","Ship", str(Translator.translate("Areas curve trim selected [m]")))
     self.ship.AreaCurveTrim = self.form.trim.value()
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:14,代码来源:TaskPanel.py


示例14: stopSimulation

def stopSimulation():
    try:
        simulator = Sim()
        if not simulator.isRunning():
            msg = Translator.translate("Simulation already stopped\n")
            App.Console.PrintWarning(msg)
            return
    except:
        msg = Translator.translate("Any active simulation to stop!\n")
        App.Console.PrintError(msg)
        return
    simulator.stop()
    msg = Translator.translate("Simulation will stop at the end of actual iteration\n")
    App.Console.PrintMessage(msg)
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:14,代码来源:TaskPanel.py


示例15: __init__

 def __init__(self, obj, faces):
     """ Creates a new ship on active document.
     @param faces Ship faces (Part::Shape entities).
     """
     # Add uniqueness property to identify Ship instances
     obj.addProperty("App::PropertyBool","IsShip","Ship", str(Translator.translate("True if is a valid ship instance"))).IsShip=True
     # Add main dimensions
     obj.addProperty("App::PropertyLength","Length","Ship", str(Translator.translate("Ship length (Lpp) [m]"))).Length=0.0
     obj.addProperty("App::PropertyLength","Beam","Ship", str(Translator.translate("Ship beam (B) [m]"))).Beam=0.0
     obj.addProperty("App::PropertyLength","Draft","Ship", str(Translator.translate("Ship draft (T) [m]"))).Draft=0.0
     # Add shapes
     obj.Shape = Part.makeShell(faces)
     obj.Proxy = self
     self.obj = obj
开发者ID:Koelie2,项目名称:freecad,代码行数:14,代码来源:Instance.py


示例16: __init__

 def __init__(self, obj, solids):
     """ Creates a new ship on active document.
     @param obj Part::FeaturePython created object.
     @param faces Ship solids components.
     """
     # Add uniqueness property to identify Ship instances
     obj.addProperty("App::PropertyBool","IsShip","Ship", str(Translator.translate("True if is a valid ship instance"))).IsShip=True
     # Add main dimensions
     obj.addProperty("App::PropertyLength","Length","Ship", str(Translator.translate("Ship length (Lpp) [m]"))).Length=0.0
     obj.addProperty("App::PropertyLength","Beam","Ship", str(Translator.translate("Ship beam (B) [m]"))).Beam=0.0
     obj.addProperty("App::PropertyLength","Draft","Ship", str(Translator.translate("Ship draft (T) [m]"))).Draft=0.0
     # Add shapes
     obj.Shape = Part.makeCompound(solids)
     obj.addProperty("Part::PropertyPartShape","ExternalFaces","Ship", str(Translator.translate("Ship only external faces")))
     obj.Proxy = self
开发者ID:biki89,项目名称:free-cad,代码行数:15,代码来源:Instance.py


示例17: saveData

 def saveData(self,x,y,ship):
     """ Write data file.
     @param x X coordinates.
     @param y Transversal areas.
     @param ship Active ship instance.
     @return True if error happens.
     """
     # Open the file
     filename = self.path + 'areas.dat'
     try:
         Output = open(filename, "w")
     except IOError:
         msg = Translator.translate("Can't write '" + filename + "' file.\n")
         FreeCAD.Console.PrintError(msg)
         return True
     # Print header
     Output.write(header)
     Output.write(" #\n")
     Output.write(" # File automatically exported by FreeCAD-Ship\n")
     Output.write(" # This file contains transversal areas data, filled with following columns:\n")
     Output.write(" # 1: X coordiante [m]\n")
     Output.write(" # 2: Transversal area [m2]\n")
     Output.write(" # 3: X FP coordinate [m]\n")
     Output.write(" # 4: Y FP coordinate (bounds in order to draw it)\n")
     Output.write(" # 3: X AP coordinate [m]\n")
     Output.write(" # 4: Y AP coordinate (bounds in order to draw it)\n")
     Output.write(" #\n")
     Output.write(" #################################################################\n")
     # Get perpendiculars data
     Lpp = ship.Length
     FPx =  0.5*Lpp
     APx = -0.5*Lpp
     maxArea = max(y)
     # Print data
     if len(x) < 2:
         msg = Translator.translate("Not enough data to plot.\n")
         FreeCAD.Console.PrintError(msg)
     string = "%f %f %f %f %f %f\n" % (x[0], y[0], FPx, 0.0, APx, 0.0)
     Output.write(string)
     for i in range(1, len(x)):
         string = "%f %f %f %f %f %f\n" % (x[i], y[i], FPx, maxArea, APx, maxArea)
         Output.write(string)
     # Close file
     Output.close()
     self.dataFile = filename
     msg = Translator.translate("Data saved at '" + self.dataFile + "'.\n")
     FreeCAD.Console.PrintMessage(msg)
     return False
开发者ID:Koelie2,项目名称:freecad,代码行数:48,代码来源:Plot.py


示例18: setupUi

 def setupUi(self):
     mw = self.getMainWindow()
     form = mw.findChild(QtGui.QWidget, "TaskPanel")
     form.sections = form.findChild(QtGui.QTableWidget, "Sections")
     try:
         form.sections.setInputMethodHints(QtCore.Qt.ImhFormattedNumbersOnly)
     except:
         msg = Translator.translate("QtCore.Qt.ImhFormattedNumbersOnly not supported, will not used.\n")
         App.Console.PrintWarning(msg)
     form.sectionType = form.findChild(QtGui.QComboBox, "SectionType")
     form.deleteButton = form.findChild(QtGui.QPushButton, "DeleteButton")
     form.nSections = form.findChild(QtGui.QSpinBox, "NSections")
     form.createButton = form.findChild(QtGui.QPushButton, "CreateButton")
     form.scale = form.findChild(QtGui.QSpinBox, "Scale")
     self.form = form
     # Initial values
     if self.initValues():
         return True
     self.retranslateUi()
     self.obj = self.preview.update(self.ship.Length, self.ship.Beam, self.ship.Draft, self.LSections,self.BSections,self.TSections, self.ship.Shape)
     # Connect Signals and Slots
     QtCore.QObject.connect(form.sectionType,QtCore.SIGNAL("activated(QString)"),self.onSectionType)
     QtCore.QObject.connect(form.sections,QtCore.SIGNAL("cellChanged(int,int)"),self.onTableItem);
     QtCore.QObject.connect(form.deleteButton,QtCore.SIGNAL("pressed()"),self.onDeleteButton)
     QtCore.QObject.connect(form.createButton,QtCore.SIGNAL("pressed()"),self.onCreateButton)
开发者ID:Koelie2,项目名称:freecad,代码行数:25,代码来源:TaskPanel.py


示例19: onUpdate

 def onUpdate(self):
     """ Method called when update data request.
     """
     if not self.ship:
         return
     # Calculate drafts
     angle = math.radians(self.form.trim.value())
     L = self.ship.Length
     draftAP = self.form.draft.value() + 0.5*L*math.tan(angle)
     if draftAP < 0.0:
         draftAP = 0.0
     draftFP = self.form.draft.value() - 0.5*L*math.tan(angle)
     if draftFP < 0.0:
         draftFP = 0.0
     # Calculate hydrostatics involved
     data = Hydrostatics.displacement(self.ship,self.form.draft.value(),0.0,self.form.trim.value())
     # Prepare the string in html format
     string = 'L = %g [m]<BR>' % (self.ship.Length)
     string = string + 'B = %g [m]<BR>' % (self.ship.Beam)
     string = string + 'T = %g [m]<HR>' % (self.form.draft.value())
     string = string + 'Trim = %g [degrees]<BR>' % (self.form.trim.value())
     string = string + 'T<sub>AP</sub> = %g [m]<BR>' % (draftAP)
     string = string + 'T<sub>FP</sub> = %g [m]<HR>' % (draftFP)
     string = string + Translator.translate('Displacement') + ' = %g [ton]<BR>' % (data[0])
     string = string + 'XCB = %g [m]' % (data[1].x)
     # Set the document
     self.form.output.setHtml(string)
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:27,代码来源:TaskPanel.py


示例20: update

 def update(self, L, B, T):
     """ Update the 3D view printing annotations.
     @param L Ship length.
     @param B Ship beam.
     @param T Ship draft.
     """
     # Destroy all previous entities
     self.clean()
     # Draw base line
     xStart   = -0.6*L;
     xEnd     =  0.6*L;
     baseLine = Part.makeLine((xStart,0,0),(xEnd,0,0))
     Part.show(baseLine)
     objs = FreeCAD.ActiveDocument.Objects
     self.baseLine = objs[len(objs)-1]
     self.baseLine.Label = 'BaseLine'
     self.baseLineLabel = DrawText('BaseLineText', str(Translator.translate('Base line')), Base.Vector(xEnd,0,0))
     # Draw free surface
     fsLine = Part.makeLine((xStart,0,T),(xEnd,0,T))
     Part.show(fsLine)
     objs = FreeCAD.ActiveDocument.Objects
     self.fsLine = objs[len(objs)-1]
     self.fsLine.Label = 'FreeSurface'
     self.fsLineLabel = DrawText('FSText', str(Translator.translate('Free surface')), Base.Vector(xEnd,0,T))
     # Draw forward perpendicular
     zStart = -0.1*T
     zEnd   =  1.1*T
     fpLine = Part.makeLine((0.5*L,0,zStart),(0.5*L,0,zEnd))
     Part.show(fpLine)
     objs = FreeCAD.ActiveDocument.Objects
     self.fpLine = objs[len(objs)-1]
     self.fpLine.Label = 'ForwardPerpendicular'
     self.fpLineLabel = DrawText('FPText', str(Translator.translate('Forward perpendicular')), Base.Vector(0.5*L,0,zEnd))
     # Draw after perpendicular
     apLine = Part.makeLine((-0.5*L,0,zStart),(-0.5*L,0,zEnd))
     Part.show(apLine)
     objs = FreeCAD.ActiveDocument.Objects
     self.apLine = objs[len(objs)-1]
     self.apLine.Label = 'AfterPerpendicular'
     self.apLineLabel = DrawText('APText', str(Translator.translate('After perpendicular')), Base.Vector(-0.5*L,0,zEnd))
     # Draw amin frame
     amLine = Part.makeLine((0,-0.5*B,zStart),(0,-0.5*B,zEnd))
     Part.show(amLine)
     objs = FreeCAD.ActiveDocument.Objects
     self.amLine = objs[len(objs)-1]
     self.amLine.Label = 'AminFrame'
     self.amLineLabel = DrawText('AMText', str(Translator.translate('Amin frame')), Base.Vector(0,-0.5*B,zEnd))
开发者ID:RoyOnWheels,项目名称:FreeCAD,代码行数:47,代码来源:Preview.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python shipUtils.Units类代码示例发布时间:2022-05-27
下一篇:
Python shipUtils.Paths类代码示例发布时间: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