乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 86|回复: 4

堆叠多行文字

[复制链接]

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2017-8-18 21:48:18 | 显示全部楼层 |阅读模式
尝试适当地重新打包某些文本。我试过几种不同的方法,但都失败了。见下文。首先检查第一个文本项中是否有“2”,然后检查位置是否正确。X是第二个文本的位置,然后交换它们。尝试了一些不同的检查,除了文本处于奇怪的角度外,这些检查在大多数情况下都有效
私有void swaptext()
{
使用(help.AcadDocumentLock)
{
使用(var t=help.StartTransaction)
{
试试
{
多行文字tx1=(多行文字)ID[0]。获取对象(OpenMode.ForRead)
MText tx2=(MText)id[1].GetObject(OpenMode.ForRead)
字符串cont1=tx1.Contents
字符串cont2=tx2.Contents
点3d pos1=tx1.位置
Point3d pos2=tx2.位置
if((tx1.Contents.Contains(“两”)&&(pos1.X
{
tx1.UpgradeOpen()
tx2.UpgradeOpen()
tx1.Contents=cont2
tx2.Contents=cont1
}
else if((tx2.Contents.Contains(“两”)&&(pos2.X
{
tx1.UpgradeOpen()
tx2.UpgradeOpen()
tx1.Contents=cont2
tx2.Contents=cont1
}
else if((tx1.Contents.Contains(“两”)&&(pos1.Y>pos2.Y))
{
tx1.UpgradeOpen()
tx2.UpgradeOpen()
tx1.Contents=cont2
tx2.Contents=cont1
}
else if((tx2.Contents.Contains(“两”)&&(pos2.Y>pos1.Y))
{
tx1.UpgradeOpen()
tx2.UpgradeOpen()
tx1.Contents=cont2
tx2.Contents=cont1
}
ids.Clear()
}
caTWOh(System.Exception.ex)
{
help.AcadDocument.Editor。WriteMessage(“错误:==>\n{0}\n路径:===>\n}1}”,例如Message,例如StackTrace)
}
t.Commit()
}
}
}
-修改代码以匹配最接近的工作解决方案

swxjuf4h4f3.png

swxjuf4h4f3.png

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2017-8-18 22:01:32 | 显示全部楼层
实际上,我为这篇文章制作的图形给了我一些想法......我认为如果我检查从第一个字符串位置到第二个字符串的角度不是在第一个180度可能会起作用
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2017-8-18 22:24:15 | 显示全部楼层
哦...再次躲避我任何帮助,不胜感激。谢谢!公共静态双角度fromxpos(Point3d pt1,Point3d pt2)。
{。
协调系统3d=Application.DocumentManager.MdiActiveDocument.Editor.CurrentUserCoordinateSystem.CoordinateSystem3d;。
平面平面=新平面(systemd.Origin,systemd.Xaxis,systemd.Yaxis);。
Vector3d vectord=(Vector3d)(pt2-pt1);。
返回vectord.AngleOnPlane(平面);。
}。


私有无效交换文本()。
{。
使用(help.AcadDocumentLock)。
{。
使用(var t=help.StartTransaction)。
{。
尝试。
{。
MTexttx1=(MText1)id[0]. GetObject(OpenMode.ForRead);。
MTexttx2=(MText2)id[1]. GetObject(OpenMode.ForRead);。
字符串conts1=tx1.Contents;。
字符串conts2=tx2.Contents;。

Point3d pos1=tx1.Location;。
Point3d pos2=tx2.Location;。

if((tx1.Contents.Contains("TWO")) && (anglefromxpos(pos1, pos2)pos2. Y))。
{。
tx1.Contents=conts2;。
tx2.Contents=conts1;。
}。

if((tx2.Contents.Contains("TWO")) && (anglefromxpos(pos2, pos1)pos1. Y))。
{。
tx2.Contents=conts1;。
tx1.Contents=conts2;。
}。


ids.Clear();。
}。
捕获(System.Exceptionex)。
{。
help.AcadDocument.Editor.WriteMessage("Error:==>\n{0}\nTrace:==>\n{1}",ex.Message,ex.StackTrace);。
}。
t.Commit();。
}。
}。
}。


回复

使用道具 举报

170

主题

1424

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2119
发表于 2017-8-19 11:42:59 | 显示全部楼层
anglefromxpos(pos1,pos2)-tx1.rotation  pos2.Y))等,也许我错过了一些东西
回复

使用道具 举报

129

主题

422

帖子

5

银币

中流砥柱

Rank: 25

铜币
936
发表于 2017-8-19 15:13:46 | 显示全部楼层
我知道这是lisp,但会根据需要对两行进行排序,这样就可以使用当前文本交换文本,即使多行文字只是剥离到多行。
  1. (setq lst (list "this is line two" "this is line one"))
  2. Command: (setq lst (VL-SORT lst '(lambda (a b) (> a b))))
  3. ("this is line two" "this is line one")
  4. Command: (setq lst (VL-SORT lst '(lambda (a b) (< a b))))
  5. ("this is line one" "this is line two")
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-2-4 12:49 , Processed in 0.192369 second(s), 65 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表