Jump to content

Revers Direction


Abrasive

Recommended Posts

This routine was written by someone else, I don't remember and can't find who, if I could I would give them credit....

Could someone help me modify it?

The routine works perfectly, but I would like to change the direction it draws the polyline?

(defun c:l2r2inch ( / i e l n p q s )
   (if (setq s (ssget '((0 . "LINE"))))
       (repeat (setq i (sslength s))
           (setq e (entget (ssname s (setq i (1- i))))
                 p (cdr (assoc 10 e))
                 q (cdr (assoc 11 e))
                 n (mapcar '- p q)
                 l (mapcar
                      '(lambda ( x )
                           (mapcar '(lambda ( y ) (mapcar x (trans y 0 n) '(1 0 0)));;this 1 is offset 1inch
                               (list p q)
                           )
                       )
                      '(+ -)
                   )
           )
           (entmake
               (append
                  '(   (000 . "LWPOLYLINE")
                       (100 . "AcDbEntity")
                       (100 . "AcDbPolyline")
                       (090 . 4)
                       (070 . 1)
                   )
                   (mapcar '(lambda ( x ) (cons 10 (trans x n 0))) (append (car l) (reverse (cadr l))))
               )
           )
       )
   )
   (princ)
)

Thanks in advance!

Link to comment
Share on other sites

Looks like Lee's formatting. YUP 🤓

 

Change this:

(append (car l) (reverse (cadr l)))

To this:

(reverse (append (car l) (reverse (cadr l))))

 

Edited by ronjonp
Found it
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

So the 2 white lines are drawn in opposite directions, the red are the offset lines so how would you decide which way is always to right ? 

 

image.png.732e499a877e75f0050c3f334ebee258.png

 

Looking a bit more is this only for vertical Lines ? We need more info a dwg that shows wrong side.

Link to comment
Share on other sites

12 minutes ago, ronjonp said:

Looks like Lee's formatting. YUP 🤓

 

Change this:

(append (car l) (reverse (cadr l)))

To this:

(reverse (append (car l) (reverse (cadr l))))

 

Yes it was from @Lee Mac !

Thanks for finding it.

I'll make the changes and give it a try, Thanks

Link to comment
Share on other sites

20 minutes ago, ronjonp said:

Looks like Lee's formatting. YUP 🤓

 

Change this:

(append (car l) (reverse (cadr l)))

To this:

(reverse (append (car l) (reverse (cadr l))))

 

 

That worked.

Thanks again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...