乐筑天下

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

identify parallel lines

[复制链接]

238

主题

769

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1721
发表于 2017-7-12 08:55:38 | 显示全部楼层 |阅读模式
Any way to identify from a selection of lines or polylines which ones are parallel to the one you select? I really do not feel like redrawing something if I already know which ones are ok. Thanks for the help!
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2017-7-12 09:09:13 | 显示全部楼层
Lots of info on this site.
http://www.theswamp.org/index.php?topic=23170.msg281630#msg281630
回复

使用道具 举报

238

主题

769

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1721
发表于 2017-7-12 09:10:40 | 显示全部楼层
Thanks CAB, ill check it out.
回复

使用道具 举报

16

主题

506

帖子

6

银币

中流砥柱

Rank: 25

铜币
570
发表于 2017-7-17 16:40:37 | 显示全部楼层
If the lines are reduced to unit vectors they should be directly comparable (with a bit of fuzz).
回复

使用道具 举报

238

主题

769

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1721
发表于 2017-7-17 17:00:18 | 显示全部楼层
I kind of had to redraw it. But this is what I was looking at. We received an site plan from the architect. I wanted to make sure that the parking stalls were parallel with the building. So by selecting a line it would then high light all the lines that are parallel with it.
回复

使用道具 举报

238

主题

769

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1721
发表于 2017-8-14 12:59:45 | 显示全部楼层
hate to do this... I still cannot figure this out. I looked through the link CAB provided. I thought I could get it figured out.   Apparently not.
回复

使用道具 举报

85

主题

404

帖子

7

银币

中流砥柱

Rank: 25

铜币
751
发表于 2017-8-14 13:10:58 | 显示全部楼层
Basic approach will be to pick a line and get its slope, call it m.
Then select all lines/polylines in the drawing and iterate through them. You'll probably want to filter out for polylines that only have 2 vertices.
check the slope of each line, call it m2
if((m2.isclose(m)) or (m2.isclose(m+PI))) then the line/polyline is parallel if it's parallel, highlight it.
You can also find the slope of a line by getting the (change in Y)/(change in X) between the endpoints.
Edit: You'll also need to check for a vertical line, which has an undefined slope (change in x = 0).
Not sure what language you're hoping to work in, but that's the basic idea. I've no idea how to do this without code.
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2017-8-14 15:12:31 | 显示全部楼层
Here's a quick one ..
  1. (defun c:foo (/ _foo e i s)
  2.   (defun _foo (e) (rem (angle (vlax-curve-getstartpoint e) (vlax-curve-getendpoint e)) pi))
  3.   (if (and (setq e (car (entsel "\nPick line to set angle: ")))
  4.            (wcmatch (cdr (assoc 0 (entget e))) "LINE,*POLYLINE")
  5.            (setq i (_foo e))
  6.            (setq s (ssget "_X"
  7.                           '((-4 . "
  8.                             (0 . "line")
  9.                             (-4 . "
  10.                             (0 . "*polyline")
  11.                             (90 . 2)
  12.                             (-4 . "AND>")
  13.                             (-4 . "OR>")
  14.                            )
  15.                    )
  16.            )
  17.       )
  18.     (progn (foreach pl (mapcar 'cadr (ssnamex s))
  19.              (if (not (equal (_foo pl) i 1e-3))
  20.                (ssdel pl s)
  21.              )
  22.            )
  23.            (sssetfirst nil s)
  24.     )
  25.   )
  26.   (princ)
  27. )
回复

使用道具 举报

238

主题

769

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1721
发表于 2017-8-14 15:37:25 | 显示全部楼层
saving the day once again! I didn't even think slope. Thank you
回复

使用道具 举报

58

主题

3353

帖子

33

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1761
发表于 2017-8-14 16:02:06 | 显示全部楼层
Glad to help
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 17:47 , Processed in 0.775929 second(s), 83 queries .

© 2020-2025 乐筑天下

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