Jump to content

draw left and right line segment from point


Recommended Posts

Posted (edited)

i am sorry i need this lisp urgently , i have heavy work in my job or i fail

lisp senario attached below . i hope some body help me . this is my final requier , please 

 

there is an lisp file can draw equal line parts of line midell point , can make modify to get newest lisp have required sinario

lispsenario.jpg

ليسب رسم خط من جهتين.JPG

سيناريو رسم خط من جهتين.txt

line from midpoint.lsp

Edited by Abdulellah
Posted

Something like this

 



;; 1 - pick point (core point)
;; 2 - click left or right
;; 3 - user sets distance
;; 4 - enter right factor
;; 5 - calculate dist
;; 5b - draw line
;; 6->9 - Now repeat for the other side.  Press enter for the same value
;; 10 - Repeat all


(defun drawLine (p1 p2)
 (entmakex (list (cons 0 "LINE")
                 (cons 10 p1)
                 (cons 11 p2)))
)

;; Draw Left Right
(defun c:dlr ( / pt_core fact dist a ang)
  ;; 10 - Repeat all
  (while T  
    ;; 1 - pick point (core point)
    (setq pt_core (getpoint "\nPick core point: "))
    ;; 2 - click left or right
    (setq a (getpoint "\nLeft or right side?  Pick a point: : "))
    (if (> (nth 0 a) (nth 0 pt_core))  ;; see if x-value is bigger or smaller
      (setq ang 0)   ;; right
      (setq ang pi)  ;; left
    )
    ;; 3 - user sets distance
    (setq dist (getdist "\nSet distance (enter value or click 2 points): "))
    ;; 4 - enter right factor
    (setq fact (getreal "\nEnter factor: "))
    ;; 5 - calculate dist - draw line
    (drawLine pt_core (polar pt_core ang (/ dist fact) ))
    ;; 6->9 - Now repeat for the other side.
      ;; opposite angle
    (if (= 0 ang)
      (setq ang pi)
      (setq ang 0)
    )
    (princ "\nNow the other side")
    (setq a (getdist "\nSet distance (enter value or click 2 points or press enter for the previous distance): "))
    (if a
      (setq dist a)
        ;; else the dist stays the same
    )
    (setq a (getreal "\nEnter factor or press enter for the previous distance: "))
    (if a
      (setq fact a)
    )
    (drawLine pt_core (polar pt_core ang (/ dist fact) ))
    (princ "\nNew lines")
  )
)

Posted

thanks bro ,  can i get .lsp file , i do not have internet connection for my pc . i use mobile browser can not test your lisp .

kinddly if you upload lisp file

Posted

Copy what is posted and paste/save  to a Text file, with extension .lsp 

Posted (edited)

$0.02 unless I misunderstood?

why not just (setvar 'orthomode 1)

during LINE command use transparent command:  'CAL

'cal >>>> expression : 10*0.3048

or you can preset global variable (setq f 0.3048)

'cal >>>> expression : 10*f

 

or polarmode =1 ? @10<90d

 

not sure this helps? 

Edited by hanhphuc

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