fuqua Posted June 17, 2009 Posted June 17, 2009 that would be great mate, cant wait to see what u made alot of thanks in advance. Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 Are we dealing with a 2D problem here? Also, is it only LWPOLYLINEs that we are dealing with? Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 Ok, thanks. Try this as a preliminary: (defun c:IntLen (/ cEnt cObj ss ObjLst Len) (vl-load-com) (if (and (setq cEnt (car (entsel "\nSelect Main Polyline: "))) (eq "AcDbPolyline" (vla-get-ObjectName (setq cObj (vlax-ename->vla-object cEnt))))) (progn (setq ss (ssget "_X" (list (cons 0 "LWPOLYLINE") (cons 410 (getvar "CTAB"))))) (ssdel cEnt ss) (if (> (sslength ss) 0) (progn (setq ObjLst (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))) (setq ObjLst (vl-remove-if-not (function (lambda (x) (vlax-invoke cObj 'IntersectWith x acExtendNone))) ObjLst)) (mapcar (function (lambda (x) (redraw (vlax-vla-object->ename x) 3))) Objlst) (setq Len (apply '+ (mapcar 'vla-get-Length ObjLst))) (princ (strcat "\n<< Total Length of " (rtos (length ObjLst) 2 0) " Polylines = " (rtos Len 2 2) " >>"))) (princ "\n<< No Intersecting Polylines Found >>"))) (princ "\n<< No Polyline Selected >>")) (princ)) Just do a regen to "unhighlight" - you'll see what I mean. Quote
fuqua Posted June 17, 2009 Posted June 17, 2009 wow you already wrote it ?! will have to try this tomorrow when im back at work though. what does it do so far ? Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 wow you already wrote it ?! will have to try this tomorrow when im back at work though. what does it do so far ? At the moment, it will calculate the total length of all the intersecting polylines - and will highlight those polylines to show you which ones it has used for the calculation. I haven't gone into the whole "border" issue yet, but we can go into that later, if you are happy with this one. Quote
fuqua Posted June 17, 2009 Posted June 17, 2009 can u make it like it needs a object as a starting point ? damn i wish i was at work right now to try it out. will be first thing early morning tomorrow though. if i find out how ill post a picture here to show you how im using autocad for work. maybe that will make my intent more clear. Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 can u make it like it needs a object as a starting point ? damn i wish i was at work right now to try it out. will be first thing early morning tomorrow though. if i find out how ill post a picture here to show you how im using autocad for work. maybe that will make my intent more clear. At the moment, you have to select the "Main Polyline" from which all calculations are made. Quote
fuqua Posted June 17, 2009 Posted June 17, 2009 ok its no problem mate, ill give this a trail run tomorrow morning. again im very grateful for your help. Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 ok its no problem mate, ill give this a trail run tomorrow morning. again im very grateful for your help. Ok, I look forward to your feedback Quote
fuqua Posted June 18, 2009 Posted June 18, 2009 hi mate ! i just gave it a trail run, and it seems that for some reason it wont select/see all polylines connected to the main polyline. it will select some but not all. Quote
fuqua Posted June 18, 2009 Posted June 18, 2009 I can't get it to fail my end that is strange :S how many polylines do u have connected to the main one ? i got something over 44 lines Quote
Lee Mac Posted June 18, 2009 Posted June 18, 2009 that is strange :S how many polylines do u have connected to the main one ? i got something over 44 lines Just tried it with 27 (all I could be bothered to draw) - and no problem. 1) Are you sure all the lines are LWPOLYLINEs? 2) Are you sure there is no Z-coord involved? 3) Are you able to post a sample drawing? Quote
fuqua Posted June 18, 2009 Posted June 18, 2009 Just tried it with 27 (all I could be bothered to draw) - and no problem. 1) Are you sure all the lines are LWPOLYLINEs? 2) Are you sure there is no Z-coord involved? 3) Are you able to post a sample drawing? as far as i can tell im using the normal standard polyline provided by autocad 2009. i know of 2 types of lines, a normal one and a polyline. can u tell me how i can check for a lw polyline, i thought lw just stood for "lineweight". no z-coord are involved. here's a pic. Quote
stevesfr Posted June 18, 2009 Posted June 18, 2009 I can't get it to fail my end Lee, I have to agree with Fuqua, only lines on one side (right side from starting point of pline) are recognized by the code in my ac 8 dwg. Those on opposite side are ignored for some reason. Steve Quote
fuqua Posted June 18, 2009 Posted June 18, 2009 Lee, I have to agree with Fuqua, only lines on one side (right side from starting point of pline) are recognized by the code in my ac 8 dwg. Those on opposite side are ignored for some reason.Steve with me dwg file saved in AC2k4, but autocad 2009. but it seems to be utterly random with me, sometimes it sees 3 other time 18, sometimes (and that is great) it also recognizes another line's connected through a object. Quote
Lee Mac Posted June 18, 2009 Posted June 18, 2009 Guys, this only uses the IntersectWith method - which doesn't take into account which "side" of the polyline it is on. Could you not attach a dwg file so that I could experiment? Quote
fuqua Posted June 18, 2009 Posted June 18, 2009 Guys, this only uses the IntersectWith method - which doesn't take into account which "side" of the polyline it is on. Could you not attach a dwg file so that I could experiment? could do that tomorrow, can only give u the file with polylines though. so ur saying that the lines it DOES see are intersecting ? (if so, then im making a mistake in my drawing, cause some lines are "forbidden" to intersect). Quote
Lee Mac Posted June 18, 2009 Posted June 18, 2009 so ur saying that the lines it DOES see are intersecting ? (if so, then im making a mistake in my drawing, cause some lines are "forbidden" to intersect). You asked me to retrieve the lengths of all polylines that are touching a main polyline didn't you? Hence this code will do just that. 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.