本文整理匯總了Python中Part.makeSphere方法的典型用法代碼示例。如果您正苦於以下問題:Python Part.makeSphere方法的具體用法?Python Part.makeSphere怎麽用?Python Part.makeSphere使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Part
的用法示例。
在下文中一共展示了Part.makeSphere方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: execute
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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
示例2: vectorz
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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
示例3: drawSphere
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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()
#------------------------------------------------------------------------------
示例4: makeSphere
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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))
示例5: point
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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
示例6: is_inside
# 需要導入模塊: import Part [as 別名]
# 或者: from Part import makeSphere [as 別名]
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