BELIEW Posted October 31, 2012 Posted October 31, 2012 I am completely new to autolisp. I am simply trying to figure out how to write a lisp that will use existing point numbers to draw a poly line to. for example, if i bring in point numbers into a drawing always numbered 1-10, no matter what coordinates they contain when they are inserted into the drawing, i would like the lisp to draw a poly line from point # 1, to 2, to 3.... etc. I know there is a macro built in to LDD that allows you to draw a line from # to # but i would like the lisp to customize myself. I also do not want to have to physically pick the points i want, i want the lisp to find the points by number. thanks in advance for any help at all. Quote
David Bethel Posted October 31, 2012 Posted October 31, 2012 How is the point data being imported into AutoCAD? -David Quote
BELIEW Posted October 31, 2012 Author Posted October 31, 2012 I am importing them using a .csv file PNEZD point #, northing, easting, elevation, description Quote
David Bethel Posted October 31, 2012 Posted October 31, 2012 You may want to post a sample of the data to ensure what are REAL numbers and what are STRings I would assume: Point# to be an INTeger northing, easting and elevations to be REAL numbers Description to be a STRing -David Quote
BELIEW Posted October 31, 2012 Author Posted October 31, 2012 I'm not at my computer but yes you can assume exactly that. 1, 200.44, 300.56, 256.43, Edge 2, 212.32... Etc Quote
David Bethel Posted October 31, 2012 Posted October 31, 2012 This does absolutely no error checking, data checking, nada thing [b][color=BLACK]([/color][/b]defun c:pt23dpl [b][color=FUCHSIA]([/color][/b]/ file rf nl i cl pl[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not file[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq file [b][color=MAROON]([/color][/b]getfiled [color=#2f4f4f]"CSV Point Data File"[/color] [color=#2f4f4f]""[/color] [color=#2f4f4f]"csv"[/color] 8[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]setq rf [b][color=NAVY]([/color][/b]open file [color=#2f4f4f]"r"[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]setq nl [b][color=MAROON]([/color][/b]read-line rf[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq i 1 cl nil[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]repeat [b][color=MAROON]([/color][/b]strlen nl[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]= [color=#2f4f4f]","[/color] [b][color=BLUE]([/color][/b]substr nl i 1[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]setq cl [b][color=BLUE]([/color][/b]cons i cl[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq cl [b][color=MAROON]([/color][/b]reverse cl[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]setq pl [b][color=MAROON]([/color][/b]cons [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]atof [b][color=RED]([/color][/b]substr nl [b][color=PURPLE]([/color][/b]1+ [b][color=TEAL]([/color][/b]nth 1 cl[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]- [b][color=TEAL]([/color][/b]nth 2 cl[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]nth 1 cl[b][color=TEAL])[/color][/b] 1[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]atof [b][color=RED]([/color][/b]substr nl [b][color=PURPLE]([/color][/b]1+ [b][color=TEAL]([/color][/b]nth 0 cl[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]- [b][color=TEAL]([/color][/b]nth 1 cl[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]nth 0 cl[b][color=TEAL])[/color][/b] 1[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] [b][color=BLUE]([/color][/b]atof [b][color=RED]([/color][/b]substr nl [b][color=PURPLE]([/color][/b]1+ [b][color=TEAL]([/color][/b]nth 2 cl[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]- [b][color=TEAL]([/color][/b]nth 3 cl[b][color=TEAL])[/color][/b] [b][color=TEAL]([/color][/b]nth 2 cl[b][color=TEAL])[/color][/b] 1[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] pl[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]close rf[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.3DPOLY"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]apply 'command [b][color=NAVY]([/color][/b]reverse pl[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b] The data must be in the exact order as described and without any blank lines. AS IS! Have fun! -David POINT.CSV Quote
BELIEW Posted October 31, 2012 Author Posted October 31, 2012 INCREDIBLE! i appreciate all of the help, i realize how time consuming that must have been. i will play with it and come back with questions. thank you thank you! Quote
BIGAL Posted November 1, 2012 Posted November 1, 2012 Throw your csv into excel and make a script 1st pass is insert points 2nd pass join lines 3rd pass insert blocks on certain points. this is known as stringing and their are commercial packages available. Quote
David Bethel Posted November 1, 2012 Posted November 1, 2012 INCREDIBLE! i appreciate all of the help, i realize how time consuming that must have been. i will play with it and come back with questions. thank you thank you! I'm glad it worked. There would be a good many things needed to be added in order to be considered a robust routine. -David Quote
BIGAL Posted November 2, 2012 Posted November 2, 2012 Using excel could be done here is a snap shot of how to just copy column to command line Quote
BELIEW Posted November 2, 2012 Author Posted November 2, 2012 BIGAL, i think i see now what you are talking about with the excel file. seems very useful. do you have basic code that you can read and use this file in LDD? Quote
BIGAL Posted November 3, 2012 Posted November 3, 2012 I dont have code this is why its commercially available for a price, you need to look at the importing of points within Civ3d and LDD and how libraries are set up to work out whats a string and whats a point. There was another post done here pretty sure they got close to making it work. If I was to do it I would do a multi sort start with code then sub sort via point number, then use a look up table is it a line or a point. A bit of surveying coding advice, we use what are known as strings say edge of road but have 2 sides ? ok simple 01edge 02edge so the two are not exactly the same but both are edges and go on the edge layer. Numeric 01403 02403 this method has been around since EDM's became available. Have a look on web for Stringer, civilcad, 12d, Carlson, CADTOOLS ? there will be something out there. 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.