Trim to polyline midpoint when selecting unwanted polyline half

Trim to polyline midpoint when selecting unwanted polyline half

Anonymous
Not applicable
1,182 Views
6 Replies
Message 1 of 7

Trim to polyline midpoint when selecting unwanted polyline half

Anonymous
Not applicable

Hello. Is there a command that trims to a polyline midpoint when selecting an unwanted polyline half?

 

Thank you.

0 Likes
Accepted solutions (1)
1,183 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

.... Is there a command that trims to a polyline midpoint when selecting an unwanted polyline half? ....


If you can be counted on to select it in an unambiguous location [where nothing else might be "seen" instead], something like this [minimally tested]:

(defun C:PLCHO ; = PolyLine Cut Half Off
  (/ plsel)
  (setq plsel (entsel "\nSelect Polyline within half-length to be cut off: "))
  (command "_.lengthen" "_total"
    (/ (vlax-curve-getDistAtParam (car plsel) (vlax-curve-getEndParam (car plsel))) 2)
    (cadr plsel) ""
  ); command
  (princ)
); defun

 

Kent Cooper, AIA
0 Likes
Message 3 of 7

Anonymous
Not applicable

That's it! Thanks, Kent.

Message 4 of 7

Sea-Haven
Mentor
Mentor

As length is a property can also do this way.

 

Thanks Kent learn something new all the time "Lengthen"

 

 

(command "_.lengthen" "_total"
    (/ (vlax-get (vlax-ename->vla-object (car plsel)) 'Length) 2)
    (cadr plsel) ""
  ); command

 

0 Likes
Message 5 of 7

ВeekeeCZ
Consultant
Consultant

Yes, one of my favorites commands. The command also has the "percent" option...

 

(defun c:PLCHO ()
  (command "_.lengthen" "_percent" 50)
  (princ)
  )

 

0 Likes
Message 6 of 7

Sea-Haven
Mentor
Mentor

Nice % and pick a side to remove.

0 Likes
Message 7 of 7

lena.talkhina
Alumni
Alumni

Hello @Anonymous !

 

Great to see you here on LISP forum.

And you already received a solution! This is awesome!

 

Don't hesitate to ask any question you have by creating a new thread.

Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям! | Do you find the posts helpful? "LIKE" these posts!
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.



Лена Талхина/Lena Talkhina
Менеджер Сообщества - Русский/Community Manager - Russian

0 Likes