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

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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