Author Topic: identify parallel lines  (Read 308 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
identify parallel lines
« on: July 12, 2017, 08:55:38 am »
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!
Autodesk Infrastructure Design Suite 2017

CAB

  • Global Moderator
  • Seagull
  • Posts: 10222
Re: identify parallel lines
« Reply #1 on: July 12, 2017, 09:09:13 am »
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #2 on: July 12, 2017, 09:10:40 am »
Thanks CAB, ill check it out.
Autodesk Infrastructure Design Suite 2017

dgorsman

  • Water Moccasin
  • Posts: 2216
Re: identify parallel lines
« Reply #3 on: July 17, 2017, 04:40:37 pm »
If the lines are reduced to unit vectors they should be directly comparable (with a bit of fuzz).
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #4 on: July 17, 2017, 05:00:18 pm »
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.
Autodesk Infrastructure Design Suite 2017

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #5 on: August 14, 2017, 12:59:45 pm »
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.  :tickedoff: Apparently not.

Autodesk Infrastructure Design Suite 2017

Atook

  • Swamp Rat
  • Posts: 831
Re: identify parallel lines
« Reply #6 on: August 14, 2017, 01:10:58 pm »
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. :)
« Last Edit: August 14, 2017, 01:20:53 pm by Atook »

ronjonp

  • Needs a day job
  • Posts: 6312
Re: identify parallel lines
« Reply #7 on: August 14, 2017, 03:12:31 pm »
Here's a quick one ..

Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ _foo e i s)
  2.  (if (and (setq e (car (entsel "\nPick line to set angle: ")))
  3.   (wcmatch (cdr (assoc 0 (entget e))) "LINE,*POLYLINE")
  4.   (setq i (_foo e))
  5.   (setq s (ssget "_X"
  6.  '((-4 . "<OR")
  7.    (0 . "line")
  8.    (-4 . "<AND")
  9.    (0 . "*polyline")
  10.    (90 . 2)
  11.    (-4 . "AND>")
  12.    (-4 . "OR>")
  13.   )
  14.   )
  15.   )
  16.      )
  17.    (progn (foreach pl (mapcar 'cadr (ssnamex s))
  18.     (if (not (equal (_foo pl) i 1e-3))
  19.       (ssdel pl s)
  20.     )
  21.   )
  22.   (sssetfirst nil s)
  23.    )
  24.  )
  25.  (princ)
  26. )
« Last Edit: August 18, 2017, 09:39:38 am by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #8 on: August 14, 2017, 03:37:25 pm »
saving the day once again! I didn't even think slope. Thank you  :whistling:
Autodesk Infrastructure Design Suite 2017

ronjonp

  • Needs a day job
  • Posts: 6312
Re: identify parallel lines
« Reply #9 on: August 14, 2017, 04:02:06 pm »
saving the day once again! I didn't even think slope. Thank you  :whistling:
Glad to help :)

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #10 on: August 14, 2017, 04:07:03 pm »


BTW how's your day job going?
Autodesk Infrastructure Design Suite 2017

ronjonp

  • Needs a day job
  • Posts: 6312
Re: identify parallel lines
« Reply #11 on: August 14, 2017, 04:11:27 pm »

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

MSTG007

  • Water Moccasin
  • Posts: 2008
  • I can't remeber what I already asked! I need help!
Re: identify parallel lines
« Reply #12 on: August 14, 2017, 04:14:55 pm »
lol. Not sure how to respond to that one. That is one LARGE ninja.
Autodesk Infrastructure Design Suite 2017

Bryco

  • Water Moccasin
  • Posts: 1806
Re: identify parallel lines
« Reply #13 on: August 17, 2017, 11:25:07 pm »
quickselect  can also tell you this.
r-click in empty part of drawing ->Quickselect->object type->line->angle->value= 90->ok
works like a charm

ronjonp

  • Needs a day job
  • Posts: 6312
Re: identify parallel lines
« Reply #14 on: August 18, 2017, 09:20:03 am »
quickselect  can also tell you this.
r-click in empty part of drawing ->Quickselect->object type->line->angle->value= 90->ok
works like a charm
This is another way, but only works with lines. The code above will work with plines too :)

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC