Python Part.makeSphere() Examples
The following are 7
code examples of Part.makeSphere().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Part
, or try the search function
.
Example #1
Source File: pipeFeatures.py From flamingo with GNU Lesser General Public License v3.0 | 6 votes |
def execute(self, fp): if fp.thk>fp.OD/2: fp.thk=fp.OD/2.1 fp.ID=fp.OD-2*fp.thk fp.Profile=str(fp.OD)+"x"+str(fp.thk) D=float(fp.OD) s=float(fp.thk) sfera=Part.makeSphere(0.8*D,FreeCAD.Vector(0,0,-(0.55*D-6*s))) cilindro=Part.makeCylinder(D/2,D*1.7,FreeCAD.Vector(0,0,-(0.55*D-6*s+1)),FreeCAD.Vector(0,0,1)) common=sfera.common(cilindro) fil=common.makeFillet(D/6.5,common.Edges) cut=fil.cut(Part.makeCylinder(D*1.1,D*2,FreeCAD.Vector(0,0,0),FreeCAD.Vector(0,0,-1))) cap=cut.makeThickness([f for f in cut.Faces if type(f.Surface)==Part.Plane],-s,1.e-3) fp.Shape = cap fp.Ports=[FreeCAD.Vector()] super(Cap,self).execute(fp) # perform common operations
Example #2
Source File: friki.py From videoblog with GNU General Public License v2.0 | 6 votes |
def vectorz(l = 10, l_arrow = 4, d = 1, mark = False, show = True): """Draw a vector in the z axis. Parameters: l : Lenght l_arrow: arrow length d : vector diameter """ #-- Correct the length if (l < l_arrow): l_arrow = l/2 vectz = Part.makeCylinder(d / 2.0, l - l_arrow) base = Part.makeSphere(d / 2.0) arrow = Part.makeCone(d/2 + 1, 0.2, l_arrow) arrow.Placement.Base.z = l - l_arrow #-- Create the union of all the parts union = vectz.fuse(base) union = union.fuse(arrow) #-- Return de vector z return union
Example #3
Source File: pipeFeatures.py From flamingo with GNU Lesser General Public License v3.0 | 5 votes |
def execute(self, fp): c=Part.makeCone(fp.OD/2,fp.OD/5,fp.Height/2) v=c.fuse(c.mirror(FreeCAD.Vector(0,0,fp.Height/2),FreeCAD.Vector(0,0,1))) if fp.PRating.find('ball')+1 or fp.PRating.find('globe')+1: r=min(fp.Height*0.45,fp.OD/2) v=v.fuse(Part.makeSphere(r,FreeCAD.Vector(0,0,fp.Height/2))) fp.Shape = v fp.Ports=[FreeCAD.Vector(),FreeCAD.Vector(0,0,float(fp.Height))] super(Valve,self).execute(fp) # perform common operations
Example #4
Source File: a2plib.py From A2plus with GNU Lesser General Public License v2.1 | 5 votes |
def drawSphere(center, color): doc = FreeCAD.ActiveDocument s = Part.makeSphere(2.0,center) sphere = doc.addObject("Part::Feature","Sphere") sphere.Shape = s sphere.ViewObject.ShapeColor = color doc.recompute() #------------------------------------------------------------------------------
Example #5
Source File: shapes.py From cadquery-freecad-module with GNU Lesser General Public License v3.0 | 5 votes |
def makeSphere(cls, radius, pnt=None, dir=None, angleDegrees1=None, angleDegrees2=None, angleDegrees3=None): """ Make a sphere with a given radius By default pnt=Vector(0,0,0), dir=Vector(0,0,1), angle1=0, angle2=90 and angle3=360 """ return Shape.cast(FreeCADPart.makeSphere(radius, pnt.wrapped, dir.wrapped, angleDegrees1, angleDegrees2, angleDegrees3))
Example #6
Source File: friki.py From videoblog with GNU General Public License v2.0 | 5 votes |
def point(x, y = None, z = None, d = 1.0): #-- Function overloading. x is mandatory #-- the first argument is an App.Vector if y == None and z == None: v = x else: #-- The three components are given v = FreeCAD.Vector(x, y, z) #-- The point is a sphere pp = Part.makeSphere(d / 2.0) #-- Add the point to the current document doc = FreeCAD.ActiveDocument p = doc.addObject("Part::Compound","Point") #-- Set the shape p.Shape = pp #-- Set the placement p.Placement.Base = v p.ViewObject.DisplayMode = "Shaded" doc.recompute() return p
Example #7
Source File: crosspart.py From LCInterlocking with GNU Lesser General Public License v2.1 | 5 votes |
def is_inside(face, shape_to_test): normal = face.normalAt(0, 0) point = face.CenterOfMass + normal.normalize() * 0.1 sphere = Part.makeSphere(0.04, point) #Part.show(sphere) return sphere.common(shape_to_test).Volume > 0.00001