Squirltech Posted August 6, 2012 Posted August 6, 2012 I have a co-worker looking for a way to make certain strings of text into linework. Is this even possible? I thought there might be a LISP routine out there that does something like this. Example: Carthage County Line = ---- -- ---- -- ---- -- ---- (or something) Quote
BlackBox Posted August 6, 2012 Posted August 6, 2012 ... Not sure I fully understand what you're requesting; perhaps this is what you're after? http://apps.exchange.autodesk.com/ACD/Detail/Index?id=appstore.exchange.autodesk.com%3aText-to-Geometry%3aen Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 Thanks RenderMan but I'm not looking for the lines that make up the text to become linework. I'm wanting something to read "County Line" and make a line in the drawing with a phantom linetype. I don't even know if something like this is even possible? Quote
BlackBox Posted August 7, 2012 Posted August 7, 2012 You want "County Line" to be the command, or something found in the drawing... I am still not understanding. If I am understanding you correctly, you're wanting a routine to detect a *Text entity that includes (or consists of) "County Line" in the Objects TextString, and then you want the code to create a *Line entity within the drawing's ModelSpace? Where? Perhaps a before and after pic would help? More information is needed, methinks. Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 If I am understanding you correctly, you're wanting a routine to detect a *Text entity that includes (or consists of) "County Line" in the Objects TextString, and then you want the code to create a *Line entity within the drawing's ModelSpace? Where? Perhaps a before and after pic would help? More information is needed, methinks. This is exactly what I'm looking for! Is this possible? Again, this is more of a curiosity than a necessity. Quote
Tyke Posted August 7, 2012 Posted August 7, 2012 Is this something like in a drawing legend? Could the start point of the line be a set vertical and horizontal offset from the insertion point of the text and the line a set length? Or does the line need start and end points? Quote
Lee Mac Posted August 7, 2012 Posted August 7, 2012 Maybe something like this? ;; Text Linetype - Lee Mac ;; Creates and loads a custom linetype containing the specified text. ;; The linetype will use the Standard TextStyle in the linetype definition. ;; The space between dashes in the linetype is calculated based on the number of ;; characters in the supplied string, with an additional spacing of 0.05 drawing units. ;; Using a monospace font for the linetype will produce the best results. (defun c:txtlt ( / *error* des str tmp val var ) (defun *error* ( msg ) (mapcar 'setvar var val) (if (= 'file (type des)) (close des) ) (if (and tmp (findfile tmp)) (vl-file-delete tmp) ) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (= "" (setq str (getstring t "\nSpecify Text for Linetype: ")))) ( (null (and (setq tmp (vl-filename-mktemp nil nil ".lin")) (setq des (open tmp "w")) (write-line (strcat "*" str "," str " ----" str "----" str "----") des) (write-line (strcat "A,.5,-.05,[\"" str "\",STANDARD,S=.1,R=0.0,X=0.0,Y=-.05]," (rtos (- (/ (strlen str) -10.0) 0.05) 2 1)) des) (not (setq des (close des))) (findfile tmp) ) ) (princ "\nUnable to create custom linetype definition.") ) ( (progn (setq var '(cmdecho expert) val (mapcar 'getvar var) ) (mapcar 'setvar var '(0 5)) (command "_.-linetype" "_L" "*" tmp "") (mapcar 'setvar var val) (vl-file-delete tmp) (tblsearch "LTYPE" str) ) (princ (strcat "\n" str " linetype created successfully.")) ) ( (princ (strcat "\nUnable to load linetype " str))) ) (princ) ) (princ) Or have I misunderstood? Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 Does this help? Select "COUNTY LINE" and from that, create a line/polyline at a certain length with a PHANTOM linetype. (Just as an example) Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 Maybe something like this? ;; Text Linetype - Lee Mac ;; Creates and loads a custom linetype containing the specified text. ;; The linetype will use the Standard TextStyle in the linetype definition. ;; The space between dashes in the linetype is calculated based on the number of ;; characters in the supplied string, with an additional spacing of 0.05 drawing units. ;; Using a monospace font for the linetype will produce the best results. (defun c:txtlt ( / *error* des str tmp val var ) (defun *error* ( msg ) (mapcar 'setvar var val) (if (= 'file (type des)) (close des) ) (if (and tmp (findfile tmp)) (vl-file-delete tmp) ) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (= "" (setq str (getstring t "\nSpecify Text for Linetype: ")))) ( (null (and (setq tmp (vl-filename-mktemp nil nil ".lin")) (setq des (open tmp "w")) (write-line (strcat "*" str "," str " ----" str "----" str "----") des) (write-line (strcat "A,.5,-.05,[\"" str "\",STANDARD,S=.1,R=0.0,X=0.0,Y=-.05]," (rtos (- (/ (strlen str) -10.0) 0.05) 2 1)) des) (not (setq des (close des))) (findfile tmp) ) ) (princ "\nUnable to create custom linetype definition.") ) ( (progn (setq var '(cmdecho expert) val (mapcar 'getvar var) ) (mapcar 'setvar var '(0 5)) (command "_.-linetype" "_L" "*" tmp "") (mapcar 'setvar var val) (vl-file-delete tmp) (tblsearch "LTYPE" str) ) (princ (strcat "\n" str " linetype created successfully.")) ) ( (princ (strcat "\nUnable to load linetype " str))) ) (princ) ) (princ) Or have I misunderstood? Thanks Lee! That works pretty slick but not exactly what I'm looking for. Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 Is this something like in a drawing legend? Could the start point of the line be a set vertical and horizontal offset from the insertion point of the text and the line a set length? Or does the line need start and end points? It would be really handy for creating a legend Tyke! I hadn't thought of that but it's a great idea. Quote
BlackBox Posted August 7, 2012 Posted August 7, 2012 It would be really handy for creating a legend Tyke! I hadn't thought of that but it's a great idea. I don't know about your work environment, but we'd get in trouble if we'd perform this task for each, and every project... I'm still trying to get them to understand that we need more than 5 styles in Civil 3D! We have one legend that while updated periodically, relatively remains the same, and is added to each project's General Notes, etc. as a block. Set it up once, and done. Quote
Squirltech Posted August 7, 2012 Author Posted August 7, 2012 I don't know about your work environment, but we'd get in trouble if we'd perform this task for each, and every project... I'm still trying to get them to understand that we need more than 5 styles in Civil 3D! We have one legend that while updated periodically, relatively remains the same, and is added to each project's General Notes, etc. as a block. Set it up once, and done. I am in the field of Land Surveying and currently using ACAD 09 with LDC and we don't have any "real" standards to speak of. This is going to change when we convert over to C3D. So at this point, legends are project specific and are being created for almost every project. Like I said though, this will change in the coming months. (can't wait) Quote
BlackBox Posted August 7, 2012 Posted August 7, 2012 I'm in a similar position... We are transitioning from Land Desktop 2009 to Civil 3D 2011 (our next update is to Civil 3D 2014), and I just transferred from a Transportation group, into a Utility group. My new group has title blocks, details, legends, etc. but nothing is/was standardized (not fonts, text height, etc.), nor automated where possible. This is probably a Civil 3D faux pas, but we're still manually drawing in the pressure mains in the Profile View, because Civil 3D doesn't offer the level of details we need from the Dynamic options (Alignment, Profile, Linked Assembly, etc.). We just use Civil 3D (so far) to speed up our alignments, surfaces, gravity pipe networks, and Profile View creation... we're still 'more' efficient than we were with Land Desktop. LoL 2013 (or 2014 in our case) offers pressure pipe networks, so we'll see how that goes when we get there. You're not alone (CAD Standards-wise), and if you ever need help, let us know. Quote
Tyke Posted August 8, 2012 Posted August 8, 2012 It would be really handy for creating a legend Tyke! I hadn't thought of that but it's a great idea. We are also a surveying company and use both vanilla AutoCAD and Civil 3D (2007 to 2013) and Map 6 and AutoCAD 2002 from way back and like RenderMan we have our own standard legends depending on the job and the client. But that said there are some things that are only occasionally required in a legend and following up on another recent thread, its not always a good thing to overload a drawing with information, so why should a legend be overloaded with lots of symbols and linetypes that are not used in the drawing. Perhaps a routine that automatically creates the legend of just the items in the drawing together with a couple of basic legend items that are always there. Quote
MSasu Posted August 8, 2012 Posted August 8, 2012 Something like this? ; Create Legend County Line routine (08-VIII-2012) (defun c:CLCL( / ssetLabels assocList heightLabel widthLabel pointStart ) (if (not (tblsearch "LTYPE" "PHANTOM")) (command "_.LINETYPE" "_L" "PHANTOM" "acad.lin" "") ) (if (setq ssetLabels (ssget "_X" '((0 . "TEXT") (1 . "COUNTY LINE")))) (while (> (sslength ssetLabels) 0) (setq theLabel (ssname ssetLabels 0) assocList (entget theLabel) heightLabel (cdr (assoc 40 assocList)) pointStart (cdr (assoc 10 assocList))) (entmod (setq assocList (subst '(1 . "COUNTY LINE = ") (assoc 1 assocList) assocList))) (setq widthLabel (textbox assocList) widthLabel (- (car (cadr widthLabel)) (car (car widthLabel)))) (entmakex (list '(0 . "LINE") (cons 10 (setq pointStart (list (+ (car pointStart) widthLabel heightLabel) (+ (cadr pointStart) (* 0.5 heightLabel))))) (cons 11 (polar pointStart 0.0 (* 15.0 heightLabel))) (assoc 8 assocList) (if (assoc 62 assocList) ;tanks to Lee Mac (assoc 62 assocList) (cons 62 0) ) (cons 6 "PHANTOM"))) (ssdel theLabel ssetLabels) ) ) (princ) ) PS. Case sensitive. Quote
Recommended Posts
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.