當前位置: 首頁>>代碼示例>>Python>>正文


Python Part.makeCone方法代碼示例

本文整理匯總了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 
開發者ID:tomate44,項目名稱:CurvesWB,代碼行數:20,代碼來源:paramVector.py

示例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 
開發者ID:oddtopus,項目名稱:flamingo,代碼行數:25,代碼來源:pipeFeatures.py

示例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 
開發者ID:Obijuan,項目名稱:videoblog,代碼行數:24,代碼來源:friki.py

示例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()
#------------------------------------------------------------------------------ 
開發者ID:kbwbe,項目名稱:A2plus,代碼行數:29,代碼來源:a2plib.py

示例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)) 
開發者ID:jmwright,項目名稱:cadquery-freecad-module,代碼行數:9,代碼來源:shapes.py


注:本文中的Part.makeCone方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。