本文整理汇总了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