乐筑天下

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

[编程交流] Extracting X,Y, coordinates wi

[复制链接]

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:36:24 | 显示全部楼层
Dont give up that easy
 
Have a look at this similar problem with solution http://www.cadtutor.net/forum/showthread.php?78109-Block-by-windowing-lisp
 
What I was saying is your asking 2 questions needs 2 different answers.
 
Also pretty sure handles are unique so no 2 would be alike so can not find object in 2nd dwg.
 
Also its about time this is a free forum so we still have to work and play. I would have done it for you but I am busy, I do repsonses in my lunch time not company time.
回复

使用道具 举报

1

主题

11

帖子

10

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:40:44 | 显示全部楼层
Hi BigAl,
Thanks again for your comment.
What i would probably do with text that currently sits outside the polygons is move them inside. That will make things a lot quicker than trying to write two pieces of code!
 
I appreciate that the forum is free and i don't expect people to give-up hours of their free time to right a code for someone that is a newbie to the forum.
 
I am greatful for your input, it has helped. I will persist a bit longer with finding an online manual to help me wite this code.
 
Thanks
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:45:18 | 显示全部楼层
I have made a start this pulls co-ords from pline very simple method and then allows ssget to find text it needs some debugging but a start next will be to create a loop for all plines selected.
 
  1. (defun getcoords (ent) (vlax-safearray->list   (vlax-variant-value     (vlax-get-property   (vlax-ename->vla-object ent)   "Coordinates"     )   ) ))(defun co-ords2xy (); convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z(setq numb (/ (length co-ords) 2))(setq I 0)(repeat numb(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))(setq co-ordsxy (cons xy co-ordsxy)))); program starts here(setq co-ords (getcoords (car (entsel "\nplease pick pline"))))(co-ords2xy)(setq ss (ssget "WP" co-ordsxy (list (cons 0 "*text")))) ; selection set of text within polygon
回复

使用道具 举报

1

主题

11

帖子

10

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:45:51 | 显示全部楼层
Hi BigAl,
I am working my way through this tutorial http://www.afralisp.net/autolisp/tutorials/the-basics-part-1.php
 
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:50:48 | 显示全部楼层
Fixed a mistake in code
回复

使用道具 举报

1

主题

11

帖子

10

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 16:52:09 | 显示全部楼层
I have tried your code on the dwg file i attached at the start of this thread. It doesn't seem to pick up any of the polygons.
On a positive note though i am working my way through the online tutorial and so i am starting to pick up and understand the odd bits of text
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 16:57:04 | 显示全部楼层
I will check it and if I have time add the missing do all plines.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:00:18 | 显示全部楼层
an upgrade still work in progress a bit busy right now
 
  1. (defun getcoords (ent) (vlax-safearray->list   (vlax-variant-value     (vlax-get-property   (vlax-ename->vla-object ent)   "Coordinates"     )   ) ))(defun co-ords2xy (/ xy); convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z(setq numb (/ (length co-ords) 2))(setq I 0)(repeat numb(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))(setq co-ordsxy (cons xy co-ordsxy))(setq I (+ I 2)))); program starts here(setq plist (ssget (list (cons 0 "lwpolyline"))))(setq numb (sslength plist))(setq J 0)(repeat numb(setq co-ords (getcoords (ssname plist J)))(co-ords2xy)(setq ss (ssget "WP" co-ordsxy (list (cons 0 "*text")))) ; selection set of text within polygon(princ (sslength ss)) ; this is howmany texts etc (setq co-ordsxy nil)(setq J (+ J 1))(setq ss nil)) ; end repeat
回复

使用道具 举报

1

主题

11

帖子

10

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 17:02:32 | 显示全部楼层
I am over the moon that you are helping me with this Big Al.
I have run the lisp and it is now picking up multiple polygons :-)
 
Thank you
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:05:53 | 显示全部楼层
What are you trying to achieve in terms of output a simple TXT file or excel or a CSV
 
pline1 xy xy xy xy
text1 abcde
text2 addd
pline2 xy xy xy xy
text3 jjjj
pline4 and so on ?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 21:18 , Processed in 0.766751 second(s), 70 queries .

© 2020-2025 乐筑天下

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