tomjas Posted March 4, 2010 Posted March 4, 2010 Hi there, I have excel file with coordinates and labels of links. Format is: Link Label, X-of starting point, Y-of starting point, X-of end point, Y-of end point Is it possible to import this to CAD and draw a line or pline (using lisp) starting in XY (start point) ending in XY (end point) AND PLACE A TEXT OR MTEXT WITH THE LINK LABEL ABOVE THIS LINE? I can import points and labels using Civil 3D- but I can’t draw a line between them and place this label above the line (in the center of line). I have about 2000 links like this and sometimes end point of one link is in the same place as starting point of other link- so if I’ll place a label using Civil 3D=labels are on top of each other… I’ve found lisp to draw a lines from excel files using coordinates- but no labels. I can see potential problem- how to ‘tell’ CAD to draw separate links rather than one continuous line between all points? So if I have 2000 lines like: Link Label, X-of starting point, Y-of starting point, X-of end point, Y-of end point I want 2000 separate links with labels. Hopefully you will understand what I’m trying to do (as English is not my first language) Thanks for your help in advance Kind regards, Tom Please find enclosed file (excel) with two sample lines coord.zip Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 You can do it with a macro on excel, using the "-text" command you can set the angle of text to the angle of the line, and you can set the point of the text to the middle too. Quote
tomjas Posted March 4, 2010 Author Posted March 4, 2010 Thanks for quick replay. Any idea how to do this? Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 See the attach zip, this could lead you a way. If you dont' get the ideia, send me the entire document, i can help you on the lunch coord2.zip Quote
tomjas Posted March 4, 2010 Author Posted March 4, 2010 File with 500 rows attached. I can see the math calculations in excel (like in the school years ago ) Can you explain me how to use it in practice, please? How to use it for let say those 500 rows and how to use it with CAD? Can you use this excel file staight into CAD? Thanks Link Diagram.zip Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 Yes, just copy trough the Line command until Label 1, and paste on the autocad menu(right clic + paste). To do it with all the labels, is needed a VBA for excel prog.It's quite simple, after 12:00(brazilian time) i can do it. Quote
tomjas Posted March 4, 2010 Author Posted March 4, 2010 I’ve copied as you said and paste in CAD. Working The only thing is: instead of label I have angle value, and the text is rotated by 20 degree which is text height value, so I’ve changed order in your coord2 file and now I have label with the same rotation angle as line- which is exactly what I need GREAT! Now the tricky bit- how to do the same for 500 rows- copy and paste every single one is not the best option so I’m waiting for 12 Brazilian time Thanks Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 Hi mate, see if it fit's to you. Now i cannot afford much time on this, so, a few text could have a wrong angle, but all is placed on the mid point of the line. Indeed, i need do make a angle recognize for each angle. I will update it when i have time. You could add as many lines to the sheet as you want. See ya Link Diagram.zip Quote
tomjas Posted March 4, 2010 Author Posted March 4, 2010 Thank you very much for your help!!! I'll play with it. Thanks to you I can understand method- rather then just use the solution. Take care Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 You are welcome. I will fix it when i have time, there are many text on the wrong angle. Quote
BlackAlnet Posted March 4, 2010 Posted March 4, 2010 There is it, update to text on the right angle. Hope it helps, cheers. Link Diagram2.zip Quote
tomjas Posted March 5, 2010 Author Posted March 5, 2010 Thanks for that. Unfortunately there are problems with text angle...... Quote
BlackAlnet Posted March 5, 2010 Posted March 5, 2010 Really? The last one works fine here.See the image attach. Edit: I could do a lisp for it, but the "work how" of the lisp will be the same as the excel sheet. Quote
tomjas Posted March 8, 2010 Author Posted March 8, 2010 Hi BlackAlnet Thanks for your effort. I’ve noticed that you are using Civl 2008. I’m using CAD 2010 (and still have 2009 installed). Unfortunately is not working with those versions (see screenshot). I thing that -text function is a bit different in 2010 (and 2009) than 2008, because is using value 20 as a text rotation angle rather than text size. And if you delete let say 200 rows- is still preparing those 500 links. Based on your ideas- I’ve prepared excel spreadsheet which is working in CAD 2009 and 2010. It’s not perfect but is working. This will ‘detect’ how many rows of data you have, there is no option for text height (you can change it easily in CAD), you still have to be in first spreadsheet when running macro… but is doing what I need. Once again thank you very much for your effort and ideas. Regards, Tom P.S. Maybe you know how to place a block on the end (end point with the same rotation angle as line) of each line (which I've changed to pline), so I can see 'direction' of each link? If we will place let say arrow block on the end of each pline using lisp -that will be just great :wink: Links.zip Quote
BlackAlnet Posted March 8, 2010 Posted March 8, 2010 You are welcome I'm Happy i could help you. Instead of solving the questions, it's much better to help someone get the answer. When you say "direction", do you mean Azimute? A angle based on North? Or u mean the link to a--->b and a arrow pointing a to b direction? See if it fit's to u. http://www.cadtutor.net/forum/showthread.php?t=42954 Quote
BlackAlnet Posted March 8, 2010 Posted March 8, 2010 Here is the sample .xls, hope it helps you. Link Diagram3.zip Quote
CM Hew Posted March 9, 2010 Posted March 9, 2010 I have some routines that I use for my work, importing xy coordinates and using information to set out etc... I have adapted one of the routines to plot the labels between the coordinates. But the drawback is the arrow diagram which is a text ">" depending on the input coordinates. Load XYmore.lsp and type "XYmore" to run. In the dialog box, select the XYmore CSV file that I have created using your data. Choose appropriate text height when prompted. Zoom "all" to view. Hope this works for you xymoreLSP.lsp xymore txt.txt Quote
tomjas Posted March 9, 2010 Author Posted March 9, 2010 Results on my machine are 'slightly' different (see screenshot with black lines) I've sorted this one using excel (see screenshot with purple lines- but still no luck with text height) but one nice lisp routine will be much better... 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.