Jump to content

Recommended Posts

Posted
(defun c:Test (/ pt1 pt2 pt3 ang)
 ;; Tharwat - 04.Jun.2016	;;
 (or *offdist* (setq *offdist* 0.1))
 (initget 6)
 (if (setq *offdist*
            (cond ((getdist (strcat "\nSpecify *offdist*set distance "
                                    (strcat "< " (rtos *offdist* 2 2) " > :")
                            )
                   )
                  )
                  (*offdist*)
            )
     )
   (while (and (setq pt1 (getpoint "\n1st point :"))
               (setq pt2 (getpoint "\n2nd point :" pt1))
               (setq pt3 (getpoint "\nSpecify offset side :"))
               (setq ang (angle pt1 pt2))
          )
     (setq ang ((if (minusp (sin (- ang (angle pt2 pt3))))
                  +
                  -
                )
                 ang
                 (* pi 0.5)
               )
     )
     (entmakex
       (list '(0 . "LINE")
             (cons 10 (trans (polar pt1 ang *offdist*) 1 0))
             (cons 11 (trans (polar pt2 ang *offdist*) 1 0))
       )
     )
   )
 )
 (princ)
)

  • 4 years later...
Posted
(defun c:Test (/ pt1 pt2 pt3 ang)
 ;; Tharwat - 04.Jun.2016	;;
 (or *offdist* (setq *offdist* 0.1))
 (initget 6)
 (if (setq *offdist*
            (cond ((getdist (strcat "\nSpecify *offdist*set distance "
                                    (strcat "< " (rtos *offdist* 2 2) " > :")
                            )
                   )
                  )
                  (*offdist*)
            )
     )
   (while (and (setq pt1 (getpoint "\n1st point :"))
               (setq pt2 (getpoint "\n2nd point :" pt1))
               (setq pt3 (getpoint "\nSpecify offset side :"))
               (setq ang (angle pt1 pt2))
          )
     (setq ang ((if (minusp (sin (- ang (angle pt2 pt3))))
                  +
                  -
                )
                 ang
                 (* pi 0.5)
               )
     )
     (entmakex
       (list '(0 . "LINE")
             (cons 10 (trans (polar pt1 ang *offdist*) 1 0))
             (cons 11 (trans (polar pt2 ang *offdist*) 1 0))
       )
     )
   )
 )
 (princ)
)

 

Can you add what it will look like and on which side it will be before you draw the line? 

 

Like the offset command.

Posted
5 minutes ago, Scoutr4 said:

Can you add what it will look like and on which side it will be before you draw the line? 

 

Like the offset command.

That's what it does currently but after specifying the two points that represents the assumed line 

  • Like 1
Posted

I am using Autocad 2022 version but As you said, after selecting 2 points, it doesn't show me a sampling of which side it will be on. I tried to add gif but failed. That's why I uploaded it as a link.

https://imgur.com/a/eBCBEGy

Posted

You can add the grdraw function to create a rubber band for a better review before specifying the side point like this:

(setq pt2 (getpoint "\n2nd point :" pt1))

(not (grdraw pt1 pt2 2)) ;; this expression 

(setq pt3 (getpoint "\nSpecify offset side :"))

 

  • Like 1
Posted (edited)

Thanks but I wanted to see the newly drawn line. Can you show me the sampling as if the pt3 point was selected without the pt3 point selected? This way i can see if it is in the range i want. Then I can choose pt3 and finish the process.

 

 

Edited by Scoutr4
I'm editing the post because for the first time I was a newbie to explain my problem. 

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...