Reversing line direction

Aug 10, 2005 9 Replies

We are using a custom linestyle that has text imbedded in it. The problem is when the line is drawn for point A to point B the linestyle is shown correctly, but, when the line is drawn from point B to point A the text within the linestyle is upside down. Is there a utility available that will allow me to easily change the direction of the line.



Thank you inadvance for your help.



Dave


Try PLREV.LSP from

formatting link

Try this:

------------------------------------------------------- (defun C:bw (/ first list1 pt1 pt2) (setvar "cmdecho" 0) (command "undo" "be") (setq first (car (entsel "\nPick the line to be reversed:" ) ) ) (setq list1 (entget first) pt1 (cdr (assoc 10 list1)) pt2 (cdr (assoc 11 list1)) ) (progn (setq list1 (subst (cons 10 pt2) (assoc 10 list1) list1) list1 (subst (cons 11 pt1) (assoc 11 list1) list1) ) (entmod list1) ) (princ) )

-----------------------------------------------------------------------------------

Create a file named "BW.lsp" with everything above between but not including the lines, appload it, and run it with the command "BW". (Back-Wards)

Much nicer than my "quickie"! Does all kinds of objects, but I'm getting weird action with circles. (I didn't know that circles had a direction)

"Wierd Action": When you explode back to an arc the direction goes back to the original. See F2 below.

Command: li LIST Select objects: 1 found

Select objects: CIRCLE Layer: 0 Space: Model space Color: BYLAYER Linetype: SLOPE Handle = 4C center point, X= 5.5722 Y= 5.3278 Z= 0.0000 radius 1.9346 circumference 12.1553 area 11.7577

Command: plrev

Pick an object to reverse:

*Invalid selection* Expects a point or Window/Last/Crossing/BOX/ALL/Fence/WPolygon/CPolygon Select polyline: Object selected is not a polyline Do you want to turn it into one? y

Close/Join/Width/Edit vertex/Fit/Spline/Decurve/Ltype gen/Undo/eXit :

Command: PLREV Pick an object to reverse:

Command: li LIST Select objects: 1 found

Select objects: LWPOLYLINE Layer: 0 Space: Model space Color: BYLAYER Linetype: SLOPE Handle = 68 Open Constant width 0.0000

at point X= 7.4061 Y= 4.7119 Z= 0.0000 bulge -4239.0857 center X= 5.5722 Y= 5.3278 Z= 0.0000 radius 1.9346 start angle 341 end angle 341 at point X= 7.4067 Y= 4.7137 Z= 0.0000

area 11.7577 length 12.1535

Command: ex EXPLODE Select objects: 1 found

Select objects:

Command: li LIST Select objects: 1 found

Select objects: ARC Layer: 0 Space: Model space Color: BYLAYER Linetype: SLOPE Handle = 69 center point, X= 5.5722 Y= 5.3278 Z= 0.0000 radius 1.9346 start angle 341 end angle 341 length 12.1535

ARCs and CIRCLEs are always counterclockwise in AutoCAD. The only way to keep a "reversed" CIRCLE or ARC is to let it remain as Polyline Arc segment(s). PLREV converts CIRCLEs and ARCs to Polylines, as you have noticed. To keep them "reversed" do NOT EXPLODE them. ___

I looked at the code and figured that out. Pretty clever. You must use a bunch of complex linetypes to make writing all that code worth it. The issue has never really come up for me in my work.

No, but I have dealt with several C.E. firms who do. We trade in goodwill and other good stuff. ___

Are you structural?

No, mechanical with a lot of experience in architecture. Before that (believe it or not) I was a heavy-duty truck designer. ___

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required