Jump to content
symoin

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

Recommended Posts

symoin

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

Share this post


Link to post
Share on other sites
gS7
Posted (edited)

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

Share this post


Link to post
Share on other sites
symoin

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.  

Share this post


Link to post
Share on other sites
gS7
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

Share this post


Link to post
Share on other sites
symoin
Posted (edited)

sorry my bad; it is not the requirement at all

Edited by symoin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×