本文整理汇总了Python中Part.makeCone方法的典型用法代码示例。如果您正苦于以下问题:Python Part.makeCone方法的具体用法?Python Part.makeCone怎么用?Python Part.makeCone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.makeCone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeCone [as 别名]
def execute(self, obj):
debug("\n* paramVector : execute *\n")
if not hasattr(obj,"Origin"):
v0 = FreeCAD.Vector(0,0,0)
else:
v0 = obj.Origin
if not hasattr(obj,"Direction"):
v1 = FreeCAD.Vector(0,0,-10)
else:
v1 = obj.Direction.normalize().multiply(10)
v2 = v0.add(v1)
line = Part.Edge(Part.LineSegment(v0,v2))
cone = Part.makeCone(1,0,3,v2,v1,360)
circle = Part.makeCircle(10,v0,v1.negative())
face = Part.makeFace(circle,"Part::FaceMakerSimple")
comp = Part.Compound([line,cone,face])
obj.Shape = comp
obj.ViewObject.Transparency = 50
示例2: execute
# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeCone [as 别名]
def execute(self, fp):
base=Part.Face(Part.Wire(Part.makeCircle(fp.D/2)))
if fp.d>0:
base=base.cut(Part.Face(Part.Wire(Part.makeCircle(fp.d/2))))
if fp.n>0:
hole=Part.Face(Part.Wire(Part.makeCircle(fp.f/2,FreeCAD.Vector(fp.df/2,0,0),FreeCAD.Vector(0,0,1))))
hole.rotate(FreeCAD.Vector(0,0,0),FreeCAD.Vector(0,0,1),360.0/fp.n/2)
for i in list(range(fp.n)):
base=base.cut(hole)
hole.rotate(FreeCAD.Vector(0,0,0),FreeCAD.Vector(0,0,1),360.0/fp.n)
flange = base.extrude(FreeCAD.Vector(0,0,fp.t))
try: # Flange2: raised-face and welding-neck
if fp.trf>0 and fp.drf>0:
rf=Part.makeCylinder(fp.drf/2,fp.trf,vO,vZ*-1).cut(Part.makeCylinder(fp.d/2,fp.trf,vO,vZ*-1))
flange=flange.fuse(rf)
if fp.dwn>0 and fp.twn>0 and fp.ODp>0:
wn=Part.makeCone(fp.dwn/2,fp.ODp/2,fp.twn,vZ*float(fp.t)).cut(Part.makeCylinder(fp.d/2,fp.twn,vZ*float(fp.t)))
flange=flange.fuse(wn)
except:
pass
fp.Shape = flange
fp.Ports=[FreeCAD.Vector(),FreeCAD.Vector(0,0,float(fp.t))]
super(Flange,self).execute(fp) # perform common operations
示例3: vectorz
# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeCone [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
示例4: drawVector
# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeCone [as 别名]
def drawVector(fromPoint,toPoint, color):
if fromPoint == toPoint: return
doc = FreeCAD.ActiveDocument
l = Part.LineSegment()
l.StartPoint = fromPoint
l.EndPoint = toPoint
line = doc.addObject("Part::Feature","Line")
line.Shape = l.toShape()
line.ViewObject.LineColor = color
line.ViewObject.LineWidth = 1
c = Part.makeCone(0,1,4)
cone = doc.addObject("Part::Feature","ArrowHead")
cone.Shape = c
cone.ViewObject.ShapeColor = color
#
mov = Base.Vector(0,0,0)
zAxis = Base.Vector(0,0,-1)
rot = FreeCAD.Rotation(zAxis,toPoint.sub(fromPoint))
cent = Base.Vector(0,0,0)
conePlacement = FreeCAD.Placement(mov,rot,cent)
cone.Placement = conePlacement.multiply(cone.Placement)
cone.Placement.move(toPoint)
doc.recompute()
#------------------------------------------------------------------------------
示例5: makeCone
# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeCone [as 别名]
def makeCone(cls, radius1, radius2, height, pnt=Vector(0, 0, 0), dir=Vector(0, 0, 1), angleDegrees=360):
"""
Make a cone with given radii and height
By default pnt=Vector(0,0,0),
dir=Vector(0,0,1) and angle=360'
"""
return Shape.cast(FreeCADPart.makeCone(radius1, radius2, height, pnt.wrapped, dir.wrapped, angleDegrees))