Jump to content

Text Align & Delete Lisp Routine


grifflee

Recommended Posts

Hi I'm looking for some help regarding Lisp Routines.

 

I process a lot of Topographical surveys using AutoCAD. All of the text sits horizontally to the line, so I have to rotate each bit of text to the polyline. As you can imagine this can be very time consuming.

 

I have come across a Lisp routine that allows me to align text to a polyline, but you have to select each part of the polyline, then the relative text. I've attached some screen dumps, to try and make my point a little more clear.

 

Does anyone know of a routine, so that you could select a polyline, then all text that you select would rotate to that line, be it on the curve of the polyline or not. Rather than having to select a point on the curve then the text, then a point on the straight, then the relative text.

 

Also does anyone know of a Lisp that allows one click deleting? Rather than selecting an object then hitting delete. You can run a lisp that would delete anything you click on and keep the command open until your finished?

 

Sorry if this post seems long winded, but any help would be appreciated. I have also attached the Text Rotate lisp that I am currently using.

 

Thanks

Raw Topo Survey.jpg

Topo Survey with Rotated Text.jpg

RT.LSP

Link to comment
Share on other sites

It is going to be difficult to find a pre-made lisp routine that tackles your alignment problem with the added functions to allow one-click deleting.

You could find one, and then the other, and combine them though.

Link to comment
Share on other sites

Also does anyone know of a Lisp that allows one click deleting? Rather than selecting an object then hitting delete. You can run a lisp that would delete anything you click on and keep the command open until your finished?

 

Thanks

 

Here is one that Lee combined for me. It mimics the eraser tool in SketchUp

 

http://www.theswamp.org/index.php?topic=39014.msg441779#msg441779

Eraser.lsp

Link to comment
Share on other sites

Here is one that Lee combined for me. It mimics the eraser tool in SketchUp...

 

Thanks Greg -

 

Here is an updated version of that program to adhere to the active UCS settings:

[color=GREEN];; Continuous Erase  -  Lee Mac[/color]

([color=BLUE]defun[/color] c:ce ( [color=BLUE]/[/color] *error* flg lst mod pt1 pt2 sel )
   
   ([color=BLUE]defun[/color] *error* ( m ) ([color=BLUE]redraw[/color]) ([color=BLUE]princ[/color]))
   
   ([color=BLUE]princ[/color] [color=MAROON]"\nSelect objects to erase: "[/color])
   ([color=BLUE]while[/color] ([color=BLUE]and[/color] ([color=BLUE]not[/color] flg) ([color=BLUE]=[/color] 3 ([color=BLUE]car[/color] ([color=BLUE]setq[/color] pt1 ([color=BLUE]grread[/color] [color=BLUE]nil[/color] 12 2)))))
       ([color=BLUE]if[/color] ([color=BLUE]setq[/color] sel ([color=BLUE]ssget[/color] ([color=BLUE]setq[/color] pt1 ([color=BLUE]cadr[/color] pt1))))
           ([color=BLUE]command[/color] [color=MAROON]"_.erase"[/color] sel [color=MAROON]""[/color])
           ([color=BLUE]progn[/color]
               ([color=BLUE]princ[/color] [color=MAROON]"\nSpecify opposite corner: "[/color])
               ([color=BLUE]while[/color] ([color=BLUE]=[/color] 5 ([color=BLUE]car[/color] ([color=BLUE]setq[/color] pt2 ([color=BLUE]grread[/color] [color=BLUE]t[/color] 13 0))))
                   ([color=BLUE]redraw[/color])
                   ([color=BLUE]setq[/color] pt2 ([color=BLUE]cadr[/color] pt2)
                         lst ([color=BLUE]list[/color] pt1 ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt2) ([color=BLUE]cadr[/color] pt1)) pt2 ([color=BLUE]list[/color] ([color=BLUE]car[/color] pt1) ([color=BLUE]cadr[/color] pt2)))
                         mod ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]car[/color] pt1) ([color=BLUE]car[/color] pt2)) 0 1)
                   )
                   ([color=BLUE]mapcar[/color] '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]grdraw[/color] a b -1 mod)) ([color=BLUE]cons[/color] ([color=BLUE]last[/color] lst) lst) lst)
               )
               ([color=BLUE]if[/color] ([color=BLUE]listp[/color] ([color=BLUE]setq[/color] pt2 ([color=BLUE]cadr[/color] pt2)))
                   ([color=BLUE]if[/color] ([color=BLUE]setq[/color] sel ([color=BLUE]ssget[/color] ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]car[/color] pt1) ([color=BLUE]car[/color] pt2)) [color=MAROON]"_WP"[/color] [color=MAROON]"_CP"[/color]) lst))
                       ([color=BLUE]command[/color] [color=MAROON]"_.erase"[/color] sel [color=MAROON]""[/color])
                   )
                   ([color=BLUE]setq[/color] flg [color=BLUE]t[/color])
               )
               ([color=BLUE]redraw[/color])
               ([color=BLUE]princ[/color] [color=MAROON]"\nSelect objects to erase: "[/color])
           )
       )
   )
   ([color=BLUE]princ[/color])
)

Example:

 

continuouserase.gif

Link to comment
Share on other sites

Hi Lee, Can this be made to also work with blocks? And how about along polylines?

 

It should already work with polylines; as for blocks - yes, but with more work.

Link to comment
Share on other sites

Could just do a good ol' macro for that.

*^C^C_erase;\;

 

The macro works great. Thanks for another option as well.

 

Lee - Thank you as well for the enhanced version of the Continuous Erase tool.

~Greg

Link to comment
Share on other sites

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