- 积分
- 1905
- 明经币
- 个
- 注册时间
- 2022-4-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 枫叶棋语 于 2022-4-12 16:22 编辑
# -*- coding: utf-8 -*
from pycad.system import *
from pycad.runtime import *
import clr, System
clr.ImportExtensions(System.Linq)
clr.AddReference('System.Windows.Forms')
from System.Windows.Forms import Clipboard
@command()
def wq(doc):
#竖向复制文字
with dbtrans(doc) as tr:
str=""
i= 0
ss=edx.ssget(mode=':A',filters=(0,'*text'))
if (not ss.ok)and(len(ss.value)):return
texts=(
ss.Cast[acdb.ObjectId]()
.Select(lambda i: tr.getobject(i))
.OrderBy(lambda t: t.Position.X))
strlen=len(list(texts))
for text in texts:
i=1+i
if i !=strlen :
str=str+text.TextString+"\n"
else:str=str+text.TextString
Clipboard.Clear()
Clipboard.SetText(str)
@command()
def we(doc):
#横向复制文字
with dbtrans(doc) as tr:
str=""
i= 0
ss=edx.ssget(mode=':A',filters=(0,'*text'))
if (not ss.ok)and(len(ss.value)):return
texts=(
ss.Cast[acdb.ObjectId]()
.Select(lambda i: tr.getobject(i))
.OrderBy(lambda t: t.Position.Y))
list1=list(texts)
list1.reverse()
strlen=len(list1)
for text in list1:
i=1+i
if i !=strlen :
str=str+text.TextString+"\n"
else:str=str+text.TextString
Clipboard.Clear()
Clipboard.SetText(str)
|
|