lpseifert Posted October 13, 2008 Share Posted October 13, 2008 (ssget "x" '((0 . "lwpolyline"))) it will probably only process the selection in the current space though. Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 13, 2008 Author Share Posted October 13, 2008 What I'm trying to do is select all polylines & then explode them through a script. When I run the script it seems to find all the polylines, but only explodes the first one. lpseifert's change still leaves me with the same problem.... ??? Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 How about posting the code you're trying to use. Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 13, 2008 Author Share Posted October 13, 2008 Here's the relevant extract of the script that I've written: ________________________________________________ -LAYER F * LO * T SERVICES_BT,SERVICES_ELECTRIC U SERVICES_BT,SERVICES_ELECTRIC FPL ALL EXPLODE ALL ________________________________________________ And here's the FPL LISP: ________________________________________________ (defun c:fpl(/ cSet) (setq cSet(ssget '((0 . "LWPOLYLINE")) ); end ssget ); end setq (if cSet (progn (princ(strcat "\n" (itoa(sslength cSet)) " found.")) (sssetfirst nil cSet) ); end progn (princ "\nNothing found. ") ); end if (princ) ); end of c:fpl ________________________________________________ Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 The FPL function just reports how many lwpolylines you've selected, that's all. Since the cSet variable is declared as local, the value is lost when the defun c:fpl is closed. Try and make it global and pass it on to the explode command with !cSet. I didn't test it, and it propably won't work; you may want to consider using lisp to explode the plines instead of a script. Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 13, 2008 Author Share Posted October 13, 2008 you may want to consider using lisp to explode the plines instead of a script. OK, sounds good - but I will need help there! As you can see I'm a complete LISP novice! Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 Here's a quicky, untested and will probably only work in the current space (defun c:test (/ ss1) (setq ss1 (ssget "x" '((0 . "LWPOLYLINE")))) (command "explode" ss1 "") );defun Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 13, 2008 Author Share Posted October 13, 2008 Thanks, but got the same problem where it's only exploding the first pline. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 Oh well... no time to fix it now.... Quote Link to comment Share on other sites More sharing options...
ASMI Posted October 13, 2008 Share Posted October 13, 2008 (defun c:test (/ ss1 oldQf) [color="Blue"](setq oldQf(getvar "QAFLAGS")) (setvar "QAFLAGS" 1)[/color] (setq ss1 (ssget "x" '((0 . "LWPOLYLINE")))) (command "explode" ss1 "") [color="#0000ff"](setvar "QAFLAGS" oldQf)[/color] (princ) );defun Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 Thanks ASMI... I can't seem to find much information on QAFLAGS. Would you mind offering an explanation as to its purpose/use? Quote Link to comment Share on other sites More sharing options...
ASMI Posted October 13, 2008 Share Posted October 13, 2008 QAFLAGS is one of not documentary variables which can accept values from 0 to 32767. The bit 0 (1) influences execution of command Explode. Exact usage of all bits unfortunately is not known. Other way to force AutoCAD to explode all primitive of a selection set - use loop. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 13, 2008 Share Posted October 13, 2008 So you're saying it's one of those Ade$k secrets... Thanks once again. Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 15, 2008 Author Share Posted October 15, 2008 Thanks ASMI - that's great Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 30, 2008 Author Share Posted October 30, 2008 (defun c:test (/ ss1 oldQf) [color="Blue"](setq oldQf(getvar "QAFLAGS")) (setvar "QAFLAGS" 1)[/color] (setq ss1 (ssget "x" '((0 . "LWPOLYLINE")))) (command "explode" ss1 "") [color="#0000ff"](setvar "QAFLAGS" oldQf)[/color] (princ) );defun I've been using the above written by ASMI (thanks), but I'm finding that it's not exploding everything that I'm expecting it to. If I draw a polyline (using the PL command) and run this, there's no problem. Then there are other polylines in my drawings that don't get exploded. Comparing the properties between the two, the only difference (other than length & position) is that under the MISC section of the properties window the unexploded lines have an FIT/SMOOTH property of none, whereas the ones that did explode didn't have this property at all. I'm sure the LISP above is fine, so does that mean that the lines that are not exploding are not technically polylines or something?? EDIT: Ok, looking more closely at my properties, I notice that the lines which are not exploding are classed as '2D Polylines' whereas the ones which are are simply 'Polylines'. So how do I either change 2D PLs into standard PLs, or edit the above LISP to pick them up as well? Quote Link to comment Share on other sites More sharing options...
Rooster Posted October 30, 2008 Author Share Posted October 30, 2008 OK - I've done it! For anyone interested, I edited ASMI's LISP from this: (setq ss1 (ssget "x" '((0 . "LWPOLYLINE")))) to this: (setq ss1 (ssget "x" '((0 . "POLYLINE,LWPOLYLINE")))) and hey presto, as they say Quote Link to comment Share on other sites More sharing options...
Rooster Posted January 14, 2009 Author Share Posted January 14, 2009 Sorry folks - back to this problem again: I'm trying to use a LISP to filter all objects with a z-value of -999, but nothing is being found. Can someone chekc out my code and see if they can spot any problems? Thanks _______________________________ (defun c:fz999(/ cSet) (setq cSet(ssget '((10 . *, *, -999)) ); end ssget ); end setq (if cSet (progn (princ(strcat "\n" (itoa(sslength cSet)) " found.")) (sssetfirst nil cSet) ); end progn (princ "\nNothing found. ") ); end if (princ) ); end of c:fz999 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.