CAD练习题22——利用len作指定长度的弧

题目:

https://github.com/longlongpicture/myblogpicture/raw/master/p22-12.PNG

这道题只需要注意一个地方,就是指定长度的弧怎么做。

1、先画明显的部分。

https://github.com/longlongpicture/myblogpicture/raw/master/p22-1.PNG

2、利用圆作两个对接的弧。

https://github.com/longlongpicture/myblogpicture/raw/master/p22-2.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-3.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-4.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-5.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-6.PNG

3、利用len作指定长度的弧。

https://github.com/longlongpicture/myblogpicture/raw/master/p22-7.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-8.PNG

4、利用类平行四边形、镜像画弧。

https://github.com/longlongpicture/myblogpicture/raw/master/p22-9.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-10.PNGhttps://github.com/longlongpicture/myblogpicture/raw/master/p22-11.PNG

5、清理图形

https://github.com/longlongpicture/myblogpicture/raw/master/p22-12.PNG

Python实现Excel列名和下标的相互转换

def getcolnum(colname):
    """
    列名转下标,0起
    :param colname:列名
    :return:下标
    """
    thesum = 0
    length = len(colname)
    loop = length - 1
    while loop >= 0:
        thesum = thesum + (ord(colname[length - loop - 1]) - ord('A') + 1) * (26 ** loop)
        loop = loop - 1
    return thesum - 1


def colnumgenerator():
    sourcevalue = 1
    while True:
        valuestr = ""
        remainlist = []
        value = sourcevalue
        while value:
            remain = value % 26
            value = value // 26
            if remain == 0:
                remainlist.append(26)
                value = value - 1
            else:
                remainlist.append(remain)
        remainlist.reverse()
        for rem in remainlist:
            valuestr = valuestr + chr(ord('A') + rem - 1)
        sourcevalue = sourcevalue + 1
        yield valuestr


def getcolname(colnum):
    """
    下标转列名,0起
    :param colnum:下标
    :return:列名
    """
    count = 0
    for i in colnumgenerator():
        count = count + 1
        if count == colnum + 1:
            return i

夜酌两首

其一

小楼独酌诗酒茶,当年何处后庭花。

孤星暗月空自许,秋千院落夜还家。

其二

此心憔悴不思量,望家长盼浣纱娘。

只言片语空度日,阁中犹挂嫁衣裳。