CafeJr Posted October 14, 2013 Posted October 14, 2013 Dears, Someone knows how I can get a length of one arc or object (more than one) and construct a line after it with all lenghts separated for a specific space between each one. Thanks Quote
pBe Posted October 14, 2013 Posted October 14, 2013 Limited to arcs and circles? or to include polylines and ellipse? lets throw in "lines" for all its worth. Quote
CafeJr Posted October 14, 2013 Author Posted October 14, 2013 Noop, a large quantity of them, so normally polylines or circles... It's necessary to get it and change the length on a line (by each one, not the total) with their measured lengths... Quote
pBe Posted October 14, 2013 Posted October 14, 2013 No arcs but plines? (Defun c:demo ( / pt ent len ) (if (setq pt nil ss (ssget)) (repeat (setq i (sslength ss)) (setq ent (ssname ss (Setq i (1- i))) len (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent ))) (if (null pt) (progn (setq pt (getpoint "\nPick start point:")) (Setq dst (getdist pt "\nDistance between lines:"))) (setq pt (polar pt 0.0 dst))) (entmakex (list (cons 0 "LINE") (cons 10 pt) (cons 11 (polar pt (* pi 1.5) len)))) ) )(princ) ) Quote
CafeJr Posted October 14, 2013 Author Posted October 14, 2013 I'm sorry pBe... It's with arcs, plines and circles!!... Quote
CafeJr Posted October 14, 2013 Author Posted October 14, 2013 Ok, pBe... It's working very nice!!!... Thank you!!!... On "simple" lines you helped me a lot!!!... Some friends and I spent much time doing it manually!!!... Quote
pBe Posted October 14, 2013 Posted October 14, 2013 Ok, pBe... It's working very nice!!!... Thank you!!!... On "simple" lines you helped me a lot!!!... Some friends and I spent much time doing it manually!!!... You are welcome, Glad it works for you. Happy to help Cheers Quote
CafeJr Posted October 15, 2013 Author Posted October 15, 2013 Dear pBe, I got some troubles with the command, could you help-me looking the file attached to try to solve or try to tell me what to do!?... Thanks... Length of PLs.dwg Quote
jdiala Posted October 15, 2013 Posted October 15, 2013 How about this: (defun C:test (/ ss e l i p d) (setq ss (ssget "_:L" '((0 . "CIRCLE,ARC,LWPOLYLINE"))) p (getpoint "\nPick a point") d (getdist p "\nDistance between lines ; ") ) (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))) l (cond ((vlax-property-available-p e 'length) (vla-get-length e)) ((vlax-property-available-p e 'circumference) (vla-get-circumference e)) ((vlax-property-available-p e 'arclength) (vla-get-arclength e)) ) ) (entmake (list '(0 . "LINE") (cons 10 p) (cons 11 (polar p (* pi 1.5) l)) ) ) (setq p (polar p 0 d)) ) (princ) ) Quote
CafeJr Posted October 15, 2013 Author Posted October 15, 2013 Noop... yet!... The length of the objects are different from the lines created... Length of PLs 2.dwg Quote
pBe Posted October 15, 2013 Posted October 15, 2013 (edited) Dear pBe, I got some troubles with the command, could you help-me looking the file attached to try to solve or try to tell me what to do!?... Thanks... As far as i can tell the demo lisp will give you the correct length. Troubles? In what way CafeJr? Do you select all the entities in one go? we can modify the code to recognize which lines goes where if that's how you want it. Here you go: (Defun c:demo (/ pt ent len sp ep pt1) (if (setq pt nil ss (ssget '((0 . "CIRCLE,ARC,*LINE"))) ) (repeat (setq i (sslength ss)) (setq ent (ssname ss (Setq i (1- i))) len (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) sp (Vlax-curve-getstartpoint ent) ep (Vlax-curve-getendpoint ent) ) (if (null pt) (setq pt (getpoint "\nPick start point:")) ) (entmakex (list (cons 0 "LINE") (cons 10 (setq pt1 (list (min (Car sp) (car ep)) (cadr pt))) ) (cons 11 (polar pt1 (* pi 1.5) len)) ) ) ) ) (princ) ) Edited October 15, 2013 by pBe Add lisp code Quote
CafeJr Posted October 16, 2013 Author Posted October 16, 2013 pBe, I can't try it right now... tomorrow I'll do it... So, the trouble it's the length on original polyline is different of the line created, as the second file that I showed here!... I don't know why it happens, so, the length in lines don't match with the plines... Quote
jdiala Posted October 16, 2013 Posted October 16, 2013 This will work as long as entities does not overlap and arranged horizontally. (defun C:test (/ ss p l i d v) (setq ss (ssget "_:L" '((0 . "CIRCLE,ARC,*OLYLINE"))) p (getpoint "\nPick a point") d (getdist p "\nDistance between lines ; ") ) (foreach x (vl-sort (repeat (setq i (sslength ss)) (setq i (1- i) l (cons (ssname ss i) l) ) ) (function (lambda (x1 x2) (< (car (cdr (assoc 10 (entget x1) ) ) ) (car (cdr (assoc 10 (entget x2) ) ) ) ) ) ) ) (setq v (vlax-ename->vla-object x) l (cond ((vlax-property-available-p v 'length) (vla-get-length v)) ((vlax-property-available-p v 'circumference) (vla-get-circumference v)) ((vlax-property-available-p v 'arclength) (vla-get-arclength v)) ) ) (entmake (list (cons 0 "LINE") (cons 10 p) (cons 11 (polar p (* pi 1.5) l)) ) ) (setq p (polar p 0 d)) ) (princ) ) (vl-load-com) Quote
CafeJr Posted October 16, 2013 Author Posted October 16, 2013 Now it's working... Thank you pBe and jandiala, it help me a lot to do one application!... I'm grateful!!!... I got only one line on the file 2 (attached on another post) that the length don't mach, but no problem... Quote
pBe Posted October 16, 2013 Posted October 16, 2013 Now it's working... Thank you pBe and jandiala, it help me a lot to do one application!... I'm grateful!!!.... Glad it works for you. I got only one line on the file 2 (attached on another post) that the length don't mach, but no problem... And what would that be this time CafeJr? Quote
CafeJr Posted October 16, 2013 Author Posted October 16, 2013 Don't worry pBe... the code that you wrote help as far as I expect!!!... So, to you look what I'm telling see the attached file!... Item 103... Thanks again and regards... Length of PLs 3.dwg Quote
CafeJr Posted October 16, 2013 Author Posted October 16, 2013 pBe, it's possible check the length before write it?... To confirm the length data?!... Quote
pBe Posted October 17, 2013 Posted October 17, 2013 So, to you look what I'm telling see the attached file!... Item 103... As jdiala said. as long as entities does not overlap. simply put, there are 2 Items at the 103rd position . so there actually 135 and 134 pBe, it's possible check the length before write it?... To confirm the length data?!... Why do you need to check the length? the program does that for you. Quote
CafeJr Posted October 17, 2013 Author Posted October 17, 2013 As jdiala said. as long as entities does not overlap. simply put, there are 2 Items at the 103rd position . so there actually 135 and 134 Why do you need to check the length? the program does that for you. pBe, Thanks a lot to help!!!... It's working as good as I need!... I'm really shamed about it, 2 entities on items 103rd cause I didn't saw it!... Ok, my mistake!... About to check is only one way to confirm how many objects was read and drawed, some thing that could help to avoid it, it's possible another guy repeat the same mistake... 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.