예제 #1
0
 def __init__(self,winTitle='Rotate WP', icon='rotWP.svg'):
   super(rotWPForm,self).__init__()
   self.move(QPoint(100,250))
   self.setWindowFlags(Qt.WindowStaysOnTopHint)
   self.setWindowTitle(winTitle)
   iconPath=join(dirname(abspath(__file__)),"iconz",icon)
   from PySide.QtGui import QIcon
   Icon=QIcon()
   Icon.addFile(iconPath)
   self.setWindowIcon(Icon) 
   self.grid=QGridLayout()
   self.setLayout(self.grid)
   self.radioX=QRadioButton('X')
   self.radioX.setChecked(True)
   self.radioY=QRadioButton('Y')
   self.radioZ=QRadioButton('Z')
   self.lab1=QLabel('Angle:')
   self.edit1=QLineEdit('45')
   self.edit1.setAlignment(Qt.AlignCenter)
   self.edit1.setValidator(QDoubleValidator())
   self.btn1=QPushButton('Rotate working plane')
   self.btn1.clicked.connect(self.rotate)
   self.grid.addWidget(self.radioX,0,0,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.radioY,0,1,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.radioZ,0,2,1,1,Qt.AlignCenter)
   self.grid.addWidget(self.lab1,1,0,1,1)
   self.grid.addWidget(self.edit1,1,1,1,2)
   self.grid.addWidget(self.btn1,2,0,1,3,Qt.AlignCenter)
   self.show()
   self.sg=FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
   s=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetInt("gridSize")
   sc=[float(x*s) for x in [1,1,.2]]
   from uCmd import arrow
   self.arrow =arrow(FreeCAD.DraftWorkingPlane.getPlacement(),scale=sc,offset=s)
예제 #2
0
파일: fForms.py 프로젝트: oddtopus/dodo
 def selectAction(self):
     edged = [
         objex for objex in FreeCADGui.Selection.getSelectionEx()
         if fCmd.edges([objex])
     ]
     if edged:
         self.Axis = fCmd.edges([edged[0]])[0]
         self.deleteArrow()
         from uCmd import arrow
         where = FreeCAD.Placement()
         where.Base = self.Axis.valueAt(self.Axis.LastParameter)
         where.Rotation = FreeCAD.Rotation(
             FreeCAD.Vector(0, 0, 1),
             self.Axis.tangentAt(self.Axis.LastParameter))
         obj = edged[
             0].Object  #TARGET [solved]: make "where" deal with App::Parts
         if fCmd.isPartOfPart(obj):
             part = fCmd.isPartOfPart(obj)
             where = part.Placement.multiply(where)
         size = [
             self.Axis.Length / 20.0, self.Axis.Length / 10.0,
             self.Axis.Length / 20.0
         ]
         self.arrow = arrow(pl=where,
                            scale=size,
                            offset=self.Axis.Length / 10.0)
         if self.Axis.curvatureAt(0):
             O = self.Axis.centerOfCurvatureAt(0)
             n = self.Axis.tangentAt(0).cross(self.Axis.normalAt(0))
             from Part import Edge, Line
             self.Axis = (Edge(
                 Line(FreeCAD.Vector(O), FreeCAD.Vector(O + n))))
         self.form.lab1.setText(edged[0].Object.Label + ": edge")
예제 #3
0
파일: CUtils.py 프로젝트: vocx-fc/dodo
 def Activated(self):
     if hasattr(FreeCAD, 'DraftWorkingPlane') and hasattr(
             FreeCADGui, 'Snapper'):
         import uCmd
         s = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft"
                              ).GetInt("gridSize")
         sc = [float(x * s) for x in [1, 1, .2]]
         arrow = uCmd.arrow(FreeCAD.DraftWorkingPlane.getPlacement(),
                            scale=sc,
                            offset=s)
         from PySide.QtGui import QInputDialog as qid
         offset = qid.getInt(None, 'Offset Work Plane', 'Offset: ')
         if offset[1] > 0:
             uCmd.offsetWP(offset[0])
         #FreeCADGui.ActiveDocument.ActiveView.getSceneGraph().removeChild(arrow.node)
         arrow.closeArrow()
예제 #4
0
파일: fForms.py 프로젝트: vocx-fc/dodo
 def getLength(self):
   roundDigits=3
   if len(fCmd.edges())>0:
     edge=fCmd.edges()[0]
     self.form.edit4.setText(str(edge.Length))
     self.form.edit5.setText('1')
     dx,dy,dz=list(edge.tangentAt(0))
     self.form.edit1.setText(str(round(dx,roundDigits)))
     self.form.edit2.setText(str(round(dy,roundDigits)))
     self.form.edit3.setText(str(round(dz,roundDigits)))
     self.deleteArrow()
     from uCmd import arrow
     where=FreeCAD.Placement()
     where.Base=edge.valueAt(0)
     where.Rotation=FreeCAD.Rotation(FreeCAD.Vector(0,0,1),edge.tangentAt(0))
     # obj=fCmd.edgeName[0] #TARGET [working]: make "where" deal with App::Parts
     # if fCmd.isPartOfPart(obj):
       # part=fCmd.isPartOfPart(obj)
       # where=part.Placement.multiply(where)
     size=[edge.Length/20.0,edge.Length/10.0,edge.Length/20.0]
     self.arrow=arrow(pl=where,scale=size,offset=edge.Length/2.0)
     FreeCADGui.Selection.clearSelection()