[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Add Text to Piping Drawings
Tip# 4212 By Theresa Lowe On 18-Nov-2013
0
Rated By 0 users Downloaded : 540
Categories : Create Text
Software type : AutoCAD 2014
Rename File To : PTXT.LSP
This routine will help you label your pipe drawings quickly.

CAD Manager Theresa Lowe needed a way to place a string of text in AutoCAD piping drawings, so she created this pipe text LISP routine.

"I created this routine to automate the annotation of pipe types on mechanical and plumbing piping plans. It will place a string of text along a line, rotated to be plan-readable, on the same layer as the line, and trim that line around the text.

"The following defaults are set by this routine, but can be modified to the user's own preferences:

  • Text height is calculated by multiplying 3/32" (0.09375) by the current DIMSCALE setting
  • The default width factor of the text is 0.70
  • The default text style of the text is Standard
  • The default insertion point is Middle
  • The default text value option at the Command line is HWS.

"Note: Because of the feature to calculate a plan-readable rotation angle, this routine doesn't work with plines."

Notes from Cadalyst tip reviewer Brian Benton: This routine will help you label your pipe drawings quickly and keep the text on the layer you want. It also takes several steps to make sure your text is visible. It saves time by removing the copy, paste, rotate, and trim steps or the text, type in new pipe name, and rotate trim steps. It replaces them with click, Enter — very efficient. I did find that it didn't work in Civil 3D, so other AutoCAD verticals may have issues running it. But standard AutoCAD 2001 through 2014 tested just fine.

 

Average Rating:
0


User comments
Comment by Cooper,Kent
Posted on 2013-11-18 11:26:39
A complex Linetype with the text embedded would have the benefit of not breaking pieces out of the linework, making any re-routing MUCH easier. It would also work on Polylines (as well as Arcs, Circles, Splines, Ellipses, etc., however rarely some of them might be used for piping diagrams). It could introduce the label more often than you might sometimes want, or at the other end not include it in shorter Lines, so you would need to consider how long a line segment to define between text elements. There would sometimes be a need to reverse the direction of linework [there are routines here and elsewhere to do that, including one built into later versions of AutoCAD for some entity types]. And you would need a different linetype definition for each kind of label, though in most disciplines there would be a limited number of commonly-used labels. But the advantages may outweight the limitations. And even if you use defined complex Linetypes most of the time for their benefits, a routine like this would still be useful for occasional circumstances such as rarely-used labels or too-short lines.
Comment by Cooper,Kent
Posted on 2013-11-18 11:57:58
One warning: It first draws the Text using whatever the current Style is, and THEN changes it to Standard. That will cause trouble if the current Text Style when you call the command has a FIXED HEIGHT, so make sure that's not the case first. [It can be adjusted to avoid that problem, and also to work with other entity types (and restrict the User's selection to appropriate ones) -- I may work on a revised version and post it later.]
Comment by Lowe,T
Posted on 2013-11-18 14:33:30
@Kent - I agree, a complex Linetype would have been more utilitarian -- as that would permit me to calculate the unbroken line's pipe lengths for estimating purposes. But alas, I am coming into an office with an established CAD Standard (and drawing team), and they use lines and text (for now). A routine to create a complex linetype on the fly would be awesome - with a dialog interface, maybe ;-) Also, thanks for the heads up warning about a text style with a defined height. I will have to re-work the code as well, we always work with a defined text height of 0'-0" in the style itself, but outside text styles find their way into our drawings on occasion.... thanks for heading off that headache for me. :-) - Theresa Lowe
Comment by Lowe,T
Posted on 2013-11-20 14:03:50
FWIW, I've been doing some additional testing and I am able to get PTXT to run in virgin installs of Civil 3-D 2013 & 2014 and Architecture 2013 & 2014.
Comment by Cooper,Kent
Posted on 2013-11-21 13:41:56
Here's a revision that takes care of the things I mentioned, and has some other enhancements (see revision comments near the top). I changed the name to be about "Label" rather than "Pipe" to be more generic, but you can do what you like with that. For the most part, I left in but commented out lines of the original code that I re-did in some way, and kept the original variable names (those I added have lower-case names). If you like it, you can wipe out all the commented-out parts. Limited testing.