gilsoto13 Posted April 15, 2010 Share Posted April 15, 2010 Hi, Everyone... Part of me is working on a drawing inserting points at each vertex of selected poylines, but the lisp I am using works too slow.. This one works a lot faster... maybe 10 times faster.. It inserts circles at each vertex.. then I can convert them to points with another lisp... but this one does not insert circles at the z coordinate... how would you add this feature? http://forums.augi.com/showpost.php?p=344138&postcount=5 (defun c:foo () (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0) (repeat (/ (length c) 2) [color=red] (setq x (nth i c) y (nth (1+ i) c)) [/color] (vla-addcircle *model-space* (vlax-3d-point (list x y [color=red]0.0[/color])) 3.0) (setq i (+ i 2)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 15, 2010 Share Posted April 15, 2010 LWPolyline: stored in Elevation variable, Coordinates gives X & Y 3DPolyline: Coordinates gives X, Y & Z I think 2D acts like 3D. What are you selecting, or are you wanting it to work for all three? Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted April 15, 2010 Author Share Posted April 15, 2010 LWPolyline: stored in Elevation variable, Coordinates gives X & Y3DPolyline: Coordinates gives X, Y & Z I think 2D acts like 3D. What are you selecting, or are you wanting it to work for all three? :S yes... need those points to be inserted at x,y,z coordinates of each vertex.... could you Alan?... that will save me some hours today and tomorrow. I may use those hours to get your recipe done... if I don`t get tired enough... They are LWpolys Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 15, 2010 Share Posted April 15, 2010 :S yes... need those points to be inserted at x,y,z coordinates of each vertex.... could you Alan?... that will save me some hours today and tomorrow. I may use those hours to get your recipe done... if I don`t get tired enough... They are LWpolys I'm going to hold you to it. :wink: (defun c:TESt (/ ss r) ;; Alan J. Thompson, 04.15.10 (and (setq ss (ssget '((0 . "LWPOLYLINE")))) (setq r (getdist "\nSpecify radius: ")) ((lambda (i / l lst) (while (setq e (ssname ss (setq i (1+ i)))) (foreach x (entget e) (and (eq 10 (car x)) (not (member (setq l (list (cadr x) (caddr x) (cdr (assoc 38 (entget e))))) lst)) (setq lst (cons l lst)) (entmakex (list '(0 . "CIRCLE") '(100 . "AcDbEntity") '(100 . "AcDbCircle") (cons 10 l) (cons 40 r) ) ) ) ) ) ) -1 ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted April 15, 2010 Author Share Posted April 15, 2010 wOOORKS! I'm just checking if it's faster ... but I selected just too many... I'll be testing. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 15, 2010 Share Posted April 15, 2010 wOOORKS! I'm just checking if it's faster ... but I selected just too many... I'll be testing. Should be and it will allow you to select more than one at a time.:wink: You're welcome, BTW. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 15, 2010 Share Posted April 15, 2010 To alter and localize variables for the above routine... (defun c:foo ( / obj c i x y e) (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0 e (vla-get-elevation obj) ) (repeat (/ (length c) 2) (setq x (nth i c) y (nth (1+ i) c) ) (vla-addcircle *model-space* (vlax-3d-point (list x y e)) 3.0) (setq i (+ i 2)) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted April 15, 2010 Author Share Posted April 15, 2010 To alter and localize variables for the above routine... (defun c:foo ( / obj c i x y e) (vl-load-com) (setq *model-space* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq obj (vlax-ename->vla-object (car (entsel)))) (setq c (vlax-get obj "Coordinates") i 0 e (vla-get-elevation obj) ) (repeat (/ (length c) 2) (setq x (nth i c) y (nth (1+ i) c) ) (vla-addcircle *model-space* (vlax-3d-point (list x y e)) 3.0) (setq i (+ i 2)) ) (princ) ) hey Alan... thanks also for that last one... and in fact... I tested them, and for some reason, the last is faster... at least in the drawing I am working on... it's like 15 times faster... selecting one poly with your lisp it takes 12 seconds... and using the other one it takes less than one second... so it was a good idea to fix it.... thank you very much!! ----------- I took like 20 minutes for about 30 polys, I was going to take 2 days with this... now It will be done in one hour at most... greaat! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 15, 2010 Share Posted April 15, 2010 FYI, this should do your bidding (and a whole lot more!) Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 15, 2010 Share Posted April 15, 2010 hey Alan... thanks also for that last one... and in fact... I tested them, and for some reason, the last is faster... at least in the drawing I am working on... it's like 15 times faster... selecting one poly with your lisp it takes 12 seconds... and using the other one it takes less than one second... so it was a good idea to fix it.... thank you very much!! ----------- I took like 20 minutes for about 30 polys, I was going to take 2 days with this... now It will be done in one hour at most... greaat! That's horrible! I can say that I quickly threw it together, but that's just terrible. FYI, this should do your bidding (and a whole lot more!) I didn't realize you could put points on PLine vertices. I'll have to keep that in mind in case this problem arises again. Civil 3D has this kind of stuff built in, so I've never paid that much attention to your Point Manager. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 16, 2010 Share Posted April 16, 2010 An attempt at redemption... (defun c:Test (/ ss rad) (and (setq ss (ssget '((0 . "LWPOLYLINE")))) (setq rad (getdist "\nSpecify radius: ")) ((lambda (space) (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*)) ((lambda (n coords elev) (repeat (/ (length coords) 2) (vla-AddCircle space (vlax-3D-point (list (nth (setq n (1+ n)) coords) (nth (setq n (1+ n)) coords) elev) ) rad ) ) ) -1 (vlax-get x 'Coordinates) (vla-get-Elevation x) ) ) (vla-delete ss) ) (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted April 16, 2010 Author Share Posted April 16, 2010 An attempt at redemption... (defun c:Test (/ ss rad) (and (setq ss (ssget '((0 . "LWPOLYLINE")))) (setq rad (getdist "\nSpecify radius: ")) ((lambda (space) (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*)) ((lambda (n coords elev) (repeat (/ (length coords) 2) (vla-AddCircle space (vlax-3D-point (list (nth (setq n (1+ n)) coords) (nth (setq n (1+ n)) coords) elev) ) rad ) ) ) -1 (vlax-get x 'Coordinates) (vla-get-Elevation x) ) ) (vla-delete ss) ) (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) ) ) (princ) ) oK, This one tied the match with the previous one... so, Now I have got choices, I can decide to wait and pick one by one or just select a bunch and keep on something else while it works... So you really got a deep thought into the lisp process! Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 16, 2010 Share Posted April 16, 2010 oK, This one tied the match with the previous one... so, Now I have got choices, I can decide to wait and pick one by one or just select a bunch and keep on something else while it works... You must be working on really long PLines with a lot of vertices. So you really got a deep thought into the lisp process! Nah, I just wanted to make another attempt at it. I wrote the first one while on the phone with the print shop, coordinating my order (needed 10 copies of my 30 sheet plan set). Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 16, 2010 Share Posted April 16, 2010 Explore Lee's Point Manager. He put a lot of work into it. Quote Link to comment Share on other sites More sharing options...
gilsoto13 Posted April 16, 2010 Author Share Posted April 16, 2010 You must be working on really long PLines with a lot of vertices. Nah, I just wanted to make another attempt at it. I wrote the first one while on the phone with the print shop, coordinating my order (needed 10 copies of my 30 sheet plan set). 0h com'on ..you're being ....(Presumido) ------------------------------------- about Lee's one, it has a lot of options, nice to try, but I almost done with my task, I haven't spent more than 20 minutes in total in it. And I thought for a second about using export-import routines, but I decided to find a direct routine that will be easier, faster and secure. That's what I got. Thanks again. You saved me lots of time until I learn how to work with civil3d -------- I was looking for the meaning of "haughty", but didn`t have enough time... Now I checked it out, and in seems to be a little rude for this case... we have in spanish the word "Presumido" which may be used as a very friendly word... but It sems you don`t have on for this special case in english... so I guess I`ll just pass on using this word Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 16, 2010 Share Posted April 16, 2010 Bear in mind that my routine is not just an import/export routine - the 'Input' can be ACAD Points/ Polylines / Blocks / or a File, and the 'Output' can be any of those things also. Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 16, 2010 Share Posted April 16, 2010 Regardless, I'm not offended. Glad it saved you some time. 0h com'on ..you're being ....(Presumido)------------------------------------- about Lee's one, it has a lot of options, nice to try, but I almost done with my task, I haven't spent more than 20 minutes in total in it. And I thought for a second about using export-import routines, but I decided to find a direct routine that will be easier, faster and secure. That's what I got. Thanks again. You saved me lots of time until I learn how to work with civil3d -------- I was looking for the meaning of "haughty", but didn`t have enough time... Now I checked it out, and in seems to be a little rude for this case... we have in spanish the word "Presumido" which may be used as a very friendly word... but It sems you don`t have on for this special case in english... so I guess I`ll just pass on using this word Quote Link to comment Share on other sites More sharing options...
LEIGH Posted May 22, 2011 Share Posted May 22, 2011 Im looking for a lisp to convert circles into points - can anyone help?? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted May 22, 2011 Share Posted May 22, 2011 Im looking for a lisp to convert circles into points - can anyone help?? Here it is .... (defun c:test (/ ss n sset) (if (setq ss (ssget "_:L" '((0 . "CIRCLE")))) (repeat (setq n (sslength ss)) (setq sset (ssname ss (setq n (1- n)))) (entmakex (list (cons 0 "POINT") (assoc 10 (entget sset)))) (entdel sset) ) (princ) ) (princ) ) Tharwat Quote Link to comment Share on other sites More sharing options...
LEIGH Posted May 22, 2011 Share Posted May 22, 2011 Here it is .... (defun c:test (/ ss n sset) (if (setq ss (ssget "_:L" '((0 . "CIRCLE")))) (repeat (setq n (sslength ss)) (setq sset (ssname ss (setq n (1- n)))) (entmakex (list (cons 0 "POINT") (assoc 10 (entget sset)))) (entdel sset) ) (princ) ) (princ) ) Tharwat Legend! Thanks very much. Does this work muiltply, i.e select all circles, rather than select one at a time? Thanks so much. 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.