乐筑天下

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

[编程交流] Labeling polyline (elements fr

[复制链接]

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 17:52:38 | 显示全部楼层
Hi,
So the first line of text represents the length of the each segment of the polyline ? and the two lines of texts should be imported from the txt file ?
 
Since the last two lines of texts are the same, why don't we just add them immediately to the oncoming program without bothering users to select that txt file? unless you have different information for each process.
 
It is not a good way to write diameter symbol via ZERO number crossed with a line, you can just include these three chars like this %%C
 
Have a look at the following image for more information:
181851s5iawhbhbewiy1ii.jpg
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 17:55:31 | 显示全部楼层
What do you think about adding attributed block and place the block at the center of the two vertices as demonstrated in the following video?
 
http://giphy.com/gifs/l2SpMxoitccEAhV9S
回复

使用道具 举报

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 17:58:46 | 显示全部楼层
Tharwat,
 
I didn't understood question. First line, you probably meant column, or vertical line. Yes, first column is length of segment.
 
PVC SN8 is type of material and it is always the same (in 99%), 218 (fourth line) is diameter of pipe profile and it is different for each pipeline, last line is slope, and as you can see it is different for each pipeline (it even changes within one pipeline).
 
 
 
Solution you have presented in .gif is great, just missing "L=" prefix on length label. Can you explain me bit more, or walk me thru the process?
 
 
Thank you
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:00:33 | 显示全部楼层
Here is the draft codes for you to test and let me know what are the needed changes for a complete program.
 
NOTE: the following drawing has the Attributed Block entitled [ labeling Block ] and it should be in any drawing you want to run the program with.
Test.dwg
label.LSP
回复

使用道具 举报

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 18:03:30 | 显示全部楼层
This is good, only problem is slopes are constantly 0.6% (while in the file they vary between 1 and 0.6, on longer pipelines they can have tens of different values) and pipe profile radius is also constant (in this case it is constant all the way, because it's short example, but on longer lines it changes 2-3 times).  That is why I need text file for labelling.
 
This lisp you have attached will be very useful, as tertiary Network (more then hundred km's) will be done with constant slopes and pipe radiuses. I'm just going to need to be prompted for slope and radius which will be used, but I'll try to modify it by myself.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:07:39 | 显示全部楼层
Is the number 218 represents the radius ?
回复

使用道具 举报

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 18:10:48 | 显示全部楼层
Yes, in millimetres
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:12:40 | 显示全部楼层
Okay, were you able to modify the program or you need me to modify it for you?
回复

使用道具 举报

4

主题

19

帖子

15

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-5 18:17:29 | 显示全部楼层
To label from slopes and radiuses from text? No, I haven't.
 
I can use this lisp for tertiary network (as I mentioned), and that's great piece of work (more the a 1/3). I just need to be prompted for slope and radius input.
 
Still, for primary and secondary I need slopes and radiuses from file.
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 18:19:11 | 显示全部楼层
Keep the file aside at the mean time for the second job and let us finish your current project with that tertiary Network.
So if this tertiary work needs to change the radius & Slope value here is the final program, try it and let me know.
 
NOTE: I just changed the way to select polyline so with this program you can select as much of polylines as you want.
 

[code](defun c:Test (/ *error* s i e atts sp sty lay l p bk lst ang) ;; Tharwat - Date: 11.Aug.2016 ;; (defun *error* (msg)   (if atts     (mapcar 'setvar '(ATTREQ ATTDIA) atts)   )   (and msg        (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*"))        (princ (strcat "\nError => " msg))   )   (princ) ) (if   (and     (if (tblsearch "BLOCK" "Labeling Block")       t       (progn         (alert           "Attributed Block name  is not found in drawing !"         )         nil       )     )     (setq *LabRadii*            (cond              ((getint                 (strcat "\nSpecify radius "                         (if *LabRadii*                           (strcat " :")                           ":"                         )                 )               )              )              (*LabRadii*)            )     )     (setq *LabSlope*            (cond ((getreal                     (strcat                       "\nSpecify Slope "                       (if *LabSlope*                         (strcat " :")                         ":"                       )                     )                   )                  )                  (*LabSlope*)            )     )     (princ "\nSelect polylines to label :")     (setq s (ssget "_:L" '((0 . "POLYLINE"))))   )    (progn      (setq atts (mapcar 'getvar '(ATTREQ ATTDIA))            sp   (vlax-get (vla-get-activelayout                             (vla-get-activedocument (vlax-get-acad-object))                           )                           'Block                 )            sty  (if (tblsearch "STYLE" "tablicni")                   "tablicni"                   "Standard"                 )            lay  (if (tblsearch "LAYER" "FRONTOVI")                   "FRONTOVI"                   (getvar 'CLAYER)                 )      )      (mapcar 'setvar '(ATTREQ ATTDIA) '(1 0))      (repeat (setq i (sslength s))        (setq e (ssname s (setq i (1- i))))        (while (and (setq e (entnext e))                    (= "VERTEX" (cdr (assoc 0 (setq l (entget e)))))                    (setq lst (cons (cdr (assoc 10 l)) lst))               )        )        (repeat (1- (length lst))          (setq p  (mapcar '(lambda (j k) (/ (+ j k) 2.))                           (car lst)                           (cadr lst)                   )                ang (angle (car lst) (cadr lst))                bk (vla-insertblock                     sp                     (vlax-3d-point p)                     "Labeling Block"                     1.0                     1.0                     1.0                     (if (and (> ang (* pi 0.5)) (
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 07:53 , Processed in 0.567666 second(s), 84 queries .

© 2020-2025 乐筑天下

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