当前位置: 首页>>代码示例>>Python>>正文


Python Part.makeWireString方法代码示例

本文整理汇总了Python中Part.makeWireString方法的典型用法代码示例。如果您正苦于以下问题:Python Part.makeWireString方法的具体用法?Python Part.makeWireString怎么用?Python Part.makeWireString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part.makeWireString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: text

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeWireString [as 别名]
def text (string, fontFile='/usr/share/fonts/TTF/FreeMono.ttf', height=100, returnWires = False):
    """returns a list of faces corresponding to each character in a string that trace text letters
    maybe the default fontdir and font variables have only been tested in Arch Linux"""
    wires = Part.makeWireString(string, fontFile, height)
    if returnWires:
        # flat_wires = []
        # for letter in wires:
        #    for wire in letter:
        #        flat_wires.append(wire)
            
        flat_wires = [item for sublist in wires for item in sublist]
        return flat_wires
    else:
        faces = []
        for letter in wires:
            faces.append(Part.Face(letter))
    
        return faces
开发者ID:AFMD,项目名称:python2-ezFreeCAD,代码行数:20,代码来源:__init__.py

示例2: execute

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeWireString [as 别名]
 def execute(self, obj):
     import Part
     pl = obj.Placement
     if obj.Width.Value and obj.Height.Value:
         l2 = obj.Width.Value/2
         w2 = obj.Height.Value/2
         v1 = Vector(-l2,-w2,0)
         v2 = Vector(l2,-w2,0)
         v3 = Vector(l2,w2,0)
         v4 = Vector(-l2,w2,0)
         base = Part.makePolygon([v1,v2,v3,v4,v1])
         self.sheetborder = base
         wires = []
         area = obj.Width.Value * obj.Height.Value
         subarea = 0
         for v in obj.Group:
             if v.isDerivedFrom("Part::Feature"):
                 wires.extend(v.Shape.Wires)
                 if Draft.getType(v) == "PanelCut":
                     if v.Source:
                         subarea += v.Source.Area.Value
                 else:
                     for w in v.Shape.Wires:
                         if w.isClosed():
                             f = Part.Face(w)
                             subarea += f.Area
         if wires:
             base = Part.Compound([base]+wires)
         if obj.FontFile and obj.TagText and obj.TagSize.Value:
             chars = []
             for char in Part.makeWireString(obj.TagText,obj.FontFile,obj.TagSize.Value,0):
                 chars.extend(char)
             textshape = Part.Compound(chars)
             textshape.translate(obj.TagPosition)
             textshape.rotate(textshape.BoundBox.Center,Vector(0,0,1),obj.TagRotation.Value)
             self.sheettag = textshape
             base = Part.Compound([base,textshape])
         obj.Shape = base
         obj.Placement = pl
         obj.FillRatio = int((subarea/area)*100)
开发者ID:abdullahtahiriyo,项目名称:FreeCAD_sf_master,代码行数:42,代码来源:ArchPanel.py

示例3: len

# 需要导入模块: import Part [as 别名]
# 或者: from Part import makeWireString [as 别名]
#String = 'AVWAIXA.V'                                 # kerning 
String = 'FreeCAD'                                    # ASCII  

#FontPath = '/usr/share/fonts/truetype/msttcorefonts/' 
#FontName = 'Times_New_Roman_Italic.ttf'                  
FontPath = '/usr/share/fonts/truetype/msttcorefonts/'
FontName = 'Arial.ttf'                                   
#FontName = 'NOTArial.ttf'                             # font file not found error
#FontPath = '/usr/share/fonts/truetype/msttcorefonts/' 
#FontName = 'ariali.ttf'                              #symlink to ttf
#FontPath = '/usr/share/fonts/truetype/' 
#FontName = 'Peterbuilt.ttf'                          # overlapping script font
#FontPath = '/usr/share/fonts/truetype/' 
#FontName = 'dyspepsia.ttf'                           # overlapping script font  # :)

Height  = 2000                                        # out string height FCunits
Track = 0                                             # intercharacter spacing
 
print "testWire.py input String contains ", len(String), " characters."
  
s = Part.makeWireString(String,FontPath,FontName,Height,Track)                

print "returned from makeWireString"
print "testWire.py output contains ", len(s), " WireChars."

for char in s:
    for contour in char:
        Part.show(contour)
        
print "testWire ended."
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:32,代码来源:testmakeWireString.py


注:本文中的Part.makeWireString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。