乐筑天下

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

[编程交流] From dtext to a z-position

[复制链接]

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 15:15:15 | 显示全部楼层 |阅读模式
Greetings,
 
I am designing a road for my final school project and I just received a height map. The problem is, is that the heights are dtext's and I need to create points with the height written in the texts. I would add them manually but there are about 30.000 texts so that's not a realistic option.
 
So my question is; is there a way to automatically create points at the origin of the dtexts, where the z-value of the points comes from the texts-content and the x and y-value comes from text's geometry?
 
Some extra info:
- The origins of the texts are 5 units apart in both x and y-directions.
- I'm using AutoCAD 2008.
 
  Thanks a lot.
回复

使用道具 举报

8

主题

1133

帖子

1164

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 15:22:10 | 显示全部楼层
The quick answer is yes, this could be done using Lisp.
 
The slow answer is that you would have to get the attention of someone who could write this Lisp - possibly post a thread in that section of the Forum
回复

使用道具 举报

14

主题

719

帖子

706

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-6 15:28:36 | 显示全部楼层
Eldon's right, at least I think he's right, you'll probably need a lisp to get this done - so I moved your thread to the Lisp-part of the forum in the hopes you'll get faster help here
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 15:35:33 | 显示全部楼层
Thanks for the replies.
 
If it's that much work I'll use the macro I created, I don't want to put someone else through that much trouble. It took me three hours to make the macro and it takes 2 second per text but I'll just have to let it run all night  I was just hoping there was some secret command/function I wasn't aware of to speed things up incase I have to do this again in the future.
 
PS, if someone wants to make it I wont object
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:38:07 | 显示全部楼层
A LISP for this shouldn't be too hard - one question - does the text items only contain the z-value and no other text? Also, are we talking only DTEXT, or MTEXT also?
 
Also - I can create a LISP in which the user will select the text manually - (using a selection set). - or, if all the heights are on the same layer, or if they are the only text (or DTEXT)  in the drawing, then I can set the LISP to automatically do the selecting for you. -- For this to happen the text needs some "defining" factor, so a filter list can be created. - i.e. on own layer, or the only DTEXT, or have their own colour etc etc.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:43:29 | 显示全部楼层
Also, what layer do you want these "Points" to be on? - and I assume they are just standard ACAD Points.
 
So, if I am correct, you want to use the base points of the text for the x,y and the contents of the text for the z?
 
Thanks
 
Lee
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 15:50:22 | 显示全部楼层
To answer your question:
  

  • Yes, the text only contains      the height value, e.g.: "129.30"
  • All off them are dtext, no      mtexts.
  • The file only contains the      texts and they are all the same layer/color. The layer is "49"      and the color is "12", which is a redish color.
  

  • The points can be on any      layer, I'll just move them if need be.
  • They are just regular AutoCAD      points.
  • "You want to use the      base points of the text for the x,y and the contents of the text for the      z?"

Thanks for the help
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:55:41 | 显示全部楼层
OK, try this:
 
  1. (defun c:zht (/ varlist oldvars ss eLst bPt zVal nbPt ptLst) (vl-load-com) (setq varlist (list "CMDECHO" "OSMODE")   oldvars (mapcar 'getvar varlist)) (mapcar 'setvar varlist (list 0 0)) (if (setq ss (ssget "X" '((0 . "TEXT")(8 . "49")(62 . "12"))))   (progn     (setq eLst (vl-remove-if 'listp          (mapcar 'cadr (ssnamex ss))))     (foreach e eLst   (setq bPt (cdr (assoc 10 (entget e)))         zVal (atof (cdr (assoc 1 (entget e))))         nbPt (subst zVal (last bPt) bPt)         ptLst (cons nbPt ptLst)))     (foreach pt ptLst   (command "_point" pt)))   (princ "\n No Text Found ")) (mapcar 'setvar varlist oldvars) (princ))
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 16:01:40 | 显示全部楼层
Sweet, worked like a charm
 
Here are the points loaded in some program I Googled:
 
161519jtde9d896xe94yqp.jpg
 
Thanks alot!!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 16:04:44 | 显示全部楼层
No Probs VeryName, glad it worked for you
 
Let me know if you have any more questions
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 19:27 , Processed in 0.653011 second(s), 74 queries .

© 2020-2025 乐筑天下

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