Exemplo n.º 1
0
 def getSubVolume(self, base, width, delta=None):
     "returns a subvolume from a base object"
     import Part
     max_length = 0
     for w in base.Shape.Wires:
         if w.BoundBox.DiagonalLength > max_length:
             max_length = w.BoundBox.DiagonalLength
             f = w
     f = Part.Face(f)
     n = f.normalAt(0, 0)
     v1 = fcvec.scaleTo(n, width)
     f.translate(v1)
     v2 = fcvec.neg(v1)
     v2 = fcvec.scale(v1, -2)
     f = f.extrude(v2)
     if delta:
         f.translate(delta)
     return f
Exemplo n.º 2
0
 def getSubVolume(self,base,width,delta=None):
     "returns a subvolume from a base object"
     import Part
     max_length = 0
     for w in base.Shape.Wires:
         if w.BoundBox.DiagonalLength > max_length:
             max_length = w.BoundBox.DiagonalLength
             f = w
     f = Part.Face(f)
     n = f.normalAt(0,0)
     v1 = fcvec.scaleTo(n,width)
     f.translate(v1)
     v2 = fcvec.neg(v1)
     v2 = fcvec.scale(v1,-2)
     f = f.extrude(v2)
     if delta:
         f.translate(delta)
     return f
Exemplo n.º 3
0
 def update(self,line=None,normal=None):
     import WorkingPlane
     from draftlibs import fcgeo
     if not normal:
         normal = FreeCAD.DraftWorkingPlane.axis
     if line:
         if isinstance(line,list):
             bp = line[0]
             lvec = line[1].sub(line[0])
         else:
             lvec = fcgeo.vec(line.Shape.Edges[0])
             bp = line.Shape.Edges[0].Vertexes[0].Point
     elif self.baseline:
         lvec = fcgeo.vec(self.baseline.Shape.Edges[0])
         bp = self.baseline.Shape.Edges[0].Vertexes[0].Point
     else:
         return
     right = lvec.cross(normal)
     self.cube.width.setValue(lvec.Length)
     p = WorkingPlane.getPlacementFromPoints([bp,bp.add(lvec),bp.add(right)])
     self.trans.rotation.setValue(p.Rotation.Q)
     bp = bp.add(fcvec.scale(lvec,0.5))
     bp = bp.add(fcvec.scaleTo(normal,self.cube.depth.getValue()/2))
     self.pos(bp)
Exemplo n.º 4
0
 def getGlobalCoords(self, point):
     "returns the global coordinates of the given point, taken relatively to this working plane"
     vx = fcvec.scale(self.u, point.x)
     vy = fcvec.scale(self.v, point.y)
     vz = fcvec.scale(self.axis, point.z)
     return (vx.add(vy)).add(vz)
Exemplo n.º 5
0
 def getGlobalCoords(self,point):
         "returns the global coordinates of the given point, taken relatively to this working plane"
         vx = fcvec.scale(self.u,point.x)
         vy = fcvec.scale(self.v,point.y)
         vz = fcvec.scale(self.axis,point.z)
         return (vx.add(vy)).add(vz)