LENGTHEN total length variable

LENGTHEN total length variable

sjxyz
Enthusiast Enthusiast
1,272 Views
3 Replies
Message 1 of 4

LENGTHEN total length variable

sjxyz
Enthusiast
Enthusiast

I had a lisp routine where I could pick an object as a source and then its length could be used as the Total Length for a Lengthen command on another object. It looks as if back when this routine worked, calling Lengten updated the System Variable PERIMETER with the length of the object measured. Now that New Total Length variable is stored somewhere else. Can anyone help me get this working?

 

Thanks

 

 

The old routine is this:

;;---------------------=={ AsLongAs}==---------------------;;
;; ;;
;;aslongas matches line length to length of arc, pline or circle;;
;;------------------------------------------------------------;;


(defun C:ASLONGAS (/ cmde obj len)
(setq cmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq obj (car (entsel "\nSelect object to measure: ")))
(command "_.lengthen" obj "")
(setq len (getvar "perimeter"))
(prompt "\nPick end of line to change: ")
(command "_.lengthen" "_t" len pause "")
(setvar "cmdecho" cmde)
(princ)
)
0 Likes
Accepted solutions (1)
1,273 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

This is all you need to make it work

(defun C:ASLONGAS ()
  (command "_.lengthen" pause "_t" (getvar 'perimeter))
  (princ)
  )

.

 

 

0 Likes
Message 3 of 4

Kent1Cooper
Consultant
Consultant
Accepted solution

The LENGTHEN command has grown more options, so more is needed to get out of it.  More Enters could be added to get past them, but try this to simply cancel the rest of it after selection of the source-of-length object:

(defun C:ASLONGAS (/ cmde obj len)
  (setq cmde (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (setq obj (car (entsel "\nSelect object to measure: ")))
  (command "_.lengthen" obj) (command)
  (setq len (getvar "perimeter"))
  (prompt "\nPick end of line to change: ")
  (command "_.lengthen" "_t" len pause "")
  (setvar "cmdecho" cmde)
  (princ)
)

Or simply:

 

(defun C:ASLONGAS (/ cmde)

  (setq cmde (getvar 'cmdecho))
  (setvar 'cmdecho 0)

  (command "_.lengthen" (car (entsel "\nSelect object to measure: "))) (command)

  (prompt "\nPick end of line to change: ")

  (command "_.lengthen" "_t" (getvar 'perimeter) pause "")
  (setvar "cmdecho" cmde)

  (princ)

)
Kent Cooper, AIA
0 Likes
Message 4 of 4

sjxyz
Enthusiast
Enthusiast

Thanks both: I've gone for your second version Kent.

0 Likes