ahyin Posted June 21, 2011 Share Posted June 21, 2011 (defun c:redrawpl () (setq sset (ssget "x" '(0 . "lwpolyline") (cons 67 (logand (1+ (getvar "TILEMODE"))1)) )) (setq ctr 0) (repeat (sslength sset) (setq item (ssname sset ctr)) (vl-cmdf "_isolateobjects" item "") (setq ron (vlax-ename->vla-object item)) (setq olayer (vla-get-layer ron)) (command "-layer" "set" olayer "" ) (setq p1 (pline-centroid item)) (vl-cmdf "_.-boundary" "_A" "_O" "polyline" "_I" "_N" "" p1 "") (vl-cmdf "_unisolateobjects" "") (vla-delete ron) (command "_change" (entlast) "" "p" "la" "layer1" "") (setq ctr (1+ ctr)) ) ) I'm trying to redraw all polylines by above method. To avoid create incorrect polyline, I'm using the function of isolateobjects to switch off others objects. Then it will based on the remain polyline to create the new one. But I found when I use this method apply on drawing which is many objects inside is quite slowly. In addition, some polylines unable to create by this method. Is there any others good method to create the polylines ? Thank you ! Quote Link to comment Share on other sites More sharing options...
MSasu Posted June 21, 2011 Share Posted June 21, 2011 Please take a look on ENTMAKE function as an alternative solution. Or, may try to disable OSMODE system variable instead of isolate the entity - don't forget to restore it later. (setq PrevOsnapMode (getvar "OSMODE")) ;retain current state (setvar "OSMODE" 0) ;disable auto OSNAP [color=blue]; your procesing here[/color] (setvar "OSMODE" PrevOsnapMode) ;restore previous state Regrads, Mircea Quote Link to comment Share on other sites More sharing options...
ahyin Posted June 21, 2011 Author Share Posted June 21, 2011 Thank you Mircea quick response ! Can you teach me how to write this testing condition. (defun c:creg () (setq a (car (entsel))) (command "region" a "") ;[color=blue]if convert to region is failed then explode it and then rejoin by pedit [/color] (while (setq ent (vlax-ename->vla-object a)) (vla-explode ent) (command "_.pedit" "_m" (ssget "_p") "" "_y" "_j" 0.0 "") ) ) Quote Link to comment Share on other sites More sharing options...
MSasu Posted June 21, 2011 Share Posted June 21, 2011 How about comparing the last available entity in drawing (before attempt to create the region) with the last one after the region command was issued? Those should be different if conversion to region was successful. (setq LastItem (entlast)) ;retain last item in drawing [color=green](setq a (car (entsel))) [/color] [color=green](command "_REGION" a "")[/color] ;attempt to create a region (setq DrawItem (entlast)) ;list again last item in drawing (if (not (equal LastItem DrawItem)) ;compare above entities (prompt "\The region was created!") (prompt "\The region wasn't created!") ) Regards, Mircea Quote Link to comment Share on other sites More sharing options...
ahyin Posted June 22, 2011 Author Share Posted June 22, 2011 Thank you Mircea, I'm trying to use this method to create the region but unsucessful. (defun c:creg () (setq a (car (entsel))) (setq lastitem (entlast )) (command "region" a "") (setq drawitem (entlast)) (if (not (equal lastitem drawitem)) (prompt "The region was created") (progn (setq ent (vlax-ename->vla-object a)) (vla-explode ent) (command "_.pedit" "_m" (ssget "_p") "" "_y" "_j" 0.0 "") ) (command "region" (entlast)) ) ) Quote Link to comment Share on other sites More sharing options...
MSasu Posted June 22, 2011 Share Posted June 22, 2011 Try to parse by ENTNEXT the newly created entities (from explosion command) starting from the last entity in drawing prior explosion; create a new selection set with SSADD. Regards, Mircea Quote Link to comment Share on other sites More sharing options...
ahyin Posted June 22, 2011 Author Share Posted June 22, 2011 Thanks again ! I will follow this direction to complete this program. 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.