avinashg Posted August 27, 2012 Posted August 27, 2012 Hi All, I am new to this forum and lisp. Trying to create cross sections of drain using lisp.The details of are fed from excel for each cross section.I am stuck as I was not able to figure out the way to offset line/polyline by selecting the lines and offset distance from the program itself. Any help would be appreciated. Thanks in advance. Cross SectionOf EWE H-100ch 0 to 575m.dwg read_excel_data_to_array.lsp drain.xls I have grabbed the code given by Fixo to read data from excel (http://www.cadtutor.net/forum/showthread.php?41910-Read-Excel-Data-Cells-and-Draw-in-AutoCAD-thru-LISP/page2). Thanks Fixo. Quote
Dadgad Posted August 27, 2012 Posted August 27, 2012 In order to start a lisp you need to enter the shortcall for the lisp, which will likely be at least two letters, that is assuming that it is already loaded. In order to start the OFFSET command you enter the letter O. How many key strokes are you hoping to save? Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 In order to start a lisp you need to enter the shortcall for the lisp, which will likely be at least two letters, that is assuming that it is already loaded.In order to start the OFFSET command you enter the letter O. How many key strokes are you hoping to save? Dadgad, What do u mean by strokes.(Sorry I am a newbee in lisp) I have already created polyline using lisps i need to offset the same polyline using same program. Quote
ReMark Posted August 27, 2012 Posted August 27, 2012 Maybe a look at a lisp program Lee Mac wrote, called Double Offset, holds some clues about how to do what you want. http://lee-mac.com/doubleoffset.html Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 I have already created polyline using lisps i need to offset the same polyline using same program. Check this out , and you can change the minus to plus to play with the two sides (defun c:Test (/ d side s i) (vl-load-com) (setq d 1.0) (if (setq s (ssget "_:L" '((0 . "LINE")))) (repeat (setq i (sslength s)) (vla-offset (vlax-ename->vla-object (ssname s (setq i (1- i)))) (- d)) ) ) (princ) ) Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Was the original post deleted? Am not sure something might have happened anyhow m re posting it. Hi all, I am trying to create cross sections of drain using lisp data fed from excel.(Used the code posted by fixo in some thread) and drawing polylines and lines. I am struck as I am not able to figure out how to offset a line/polyline without prompting for selecting line and offset distance. Here are the files If anyone (with little free time) can help me by creating the program will be very gratefull. drain.xls read_excel_data_to_array.lsp Cross SectionOf EWE H-100ch 0 to 575m.dwg Quote
Dadgad Posted August 27, 2012 Posted August 27, 2012 Welcome to the forum. Your first post was not a post, just the thread title, with no additional information. :wink: Now I understand that you are looking to add an OFFSET command into an existing lisp. Sorry I am lisp-challenged myself, but it doesn't sound too difficult, Iam sure somebody will straighten you out. By key strokes, I mean each time you enter a character on your keyboard. Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Maybe a look at a lisp program Lee Mac wrote, called Double Offset, holds some clues about how to do what you want. http://lee-mac.com/doubleoffset.html Will check it out.Thanks Check this out , and you can change the minus to plus to play with the two sides Thanks Tharwat will try this one. Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Check this out , and you can change the minus to plus to play with the two sides (defun c:Test (/ d side s i) (vl-load-com) (setq d 1.0) (if (setq s (ssget "_:L" '((0 . "LINE")))) (repeat (setq i (sslength s)) (vla-offset (vlax-ename->vla-object (ssname s (setq i (1- i)))) (- d)) ) ) (princ) ) Tharwat, This program even though creates offset will prompt to select line. (ssget "_:L" '((0 . "LINE"))) Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 Tharwat,This program even though creates offset will prompt to select line. (ssget "_:L" '((0 . "LINE"))) Yes , according to what you have mentioned in the title of the thread . * Does it mean that you want to offset all Polylines one time ? * How long is the distance ? Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Is there any way I can offset a line without prompting to select line. Like select line in the background by referring to its points Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 Is there any way I can offset a line without prompting to select line.Like select line in the background by referring to its points Yes , replace this .. (ssget "_:L" '((0 . "LINE"))) with this .. ( but unlock all layers that might any line lay on ) (ssget "_x" '((0 . "LINE"))) Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Yes , according to what you have mentioned in the title of the thread . * Does it mean that you want to offset all Polylines one time ? * How long is the distance ? Yes offset all polylines at once or selected polylines at once. A polygon created using polyline. Distance is around 5 Please have a look at this. Cross SectionOf EWE H-100ch 0 to 575m.dwg Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Yes , replace this .. (ssget "_:L" '((0 . "LINE"))) with this .. ( but unlock all layers that might any line lay on ) (ssget "_x" '((0 . "LINE"))) Tharwat, I am getting the prompt for selecting objects even after replacing as you said .Along with this error. Error: bad argument type: lentityp <Selection set: 85> Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 Like this . (defun c:Test (/ d side s i) (vl-load-com) (setq d 1.0) [b][color=red];;; <= change the distance to meet your needs[/color][/b] (if (setq s (ssget "_[b]x[/b]" '((0 . "[color=red][b]LINE[/b][/color]")))) [b][color=red];;; <= change entity type to Polyline if you want[/color][/b] (repeat (setq i (sslength s)) (vla-offset (vlax-ename->vla-object (ssname s (setq i (1- i)))) ([b][color=red]-[/color][/b] d)) [b][color=red];; <= change from minus to plus if you want the opposite side[/color][/b] ) ) (princ) ) Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 Thanks a lot Tharwat it offsets all lines in the drawing. Is there any way I can select lines within a specific region. Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 Thanks a lot Tharwat it offsets all lines in the drawing. You're welcome anytime Is there any way I can select lines within a specific region. Which region do you mean ? Model , and Layouts ??? Quote
avinashg Posted August 27, 2012 Author Posted August 27, 2012 I need to select two line in the model and offset those two. Just guessing whether it can be done specifying rectangular region(as in when selecting in gui) or by specifying the points of lines Hope it makes sense. Quote
Tharwat Posted August 27, 2012 Posted August 27, 2012 I need to select two line in the model and offset those two.Just guessing whether it can be done specifying rectangular region(as in when selecting in gui) or by specifying the points of lines Hope it makes sense. If you mean rectangular selection set , you can go back to my first routine and it would help you with it , otherwise more details needed 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.