Author Topic: Slide Objects Along a Polyline  (Read 5150 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Slide Objects Along a Polyline
« on: May 03, 2016, 08:53:23 AM »
Is it possible to slide objects along a polyline that has curves in?

Here is the situation. I have a long polyline that is curvy. I have a bunch or park stalls (lines) that are already drawn 9 feet wide from each other.

If I could select the objects (stalls), select a base point, pick the polyline, then drag my cursor where I was it to slide all those stalls?

If the stalls where a block would that be easier?

Hopefully, I am explaining this more complicated than it really is.
Civil3D 2020

ChrisCarlson

  • Guest
Re: Slide Objects Along a Polyline
« Reply #1 on: May 03, 2016, 09:00:44 AM »
This is just an array, path array to be more specific. If you keep it associative it will be dynamic after execution of the command.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Slide Objects Along a Polyline
« Reply #2 on: May 03, 2016, 09:02:43 AM »
If you don't have access to an AutoCAD version which offers a Path Array, search for 'Copy Along Curve' or 'Space Along Curve'.

EDIT: Here they are:
https://www.theswamp.org/index.php?topic=32789.0
https://www.theswamp.org/index.php?topic=34792.0

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Slide Objects Along a Polyline
« Reply #3 on: May 03, 2016, 09:04:30 AM »
Yes, if selected entities were grouped into block it would be easier to move them all and manipulate... I suppose you can make it insertion point to be on curve when bmaking... Then grip block and stretch/move with "nearest" osnap along curve... Haven't checked, but I suppose should be preview displayed while dragging...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Slide Objects Along a Polyline
« Reply #4 on: May 03, 2016, 09:09:27 AM »
This is just an array, path array to be more specific. If you keep it associative it will be dynamic after execution of the command.
Even in older ACad's it is possible through the measure & divide commands (given the objects you wish to "array" you first "grouped" as a block). Though the newer dynamic array along a path does help with making adjustments later.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Slide Objects Along a Polyline
« Reply #5 on: May 03, 2016, 09:13:12 AM »
This is kinda what I am looking at. Select the objects and slide them along a polyline while keeping the relative space in between.
Civil3D 2020

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Slide Objects Along a Polyline
« Reply #6 on: May 03, 2016, 09:44:27 AM »
Well the array by path allows something similar to that. See attached video screen capture.


However, those corner cases are going to be difficult. I'm assuming you want some form of minimum gap. That is definitely not a built-in command.
« Last Edit: May 03, 2016, 09:48:07 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Slide Objects Along a Polyline
« Reply #7 on: May 03, 2016, 09:57:46 AM »
With the array, I notice to slide it one way I have to drag the polyline vertex. If I would want to slide the vertex of the array (start point); a box comes up to say continue or cancel the operation. it would be cool if you could slide that vertex of that array along that path. (again unless I am missing something)
Civil3D 2020

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: Slide Objects Along a Polyline
« Reply #8 on: May 03, 2016, 11:28:44 AM »
With the array, I notice to slide it one way I have to drag the polyline vertex. If I would want to slide the vertex of the array (start point); a box comes up to say continue or cancel the operation. it would be cool if you could slide that vertex of that array along that path. (again unless I am missing something)

Well like I said, have you tried to turn on "Nearest" OSNAP and drag vertex / end of path ?
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Slide Objects Along a Polyline
« Reply #9 on: May 03, 2016, 12:24:37 PM »
This is kinda what I am looking at. Select the objects and slide them along a polyline while keeping the relative space in between.
Maybe this will get you started ( no error checking ).
Code - Auto/Visual Lisp: [Select]
  1. (defun c:ladder (/ d e1 e2 l n p1 p2)
  2.   (if (and (setq d (getdist "\nEnter spacing: "))
  3.            (setq e1 (car (entsel "\nPick object to copy stuff on: ")))
  4.            (setq e2 (car (entsel "\nPick parallel object: ")))
  5.       )
  6.            (while (<= n l)
  7.              (setq p1 (vlax-curve-getpointatdist e1 n))
  8.              (setq p2 (vlax-curve-getclosestpointto e2 p1))
  9.              (entmakex (list '(0 . "line") '(8 . "stripe") (cons 10 p1) (cons 11 p2)))
  10.              (setq n (+ n d))
  11.            )
  12.     )
  13.   )
  14.   (princ)
  15. )

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

steve.carson

  • Newt
  • Posts: 108
Re: Slide Objects Along a Polyline
« Reply #10 on: May 03, 2016, 01:02:34 PM »
I've had to design these types of lots before too. The difficulty (like Irneb mentioned) is maintaining a consistent minimum distance between stalls when there is a mix of inside and outside curves. I'll usually break up the pline into pieces that only contain one or the other (inside or outside curves), then for the inside ones offset it the length of the stall and use that pline for the array.

I don't think my math skills are on par with handling this through lisp, since the array spacing on the inside curves will be dependent on the stall length and radius of the curve.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Slide Objects Along a Polyline
« Reply #11 on: May 03, 2016, 03:58:16 PM »
I've had to design these types of lots before too. The difficulty (like Irneb mentioned) is maintaining a consistent minimum distance between stalls when there is a mix of inside and outside curves. I'll usually break up the pline into pieces that only contain one or the other (inside or outside curves), then for the inside ones offset it the length of the stall and use that pline for the array.

I don't think my math skills are on par with handling this through lisp, since the array spacing on the inside curves will be dependent on the stall length and radius of the curve.
Here's a hack to somewhat account for the minimum distance on the ends for inside curves.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ladder (/ d d2 e1 e2 i l n p1 p2 tmp)
  2.   ;; RJP 05.03.2016
  3.   ;; Hack precision :)
  4.   (setq i 0.01)
  5.   (if (and (setq d (getdist "\nEnter spacing: "))
  6.            (setq e1 (car (entsel "\nPick object to copy stuff on: ")))
  7.            (setq e2 (car (entsel "\nPick parallel object: ")))
  8.       )
  9.            (while (<= n l)
  10.              (setq p1 (vlax-curve-getpointatdist e1 n))
  11.              (setq p2 (vlax-curve-getclosestpointto e2 p1))
  12.              (while (and tmp (setq d2 (distance p2 tmp)) (< d2 d))
  13.                (setq p1 (vlax-curve-getpointatdist e1 (setq n (+ n i))))
  14.                (setq p2 (vlax-curve-getclosestpointto e2 p1))
  15.              )
  16.              (entmakex (list '(0 . "line") '(8 . "stripe") (cons 10 p1) (cons 11 p2)))
  17.              (setq tmp p2)
  18.              (setq n (+ n d))
  19.            )
  20.     )
  21.   )
  22.   (princ)
  23. )
« Last Edit: May 03, 2016, 04:06:35 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Slide Objects Along a Polyline
« Reply #12 on: May 03, 2016, 04:00:49 PM »
Ron, GEESH! Amazing. Lisp is like a second language to you; isn't it? lol
Civil3D 2020

steve.carson

  • Newt
  • Posts: 108
Re: Slide Objects Along a Polyline
« Reply #13 on: May 03, 2016, 06:56:58 PM »
Ron, GEESH! Amazing. Lisp is like a second language to you; isn't it? lol

+1!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Slide Objects Along a Polyline
« Reply #14 on: May 03, 2016, 10:39:05 PM »
Thanks guys. I wouldn't really call it a second language  .. More of something I'm trying to get better at when I get the chance. :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC