Lisp to extract vertical distance between points?

Lisp to extract vertical distance between points?

Bogdan_AioaneA8TAK
Explorer Explorer
933 Views
13 Replies
Message 1 of 14

Lisp to extract vertical distance between points?

Bogdan_AioaneA8TAK
Explorer
Explorer

Hi all,

I am having to come up with a solution in AutoCAD in an attempt to avoid having to use Civil 3D. 

Given a number of pairs of points (each of the two points in a pair having the same x and y coordiantes but potentially different z coordinates). is there a way to insert some text at the x,y common coordinates of each pair to display the difference in z for each pair?

I need to numerically display the diferences between as-built vs designed surfaces. My thinking is to use PROJECTGEOMETRY to vertically project surveyed points onto the designed surface and obtain the above mentioned text to describe the differences.

Any help would be much appreciated.

0 Likes
934 Views
13 Replies
Replies (13)
Message 2 of 14

Kent1Cooper
Consultant
Consultant

Point objects specifically?  Or, to put it differently, in what format would you be "Given a number of pairs of points"?

Kent Cooper, AIA
Message 3 of 14

Sea-Haven
Mentor
Mentor

If Civ3D are they Cogo points or Cogo & a Point ?

 

Just read again "PROJECTGEOMETRY to vertically project surveyed points onto the designed surface" so a point may not have any design point to compare to, all hope is not lost, you can get a XYZ of a point on a 3dface. Ie a surface. Do you have CIV3D it has a add point to surface function, saves a lot of code.

 

Where I am, one state Road authority does quality checks on highways and they survey Random points and do the same compare to design.

 

Post a dwg.

0 Likes
Message 4 of 14

Bogdan_AioaneA8TAK
Explorer
Explorer

Yes,

The input to the exercise are point objects. Then projecting them to a surface gives me each point's "pair"

0 Likes
Message 5 of 14

Bogdan_AioaneA8TAK
Explorer
Explorer
It can't be Civil unfortunately. I have to come up with a way to do it in AutoCad
0 Likes
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@Bogdan_AioaneA8TAK wrote:

The input to the exercise are point objects. ....


And would the User be asked to select them?  Or should the routine be written to find all Points in the drawing [assuming there wouldn't be any that you don't want included], or all on a certain Layer, or...?

Kent Cooper, AIA
0 Likes
Message 7 of 14

Bogdan_AioaneA8TAK
Explorer
Explorer

I think the points can be placed in two layers (one for the mai points and the other for the projected points) and if the user has to name said layers something specific, so be it.

0 Likes
Message 8 of 14

Kent1Cooper
Consultant
Consultant

Reading Message 1 again, now it's not clear to me whether the "projected points" already exist to be selected [or found by the routine without User selection], or would be generated by the routine as the result of using PROJECTGEOMETRY on survey Points projecting onto a design-intent surface.

 

In other words, what exists at the start of a presumed command?  Pairs of Points already established?  [You have already used PROJECTGEOMETRY, perhaps?]  Or one set of as-built Points and a surface of some kind to project them onto, to create another set of design-intent Points for Z-difference comparison?

Kent Cooper, AIA
0 Likes
Message 9 of 14

Bogdan_AioaneA8TAK
Explorer
Explorer

the user can manually run the projecgeometry command and obtain the projected points (dont think its worth adding the extra complexity to the routine) so at the start of the routine one would already have prepared two layers with points (one with the main poits (say layer1) and the other with the corresponding projected points (layer2)) leaving the routine with the task of measuring the distance from poins in layer1 to coresponding points in layer2 and displaying the value as text at the xy cordinates of each pair of points.

Hope that makes sense.

0 Likes
Message 10 of 14

Kent1Cooper
Consultant
Consultant

Yes, that's clear.  How 'bout something like this quickie?

(defun C:PPDeltaZ ; = Point Pairs Delta [difference in] Z coordinates
  (/ ssA n ptA ssD insA ptD insD)
  (if (setq ssA (ssget "_X" '((0 . "POINT") (8 . "YourAsBuiltLayer"))))
    (repeat (setq n (sslength ssA)); then [outer]
      (setq
        ptA (ssname ssA (setq n (1- n)))
        insA (cdr (assoc 10 (entget ptA)))
      ); setq
      (if (setq ssD (ssget insA '((0 . "POINT") (8 . "YourDesignLayer"))))
        (progn ; then [inner]
          (setq
            ptD (ssname ssD 0)
            insD (cdr (assoc 10 (entget ptD)))
          ); setq
          (command "_.text"
            "_mc" (mapcar '/ (mapcar '+ insA insD) '(2 2 2))
            "" "" (rtos (- (caddr insA) (caddr insD)) 2 3)
          ); command
        ); progn
      ); if [inner]
    ); repeat
  ); if [outer]
  (prin1)
)

Minimally tested.  EDIT the Layer names in lines 3 & 9 [and the command name if you don't like mine].  Run it in WCS Plan view [assuming the Points are in WCS terms] or it won't find the DesignLayer Point for each AsBuiltLayer Point.

 

It puts the Text halfway between the Points in elevation.  It uses whatever the current Text Style [assumed to not have a fixed height] and size and Layer are.  EDIT the Text mode and precision in line 17.  All that optional/variable stuff could be forced within the command if needed.

 

If the Text is positive, the AsBuilt Point is above the Design Point; if negative, it's below.

Kent Cooper, AIA
0 Likes
Message 11 of 14

Bogdan_AioaneA8TAK
Explorer
Explorer

that is perfect. this will be incredibly useful
thank you so much

0 Likes
Message 12 of 14

Sea-Haven
Mentor
Mentor

@Kent1Cooper to do without Civ3d will probably need a surface converted to a TIN of 3dfaces, as you can work out a new point XYZ on a 3dface. Civ3D as default does not make 3dfaces when making surfaces, it is an option to make them. Understand your code works out the answer nice idea +ve & -ve, but the issue is how to make the new points.

 

So again using Projectgeometry is probably the way to go to make points. Can do in loop for multiple points.

0 Likes
Message 13 of 14

Kent1Cooper
Consultant
Consultant

@Sea-Haven wrote:

.... Projectgeometry is probably the way to go to make points. ....


[Read Message 9 -- they've already done that before they get to the point of calling the command.]

Kent Cooper, AIA
0 Likes
Message 14 of 14

Sea-Haven
Mentor
Mentor

@Kent1Cooper yes should have read the posts a bit more carefully, as a side note there is another command that moves a point to a surface so could use that method, get the original XYZ, move it, get new XYZ then undo, so no need for 2 layers, did a google and found it as a possible solution, now where was it.

 

Solved: Moving Points TO a Surface - Autodesk Community - Civil 3D

0 Likes