乐筑天下

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

[编程交流] Help modify lisp - align text

[复制链接]

8

主题

27

帖子

19

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:01:21 | 显示全部楼层 |阅读模式
Hello all;
 
I have download a lisp which can calculate the slope
between two manhole invert level ie the upstream and
downstream level. Then , the slope was indicate on the
pipe line ie slope 1:xxx
 
But something missing (I think); the text is not align to
the pipeline and no flow direction indicate (ie arrow line
indicate flow from upstream to downstream)
 
Any help to modify this Lisp is appreciated.
 
Thanks in advance
mh.lsp
回复

使用道具 举报

3

主题

24

帖子

21

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 07:12:03 | 显示全部楼层
Here ... try this:
 

[code](defun c:mh (/ *error* acdoc ss1 ss2 l n str e)                                ; TharwaT 20. 04. 2011 (vl-load-com) (defun *error* (msg)   (or        (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")(princ (strcat "\n** Error: " msg " **"))   )   (princ) ) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-StartUndoMark acdoc) (if   (and     (setq ss1 (entsel "\n Upstream numerical Text :"))     (setq ss2 (entsel "\n Downstream numerical Text :"))     (setq l (entsel "\n Select Pipe Line :"))   )    (progn      (setq n (- (atof (cdr (assoc 1 (entget (car ss1)))))          (atof (cdr (assoc 1 (entget (car ss2)))))       )      )      (setq str (/        (distance (cdr (assoc 10 (setq e (entget (car l)))))                  (cdr (assoc 11 e))        )        n     )[color="red"] ang (angle (cdr (assoc 10 e))            (cdr (assoc 11 e))     )      )     [color="red"](if (> n 0) (setq dir (strcat "1:" (rtos str 2 3) " --->")) (setq dir (strcat "
回复

使用道具 举报

8

主题

27

帖子

19

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:18:31 | 显示全部楼层
Hello, thanks for the reply.
 
The arrow seems NOT quite correct in some cases; as the flow should
be flowing from the upstream (higher height) to
downstream (lower height). See drawing example.
 
Thanks.
mh1.dwg
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:23:16 | 显示全部楼层
easiest way is to use the existing texts angle [ss1]
 
  1. (Defun c:mh2 (/ ss1 ss2 l n str ang sp ep) (while (and   (setq ss1 (entsel "\n Upstream numerical Text :"))   (setq ss2 (entsel "\n Downstream numerical Text :"))   (setq l (entsel "\n Select Pipe Line :")) )   (setq n (- (atof (cdr (assoc 1 [color=blue](setq ss1[/color] (entget (car ss1))))))       (atof (cdr (assoc 1 (entget (car ss2)))))))   (setq  str (abs (/ (distance   [color=blue](setq sp[/color] (cdr (assoc 10 (setq e (entget (car l))))))   [color=blue](setq ep[/color] (cdr (assoc 11 e)))   )  n)))  [color=blue] (setq ang (if (> (distance (cdr (assoc 10 ss1)) ep)      (distance (cdr (assoc 10 ss1)) sp)) (angle ep sp)(angle sp ep)))[/color]   (entmakex     (list (cons 0 "TEXT")    (cons 10   (getpoint "\n Text Location:")    )    (cons 40 (getvar 'textsize))   [color=blue] (cons 50 ang)[/color]    (cons 1 (strcat "1:" (rtos str 2 0) "--->"))     )   ) ) (princ))
 
HTH
回复

使用道具 举报

8

主题

27

帖子

19

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:30:54 | 显示全部楼层
Hello pBE,
 
Not quite right, the "arrow" showing the flow is not parallel
to the pipeline; make it the annotation confusing. See the
example of drawings i attached.
 
Further help is very much grateful.
 
Thanks
mhdirn.dwg
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:40:01 | 显示全部楼层
i didn't actually see your drawing sample, i based my suggestion  solely on the code you posted. If the attached file is 2010 version or higher i wont be able to view it.
 
Anyhow....
 
Somebody will come along and "fix" it for you.
 
Cheers
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:42:53 | 显示全部楼层
Quick fix for you
  1. [/b] 
  2. I had one of my buddies to convert the file to a lower version
  3.  
  4. HTH
回复

使用道具 举报

8

主题

27

帖子

19

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 07:48:32 | 显示全部楼层
It is OK for me at a lower version;
so pBe........... can you help?
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 08:00:19 | 显示全部楼层
 
I updated the code on my previous post [#4]
回复

使用道具 举报

8

主题

27

帖子

19

银币

初来乍到

Rank: 1

铜币
40
发表于 2022-7-6 08:06:25 | 显示全部楼层
Oh......... I still can't get the flow
direction right?????
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 10:50 , Processed in 0.598064 second(s), 72 queries .

© 2020-2025 乐筑天下

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