# Thread: Drawing perpendicular to a 3D polyline

1. Login to Give a bone

## Drawing perpendicular to a 3D polyline

The problem I am having is drawing waterline services perpendicular to a 3D pipe run. Is there and easy way to do this without having to change my 3D polyline to a zero elevation? Lisps?

2. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

Try this... I tried it with a 3DPolyline and it seemed to work
Code:
```;;  PLPERP.lsp starts a polyline perpendicular to any 2D curve at
;;    the point picked.
;;  Allows direct distance entry for first polyline segment, then
;;    restores previous ortho setting and snap angle (if any).

;;  by Bill Gilliss  bill dot gilliss at aya.yale.edu
;;  3/20/2008
;;  Comments and suggestions always welcome.

(defun c:plperp ( / e en obj param p1 p2 wp1 sa oldortho oldsnapang oldosmode olderror)

(setq oldortho (getvar "orthomode")
oldsnapang (getvar "snapang")
oldosmode (getvar "osmode")
olderror *error*
)
(setq e (entsel "Select curve at point to start perpendicular (OSNAPS welcome):"))
(setq en (car e) p1 (cadr e))            ;UCS point
(setq p1 (osnap p1 "_nea"))
(setq obj (vlax-ename->vla-object en))
(setq param (vlax-curve-getParamAtPoint obj (trans p1 1 0)))  ;WCS point
(setq fderiv (vlax-curve-getFirstDeriv obj param))
(setq sa (+ (* pi 0.5) (angle (trans '(0.0 0.0 0.0) 0 1) (trans fderiv 0 1))))
(setvar "snapang" sa)
(setvar "orthomode" 1)
(setq p2 (getpoint p1 "\nNext point:"))
(setvar "orthomode" oldortho)
(setvar "snapang" oldsnapang)
(setvar "osmode" oldosmode)
(setq *error* olderror)

(command "pline" p1 p2)
);defun

(defun *error* (msg)
(setvar "orthomode" oldortho)
(setvar "snapang" oldsnapang)
(setvar "osmode" oldosmode)
(setq *error* olderror)
)

(princ)```

3. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

This lisp seems to be for a curve? I tried it but it's asking me: Select curve at point to start perpendicular (OSNAPS welcome):

4. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

You can start by drawing a (2d) polyline from a point (generally a vertex, sometimes a midpoint, etc) on the 3dpoly.
The exact method will vary with circumstances - just remember that the entire 2d polyline will have the same z-value as the first point picked.
Then you can draw one or more segments away from the target polyline and come back to it with a PERpendicular osnap.

5. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

I was afraid of that! I was hoping someone had a short cut for me.

6. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

am I missing something?

waterline service?

start pline @ approx. water meter location, (osnap perpendicular), snap to 3d pipe line.

you can leave pipe line 3d, and still snap a 2d pline perpendicular to it.

hope this helps

7. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

Yes, it allows you to snap to a 3D polyline but it isn't perpendicular on the 2D plane. Try this draw a 3D polyline then make sure the verticies have about 10' or so difference in elevation (z) between them say 890 and 900, then draw a line and snap it perpindicular to the 3D polyline you have just drawn.

8. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

when I tested i yesterday my 3d polyline only had about 1' elev. drop.

so the pline appeared to be perpendicluar, but when I increased elev. drop, not perpendicular. duh!

just a thought, make temp layout and draw your services in paperspace, and snap to 3d pipe line in model, using a viewport.

then when done, issue changespace to put services in model space @ 0 elev.

9. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

Originally Posted by sbullinger
This lisp seems to be for a curve? I tried it but it's asking me: Select curve at point to start perpendicular (OSNAPS welcome):
Ignore that it says Curve, try it on s 3DPolyline. I just tried it on a 3dpolyline w/ vertices @ 890 and 900, snapping to midpoint and it drew a pline perpendicular @ 895.

10. Login to Give a bone

## Re: Drawing perpendicular to a 3D polyline

Would changing UCS to match the slope help?

Page 1 of 2 12 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•