Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

polyline grip edit add vertex (transparent polyline reverse)

5 REPLIES 5
Reply
Message 1 of 6
zasanil
1162 Views, 5 Replies

polyline grip edit add vertex (transparent polyline reverse)

When adding a vertexto the end of a polyline using the grip edit, thereis a 50% chance the vertex will be outside the new polyline or inside it. I wanted to know if there was a transparent command that I could hotkey to swap from inside to outside or (vice versa) like you can do by cycling options with the ctrl key. As it stands right now, if I grip edit and try to add it but it's on the wrong side, I have to escape out of the command and run the reverse polyline command then go back and restart grip editing.

If there isn't a command already, could someone please make a list that would perform the same function?

Thanks!

Dan Nicholson C.I.D.
PCB Design Engineer
5 REPLIES 5
Message 2 of 6
dbroad
in reply to: zasanil

The vertex is added within when at the first vertex grip.  It is added beyond when at the last vertex grip.  In the case where it does not do what you want, hit escape, then right click the polyline and choose Polyline -> Reverse and then add the vertex beyond (or within) as you wish.

 

I am not aware of a program that could do that while in the grip edit mode.

Architect, Registered NC, VA, SC, & GA.
Message 3 of 6
lwjacob
in reply to: dbroad

I wish that there was a button to reverse it. Crtl would be great.

Message 4 of 6
CodeDing
in reply to: lwjacob

@lwjacob

 

Wow, did the work and didn't realize this was from 2014. Anyways, where there's a will there's a way. Here's something I just put together in .lsp:

(defun c:RAV ( / ssLine ptList ptLast)
;Reverse & Add Vertex
(if (= (getvar "CMDNAMES") "GRIP_STRETCH")
  (progn
	(command)
	(setq ssLine (ssget "_I") ssEnt (ssname ssLine 0))
	(command "_.REVERSE" ssEnt "")
	(setq ptList (vl-remove nil (mapcar '(lambda (x) (if (= (car x) 10) (cdr x))) (entget ssEnt))))
	(setq ptLast (nth (- (length ptList) 1) ptList))
	(command "_.PEDIT" ssEnt "E")
	(repeat (length ptList) (command "N"))
	(command "I" pause "X" "")
  );progn
);if
(princ);finish quietly
);defun

...you will need to create your own Keyboard Shortcut in your CUI...

image.png

...I used "CTRL+F", so while I was editing the grip I could press "CTRL+F" to execute the command.

image.png

...I'm not real savvy on making gifs, so here's an image right Before using CTRL+F and right After using CTRL+F...

image.png

^^^Before

image.png

^^^After

 

...of course you would need to add the RAV lisp to your startup acaddoc.lsp file if you did not want to load it every time.

 

Best,

~DD

 

 

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 5 of 6
CodeDing
in reply to: CodeDing

Alternatively,

 

This updated version of RAV would allow the user to add more than one vertex to the line until user: escapes, presses space, right-clicks, hits enter...

(defun c:RAV ( / ssLine ptList ptLast ptOld ptNew)
;Reverse & Add Vertex
(if (= (getvar "CMDNAMES") "GRIP_STRETCH")
  (progn
	(command)
	(setq ssLine (ssget "_I") ssEnt (ssname ssLine 0))
	(command "_.REVERSE" ssEnt "")
	(setq ptList (vl-remove nil (mapcar '(lambda (x) (if (= (car x) 10) (cdr x))) (entget ssEnt))))
	(setq ptLast (nth (- (length ptList) 1) ptList))
	(command "_.PEDIT" ssEnt "E")
	(repeat (length ptList) (command "N"))
	(command "I" pause)
	(setq ptOld 1 ptNew 2)
	(while (not (equal ptOld ptNew 0.000001))
		(setq ptOld (getvar 'LASTPOINT))
		(command "I" pause)
		(setq ptNew (getvar 'LASTPOINT))
	);while 
	(command "X" "")
  );progn
);if
(princ);finish quietly
);defun

 

Best,

~DD

~DD
Senior CAD Tech & AI Specialist
Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 6 of 6
lwjacob
in reply to: CodeDing

Mr. You're the best! 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost