Author Topic: Lengthen from Both Sides  (Read 1713 times)

0 Members and 1 Guest are viewing this topic.

HasanCAD

  • Swamp Rat
  • Posts: 1421
Lengthen from Both Sides
« on: April 20, 2014, 07:24:58 AM »
I am trying to modify a lisp for LEE to match my needs
http://www.lee-mac.com/midlen.html
Is there a way to lengthen an object from both sides and keep centerpoint as it is
This part which I modifed
Code: [Select]
(setq ent (ssname sel (setq idx (1- idx))))
      (setq lng (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)))
      (setq lng (Rnd lng 50))
      (vl-cmdf "_.lengthen" "Total" lng ent)
« Last Edit: April 20, 2014, 07:36:31 AM by HasanCAD »

ymg

  • Guest
Re: Lengthen from Both Sides
« Reply #1 on: April 20, 2014, 01:14:16 PM »
hasan,

Use the delta option instead.

Code: [Select]
(defun c:test ()
   (setq en (car (entsel))
         sp (vlax-curve-getStartPoint en)
         ep (vlax-curve-getEndPoint en)
        lng (Rnd lng 50)
   )
   (vl-cmdf "_.lengthen" "Delta" lng sp ep "")
   (princ)
)
« Last Edit: April 23, 2014, 11:02:48 AM by ymg »

HasanCAD

  • Swamp Rat
  • Posts: 1421
Re: Lengthen from Both Sides
« Reply #2 on: November 26, 2014, 03:17:41 AM »
Thanks ymg
I updated and it is very usefull

Code: [Select]
(defun c:BRL ( / en enfpoint enty extnd lngth strtpnt)
  (While
    (setq ent (entsel))   
    (setq enty (car ent))   
    (setq Lngth (vlax-curve-getdistatparam enty (vlax-curve-getendparam enty)))
    (if
      (> 12000 (setq *NewLength (cond ( (getint (strcat "\nWhat is New Length < " (itoa (setq *NewLength  (cond ( *NewLength  ) ( 7000 )))) " >?: "))) ( *NewLength  ))))
      (setq *NewLength *NewLength)
      (setq *NewLength (cond ( (getint (strcat "\nThere is no BAR more than 12000mm, Are you sure Bar length is < " (itoa (setq *NewLength  (cond ( *NewLength  ) ( 7000 )))) " >?: "))) ( *NewLength  )))
      )
    (setq extnd (/ (- *NewLength Lngth) 2))
    (setq StrtPnt (vlax-curve-getStartPoint enty))
    (setq EnfPoint (vlax-curve-getEndPoint enty))
    (vl-cmdf "_.Zoom" "Object" ent "")
    (vl-cmdf "_.lengthen" "Delta" extnd StrtPnt EnfPoint "")
    (vl-cmdf "_.Zoom" "Previous" )
   
    (princ)
    )
  )