PDA

View Full Version : find the start of a line that is already drawn



3dway
2008-07-03, 07:42 PM
I would like to build a block for showing the slope of a site.
I can already create a feild that reads the delta z and devides by the length x100 to show the slope in %. The problem is that it reads positive or negative based on which is the start point of the line.

The end game with this one is to make block where you grip the line points onto the right spot and tell it the z dimensions (or snap it to a 3d survey point) and the line from point to point doesn't show but there is an arrow aligned with it that does show and the text saying what the slope is.

irneb
2008-07-03, 08:32 PM
I'm assuming you're using this inside the Objects / Formula field type. You could use the ABS function (undocumented but works - it stands for ABSOLUTE VALUE).

E.g. ABS(%<FIELD for DELTA Z>%)/%<FIELD for Length>%

3dway
2008-07-03, 08:42 PM
I used a bunch of those absolute value lines of garble. I copy-clipped them out of the box at the bottom of the feild dialogue and pasted them into the formula. When they paste into the formula box they report the final value.

now what I have is a line that I give a start z and end z (the geodetic numbers from my site) and the feild reports a slope. If I want to use this on a drawing, I need to be able to control the positive/negative, which I can only do by making sure the start point is the lower (or higher if you want to show a negative number).

Once I have this ironed out, I want to put it all into a block with a little arrow that points down the slope.

I assume that the best way to do this is just point it toward the start point of the line. I can easily determine the start point of the line when I'm making the block, but if the line is already drawn, the only way to which end has the property "start z" is to draw another line snapped to it and read the z coordinates of the second line.

Has anyone already made a tool like this? I'm sure they have.

3dway
2008-07-03, 08:45 PM
The other problem I have is that i don't know if you can grip the end points of the line once it's in a dynamic block. Don't have a lot of experience with dynamic blocks. Not sure if I'll get it either. We're moving to revit.

irneb
2008-07-03, 09:00 PM
Or you could use a small LISP utility to swap the line's start / end points:
(defun c:SwapLine (/ en ed pt1 pt2)
(setq en (entsel "Pick line: ") ed (entget (car en)))
(if (= "LINE" (cdr (assoc 0 ed)))
(progn
(setq pt1 (cdr (assoc 10 ed)) pt2 (cdr (assoc 11 ed)))
(setq ed (subst (cons 10 pt2) (assoc 11 ed) ed))
(setq ed (subst (cons 11 pt1) (assoc 10 ed) ed))
(entmod ed)
)
)
(princ)
)

3dway
2008-07-09, 08:04 PM
Gee, thanks,

Does that swap keep the z coordinates in the right spot?

irneb
2008-07-10, 05:38 AM
Yes it should. Basically all it does is obtain the start point's XYZ coord from DXF code 10, and then the end coord from DXF code 11. Then it modifies the data of the line to have the coordinates swapped. So it starts the line from the XYZ of it's previous end, and ends the line to its previous start.