0

enter image description here I have a line (3d) with defined chainage (km relative to a reference location). There are a list of fixed objects around the line, wherein the X-Y-Z coordinates of the objects are given. The line and the objects have the same origin and same coordinate system. I need to extract the location of the objects relative to the line, that is, the relative chainage and the distance to the line. Anyone knows how to extract the list of relative locations for those objects?

ps. I showed an example of a line and some objects around it. The objects are plot out based on their coordinates. Now I need to find the km-info of these points relative to the line and the distance to the line (in practice the line can containe lots of curves, just imaging it's the centre line of a road).

Thanks in advance!

open0121
  • 105
  • 2
  • 15

1 Answers1

0

I don't have ready solution but algorithm would be:

  1. select those objects, in LISP You may use (ssget )
  2. get the basepoint for each of object center of circle for example: (setq center(vlax-get-property Object 'Center)).
  3. Project center point to curve - axis (setq projection(vlax-curve-getClosestPointTo axis center )).
  4. Read length of curve from it's begining to projection: ( setq dist ( vlax-curve-getDistAtPoint axis projection ) ).
  5. Recalculate distance based on fixed distance of line.
CAD Developer
  • 1,532
  • 2
  • 21
  • 27
  • Thanks! When you mentioned curve, do you mean any curve consists of circule curves, transition curves and straight lines? – open0121 Feb 14 '20 at 11:11
  • I mean curve as one of AutoCAD linear entities: line, polyline, arc, circle , spline. – CAD Developer Feb 14 '20 at 11:15
  • Got it. Civil 3D has a tool 'add a station and offset to points'. Hope it is not difficult to make one (for LISP beginners) :) – open0121 Feb 14 '20 at 11:36