quickjoint.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:QuickJoint 作者: JarrettR 项目源码 文件源码
def draw_slots(self, path):
        #Female slot creation

        start = self.to_complex(path[0][1])
        end = self.to_complex(path[1][1])

        if self.edgefeatures == False:
            segCount = (self.numslots * 2) 
        else:
            segCount = (self.numslots * 2) - 1

        distance = end - start
        debugMsg(distance)
        debugMsg("segCount - " + str(segCount))

        try:
            if self.edgefeatures:
                segLength = self.get_length(distance) / segCount
            else:
                segLength = self.get_length(distance) / (segCount + 1)
        except:
            segLength = self.get_length(distance)

        debugMsg("segLength - " + str(segLength))
        newLines = []

        line_style = simplestyle.formatStyle({ 'stroke': '#000000', 'fill': 'none', 'stroke-width': str(self.unittouu('1px')) })

        for i in range(segCount):
            if (self.edgefeatures and (i % 2) == 0) or (not self.edgefeatures and (i % 2)):
                newLines = self.draw_box(start, distance, segLength, self.thickness, self.kerf)
                debugMsg(newLines)

                slot_id = self.uniqueId('slot')
                g = inkex.etree.SubElement(self.current_layer, 'g', {'id':slot_id})

                line_atts = { 'style':line_style, 'id':slot_id+'-inner-close-tab', 'd':simplepath.formatPath(newLines) }
                inkex.etree.SubElement(g, inkex.addNS('path','svg'), line_atts )

            #Find next point
            polR, polPhi = cmath.polar(distance)
            polR = segLength
            start = cmath.rect(polR, polPhi) + start
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号