Tharwat Posted March 13, 2014 Share Posted March 13, 2014 The routine does not work on the other line because it has Z coordinates I guess , anyway I updated the code . Try it and let me know . Good luck Quote Link to comment Share on other sites More sharing options...
Wojciech Posted March 13, 2014 Author Share Posted March 13, 2014 Thank You Tharwat! Script works great! I have detected a little problem with "Specify point at the End Side of Polyline". First line is not the longer one all the time. I was describe it in dwg file: http://feniksg.unixstorm.org/ftp/little_problem.dwg Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2014 Share Posted March 14, 2014 Thank You Tharwat! Script works great! Excellent , happy too hear that . I have detected a little problem with "Specify point at the End Side of Polyline". First line is not the longer one all the time. I was describe it in dwg file: That result can not be considered as a problem because the start of the polyline or line is on the other side so the code started drafting lines from start to end and due to the length of the object the last line came by coincidence the shortest at the end and that's why you have the start with the short line first I will see what I can do with it very soon . Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2014 Share Posted March 14, 2014 Try this which should meet your new requirements and let me know . (defun c:test (/ *error* Draw_Dynamic_Real s ang sn pt a b d g p gp len j x ) ;; Tharwat 14. Mar. 2014 ;; (defun *error* (x) (redraw) (if (wcmatch (strcase x) "*EXIT*,*CANCEL*,*BREAK*") (princ x) (princ (strcat "\n Error: " x)) ) ) (if (and (setq p (getpoint "\n Specify point at the End Side of Polyline :") ) (if (setq s (ssget p '((0 . "LWPOLYLINE,SPLINE,LINE,ARC")))) t (Alert "Pick a point at the end of [ LWPOLYLINE,SPLINE,LINE,ARC ] only ." ) ) ) (progn (defun Draw_Dynamic_Real (sn o x sp k r / f d i n l ang pt) (setq d (/ (vlax-curve-getdistatparam sn (vlax-curve-getendparam sn)) o ) i o l (list (* o 0.5) (* o 1.5)) f l ) (if (> sp 0.) (setq n sp) (setq n i) ) (if (= k 0) (setq f (reverse f)) (setq f l) ) (repeat (fix d) (setq ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv sn (vlax-curve-getparamatpoint sn (setq pt (vlax-curve-getpointatdist sn n)) ) ) ) n (+ n i) ) (if r (entmake (list '(0 . "LINE") (cons 8 "test") (cons 10 pt) (cons 11 (polar pt (if x (+ ang (* pi 0.5)) (+ ang (* pi 1.5)) ) (car (setq f (reverse f))) ) ) ) ) (grdraw pt (polar pt (if x (+ ang (* pi 0.5)) (+ ang (* pi 1.5)) ) (car (setq l (reverse l))) ) 1 0 ) ) ) (princ) ) (setq d 1.5 len (vlax-curve-getdistatparam (setq sn (ssname s 0)) (vlax-curve-getendparam sn) ) ) (if (< (distance (setq a (vlax-curve-getstartpoint sn)) p) (distance (setq b (vlax-curve-getendpoint sn)) p) ) (setq p a gp 0. ) (setq p b gp (rem len d) j (rem (fix (/ len 1.5)) 2) ) ) (while (eq (car (setq g (grread t 13 0))) 5) (redraw) (if (minusp (sin (- (angle p (polar p (angle b a) (/ len 1000.))) (angle p (cadr g)) ) ) ) (setq x nil) (setq x t) ) (Draw_Dynamic_Real sn d x gp j nil) ) (if (eq (car g) 3) (Draw_Dynamic_Real sn d x gp j t) ) ) ) (redraw) (princ) ) (vl-load-com) Quote Link to comment Share on other sites More sharing options...
Wojciech Posted March 14, 2014 Author Share Posted March 14, 2014 Thank you very much Tharwat. You wrote a script that automatically draws something that is so boring in drawing and there is so much to draw. Your script drew 4,500 strokes today. There is still probably 4 times as much and I think that will draw even an infinite number. The script could be expanded by a further explicit function without end, but it seems to me that you've done enough. I did not foresee little that someone would go so smoothly write the script. Maybe someday could be a play, so the script was more flexible and allow drawing at a certain distance of other things such as dimensions, descriptions, dystance, specific hatch, insert blocks and trim of your line to a lines with a specific layers (if it is possible). Same description that would take me a long time (in the drawing). Maybe someday. I think that I should study programming language lisp. Thank you very much Tharwat. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2014 Share Posted March 14, 2014 Thank you very much Tharwat. You wrote a script that automatically draws something that is so boring in drawing and there is so much to draw. Your script drew 4,500 strokes today. There is still probably 4 times as much and I think that will draw even an infinite number. The script could be expanded by a further explicit function without end, but it seems to me that you've done enough. I did not foresee little that someone would go so smoothly write the script. Maybe someday could be a play, so the script was more flexible and allow drawing at a certain distance of other things such as dimensions, descriptions, dystance, specific hatch, insert blocks and trim of your line to a lines with a specific layers (if it is possible). Same description that would take me a long time (in the drawing). Maybe someday. I think that I should study programming language lisp. Thank you very much Tharwat. Great . I am happy to hear that . You're very welcome any time . Quote Link to comment Share on other sites More sharing options...
Guest Posted March 14, 2014 Share Posted March 14, 2014 Nice job Tharwat Wojciech for this job i use this line *line1,-||-||-||-||-||-||-||-||-||-||-||-||-||-||- A,0.8,["|",STANDARD,s=1,r=0,x=0,y=0.35],0.8,["|",STANDARD,s=0.55,r=0,x=0,y=0.2],0 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 14, 2014 Share Posted March 14, 2014 Nice job Tharwat Thank you Quote Link to comment Share on other sites More sharing options...
Wojciech Posted March 25, 2014 Author Share Posted March 25, 2014 Hi! I have some problem with using Tharwat's script. It's work perfectly, but it's using polyline to make "offsets". If I have lines, I have to convert them to polylines. I have some script to do this. ;; PolylineJoin.lsp [command name: PJ] ;; Based on c:pljoin by beaufordt from AutoCAD Customization Discussion Group ;; Streamlined by Kent Cooper, June 2011 (defun C:PJ (/ cmde peac ss); = Polyline Join (princ "\nTo join touching objects into Polyline(s) [pick 1 to join all possible objects to it],") (setq ss (ssget '((0 . "LINE,ARC,*POLYLINE"))) cmde (getvar 'cmdecho) peac (getvar 'peditaccept) ); end setq (setvar 'cmdecho 0) (setvar 'peditaccept 1) (if ss (if (= (sslength ss) 1) (command "_.pedit" ss "_join" "_all" "" ""); then (command "_.pedit" "_multiple" ss "" "_join" "0.0" ""); else ); end inner if ); end outer if (setvar 'cmdecho cmde) (setvar 'peditaccept peac) (princ) ); end defun But this script has one drawback. It combines all of the lines that are adjacent to each other. Could you edit this script to make something like this: At this moment script working like this: I would like to connect to polyline lines on the same style, color and layer only. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2014 Share Posted March 26, 2014 (if (setq s (ssget p '((0 . "[color=red]LWPOLYLINE,SPLINE,LINE,ARC[/color]")))) Hi! I have some problem with using Tharwat's script. It's work perfectly, but it's using polyline to make "offsets". If I have lines, I have to convert them to polylines. I have some script to do this. That's not true at all , you are looking for something completely different with your last reply so you can not say that my routine does not work with lines or only with Polylines , the highlighted Object names from my last routine supports what I am saying . Quote Link to comment Share on other sites More sharing options...
Wojciech Posted March 26, 2014 Author Share Posted March 26, 2014 No. No. No. You misunderstand me now. I'm glad you're here again. Look. If I need to make a smart offset on the line, I'm doing it on the line. If I need to do it on the arc I'm doing it on the arc. But often I operate polylines. I'm getting from other workers lines and arcs and I need in a controlled way to connect lines and arcs in polylines. I'm doing it with this script, which is not perfect for me, so I would like to ask for it improvement. I wish I hadn't started a separate thread, because only You messed up in the head. Your script works exactly like I wanted and I thank you for it very much, but apart from that I need tool to connect the line to polylines when I operate adjoining lines and arcs. I do not want it to be added to the code in your script, because I want to control it. Do you understand now? Sorry for my english. I'm leaving for a few days. Yours sincerely. edit: On those screens are visible separate lines that are combined into polylines. The idea is that by clicking on the first line or arc merged into polylines but with lines or arcs of the same layer, style and color. Quote Link to comment Share on other sites More sharing options...
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.