Jump to content

[lisp] lengthening, shortening according to the center of the line


Recommended Posts

Posted

Hi !,

 

I wrote a lisp that allows you to lengthen or shorten the line on both sides by the given amount. Is it possible to modify this lisp to lengthen / shorten a given line to the given value, e.g. 3.5, 4 etc. relative to the center of this line? E.g Line length 2.35 -> extend it to length 2.50 on both sides with one command

 

 

(defun c:df ( / ss en a)




  (if (and (setq ss (ssget "_+.:E:S" '((0 . "LINE"))))
	   (setq en (ssname ss 0)))
    (command "_.LENGTHEN"
	     "_DE"
	     ;(setq a (getreal "\nO ile: "))
(setq *rev*
 (
   (lambda ( input ) (if (eq "" input) *rev* input))
   (getstring (strcat "\nEnter Revision Number <" (setq *rev* (cond ( *rev* ) ( "1" ))) "> : "))
 )
)
	     (list en (trans (cdr (assoc 10 (entget en))) 0 1))
	     (list en (trans (cdr (assoc 11 (entget en))) 0 1))
	     ""
	     ))
  (princ)
)

 

 

Posted (edited)

For that you'd need to use the "_.SCALE" command "Reference" option in the code using the calculated distance between the endpoints.

Actually with that lisp you could lengthen from midpoint or either end so it would work for all you lengthen line work.

Edited by tombu
  • Like 1
Posted (edited)

"I wrote a lisp"

 

your new lisp

entsel line

get the start and end points

get angle of start -

end

mid point (setq mp (mapcar '* (mapcar '+ start end) '(0.5 0.5)))

use polar new end with new dist

use polar new start

use entmod on dxf 10 & 11

Edited by BIGAL

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