bigmaz Posted July 23, 2012 Posted July 23, 2012 Hi, we have recieved a Bathymetric survey, and the levels have been done in such a stupid way. Say the level at a certain point is 6.7, the numbers have been split into 2 single line text boxes. The number 6 is double the size of the number 7. We need the levels so we can convert the text into 3D, as it is currently all 2D, and there is no points in the drawing, so need to convert text to 3D in Civil 3D. But obviously need all the levels to have the 2 numbers in the same single line text. Anyone got any ideas how i could do this? Regards Martin Quote
Tharwat Posted July 23, 2012 Posted July 23, 2012 Use the command in the express tools ( if you have it of course) called :txt2mtxt Quote
eldon Posted July 23, 2012 Posted July 23, 2012 Hi, we have received a Bathymetric survey, and the levels have been done in such a stupid way. NOT a stupid way. I think that you should say that the levels have been presented in the old fashioned way, consistent with conventional hand drawn charts, and unfortunately not compatible with CAD. Ask the supplier of the survey to give you CAD compatible data. Quote
Dadgad Posted July 23, 2012 Posted July 23, 2012 I think Lee Mac has a nice solution for you. http://www.lee-mac.com/text2mtext.html Thanks Lee! Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 NOT a stupid way. I think that you should say that the levels have been presented in the old fashioned way, consistent with conventional hand drawn charts, and unfortunately not compatible with CAD. Ask the supplier of the survey to give you CAD compatible data. Sorry Eldon, I shouldnt have said "stupid". I appreciate what format it has been done in, and it is an old fashioned way. We are going to contact the surveyors, but we were looking for a qucik solution. Thanks Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 Unfortunately the text to mtext option is not a valid option, thats the first thing I said before I seen the drawing, but there are thousands of individual Dtext objects. I would take forever to go through the survey. Quote
eldon Posted July 23, 2012 Posted July 23, 2012 You should make sure what units are being used. Conventionally, the large figure was Fathoms and the smaller one was Feet. But if you have any small figures which are larger than 6, then it is probably a decimal system, but not CAD friendly. Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 I am able to filter out the large numbers and delete them. Which leaves me with lots of small numbers. If I could insert the large number into dtext with the small number, that would help. Could I do this? Below is an example of what I want to do Quote
Lee Mac Posted July 23, 2012 Posted July 23, 2012 Hi Martin, Assuming the smaller text items are closer to each of the corresponding larger text items than the surrounding text, try the following: [color=GREEN];; Fix Text - Lee Mac 2012[/color] [color=GREEN];; Prompts for a selection of Text objects and groups the selected objects[/color] [color=GREEN];; by equal text height. For each item in the group with smallest text height,[/color] [color=GREEN];; the program will find the closest item in the group with largest text height[/color] [color=GREEN];; and modify the content of the smaller item to hold the value of the larger[/color] [color=GREEN];; item, separated by a point.[/color] ([color=BLUE]defun[/color] c:fixtxt ( [color=BLUE]/[/color] a d e i l s x z ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"TEXT"[/color])))) ([color=BLUE]progn[/color] ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s)) ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i)))) l ([color=BLUE]cons[/color] ([color=BLUE]list[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 40 e)) ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 10 e)) e) l) ) ) ([color=BLUE]setq[/color] l ([color=BLUE]vl-sort[/color] (LM:GroupByFunction l ([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]=[/color] ([color=BLUE]car[/color] a) ([color=BLUE]car[/color] b)))) '([color=BLUE]lambda[/color] ( a b ) ([color=BLUE]<[/color] ([color=BLUE]caar[/color] a) ([color=BLUE]caar[/color] b))) ) ) ([color=BLUE]setq[/color] a ([color=BLUE]last[/color] l)) ([color=BLUE]foreach[/color] b ([color=BLUE]car[/color] l) ([color=BLUE]if[/color] a ([color=BLUE]progn[/color] ([color=BLUE]setq[/color] d ([color=BLUE]distance[/color] ([color=BLUE]cadr[/color] b) ([color=BLUE]cadar[/color] a)) e ([color=BLUE]caddr[/color] b) x ([color=BLUE]car[/color] a) ) ([color=BLUE]foreach[/color] y ([color=BLUE]cdr[/color] a) ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]setq[/color] z ([color=BLUE]distance[/color] ([color=BLUE]cadr[/color] b) ([color=BLUE]cadr[/color] y))) d) ([color=BLUE]setq[/color] d z x y) ) ) ([color=BLUE]entmod[/color] ([color=BLUE]subst[/color] ([color=BLUE]cons[/color] 1 ([color=BLUE]strcat[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1 ([color=BLUE]caddr[/color] x))) [color=MAROON]"."[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1 e)))) ([color=BLUE]assoc[/color] 1 e) e)) ([color=BLUE]entdel[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] -1 ([color=BLUE]caddr[/color] x)))) ([color=BLUE]setq[/color] a ([color=BLUE]vl-remove[/color] x a)) ) ) ) ) ) ([color=BLUE]princ[/color]) ) [color=GREEN];; Group By Function - Lee Mac[/color] [color=GREEN];; Groups items considered equal by a given predicate function[/color] ([color=BLUE]defun[/color] LM:GroupByFunction ( lst fun [color=BLUE]/[/color] tmp1 tmp2 x1 ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] x1 ([color=BLUE]car[/color] lst)) ([color=BLUE]progn[/color] ([color=BLUE]foreach[/color] x2 ([color=BLUE]cdr[/color] lst) ([color=BLUE]if[/color] (fun x1 x2) ([color=BLUE]setq[/color] tmp1 ([color=BLUE]cons[/color] x2 tmp1)) ([color=BLUE]setq[/color] tmp2 ([color=BLUE]cons[/color] x2 tmp2)) ) ) ([color=BLUE]cons[/color] ([color=BLUE]cons[/color] x1 ([color=BLUE]reverse[/color] tmp1)) (LM:GroupByFunction ([color=BLUE]reverse[/color] tmp2) fun)) ) ) ) ([color=BLUE]princ[/color]) Quote
Dadgad Posted July 23, 2012 Posted July 23, 2012 Damn, you do nice work Lee. I just hope Martin hasn't hunkered down to start doing thousands of these by hand, and that he sees this before the surveyors send him another version. Quote
Lee Mac Posted July 23, 2012 Posted July 23, 2012 Damn, you do nice work Lee. I just hope Martin hasn't hunkered down to start doing thousands of these by hand, and that he sees this before the surveyors send him another version. Cheers Dadgad I hope so too! Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 Hi Lee, man, as usual, you are amazing!!! I have already done a work around using this lisp you created: http://www.cadtutor.net/forum/showthread.php?64606-Prefix-Suffix-add-to-numbers-or-text I just layered the levels, and then deleted all the large numbers by filtering the size, then each layer using the prefix lisp. Never took long at all, but not as quick as the lisp u just posted there, doh, hehe!!! Thanks again Lee Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 Actually, just tried that lisp, and it does not work when I window the whole lot of numbers. It works if i use a smaller window, over fewer dtext objects. Is there a limit on how many it can process at a time Lee? I have 38,052 dtext objects Quote
Lee Mac Posted July 23, 2012 Posted July 23, 2012 Hi Lee, man, as usual, you are amazing!!! I have already done a work around using this lisp you created: http://www.cadtutor.net/forum/showthread.php?64606-Prefix-Suffix-add-to-numbers-or-text I just layered the levels, and then deleted all the large numbers by filtering the size, then each layer using the prefix lisp. Never took long at all, but not as quick as the lisp u just posted there, doh, hehe!!! Thanks again Lee Thanks Martin, I'm delighted that you were able to find a solution. That reminds me, I need to add that prefix/suffix utility to my site at some point... Actually, just tried that lisp, and it does not work when I window the whole lot of numbers. It works if i use a smaller window, over fewer dtext objects. Is there a limit on how many it can process at a time Lee? I have 38,052 dtext objects 38,000! Wow - you certainly might want to process that lot in a few selections... the algorithm implemented in the program I posted is not fully optimised (I wasn't going to spend too long on it) and hence may be slow on large sets of Text objects. Out of interest, what error do you encounter? Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 38,000! Wow - you certainly might want to process that lot in a few selections... the algorithm implemented in the program I posted is not fully optimised (I wasn't going to spend too long on it) and hence may be slow on large sets of Text objects. Out of interest, what error do you encounter? By the way, lovin ur site got lotsa lisps off it. I do not actually get any error, it actually changes some, and it seems to stay in the command, i just press escape and it comes out the command. Quote
bigmaz Posted July 23, 2012 Author Posted July 23, 2012 This is the command line after I slect the objects It doesnt crash or anything, I just press esc and it go's back to the command line EDIT: Actually, it seems to change a very small amount in the top right corner Quote
Lee Mac Posted July 23, 2012 Posted July 23, 2012 By the way, lovin ur site got lotsa lisps off it. Excellent, I'm glad you like it! I do not actually get any error, it actually changes some, and it seems to stay in the command, i just press escape and it comes out the command. That's what I would have expected - it's a result of the algorithm that I have implemented in the program coupled with the vast number of objects in the selection. The program would eventually finish processing and would convert all objects if you left it to work, though it may take some time. To explain the process: the program first prompts for a selection of all Text objects to be processed. From this selection, it will construct a list of lists, where each sublist contains the text height, insertion point and DXF data for each text object. The program will then group these sublists by the text height, so that all objects with the same text height are grouped together in a single list. The groups are then sorted by height (this operation will likely be short, since there will usually only be two groups of objects). Now, for each item in the list of smaller text objects, the program will iterate over every item in the list of larger text objects and retrieve the object whose insertion point is closest to that of the smaller text object. The content of this closest larger text item is concatenated with that of the smaller text item (complete with a point separator), and the larger text item is then removed from the list of large text items. The program then repeats the process with the next item from the list of smaller text objects. As you can see, the algorithm will indeed terminate when all of the smaller text objects have been processed, though, by iterating over the set of larger objects for each smaller object, the algorithm is likely take a long time for large sets of objects. Quote
bigmaz Posted July 24, 2012 Author Posted July 24, 2012 Hi Lee, I left it for a couple of minutes, and like you said, it worked its way through the whole drawing great stuff. Sorry, that will teach me to be more patient in future, hehe! What an amazing lisp, we are going to be recieving another one similar soon, so will use it for that one Thanks again, and keep up the good work you are doing. Martin 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.