Jump to content

LISP TO SELECT MULTIPLE LINES AND LABEL RATIO OF VERTICAL TO HORIZONTAL


symoin

Recommended Posts

Hi,

I have a lisp by Ranjith Singh, downloaded from autodesk forum and modified to show the ratio of vertical to horizontal. All I need is to select multiple lines and get the answer.

 

Thanks in advance

ratio.lsp

Link to comment
Share on other sites

Try This

Codes Updated

(defun c:sr  (/ answer ss snm sp ep )
 (defun answer (pt1 pt2);ranjith sing 
 (entmakex
  (list '(0 . "TEXT")
        '(100 . "AcDbText")
        (cons 10 (trans (mapcar '+ (mapcar '/ (mapcar '+ pt1 pt2) '(2 2))) 1 0))
        (cons 11 (trans (mapcar '+ (mapcar '/ (mapcar '+ pt1 pt2) '(2 2))) 1 0))
        (cons 1 (strcat "1:"(rtos (abs((lambda (x) (/ (car x) (abs (cadr x)))) (mapcar '- pt1 pt2))) 2 2) ))
	'(71 . 0)
	'(72 . 1)
	(cons 40 1)
        (cons 50 0))))
  
  (if (setq ss (ssget '((0 . "LINE"))))
    (progn
      (repeat (setq i (sslength ss))
	(setq snm (ssname ss (setq i (1- i))))
	(setq sp (vlax-curve-getstartpoint snm))
	(setq ep (vlax-curve-getendpoint snm))
	(answer sp ep))
      )
    )
  (princ)
  )

 

Edited by gS7
Link to comment
Share on other sites

Thanks GS7,

Yes This is what I was looking for;

I need a small modification, can the mtext chaged to text and the rotation to 0degree.  

Link to comment
Share on other sites

1 hour ago, symoin said:

Thanks GS7,

Yes This is what I was looking for;

I need a small modification, can the mtext chaged to text and the rotation to 0degree.  

 

above codes updated

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