pinkguju Posted October 26, 2010 Share Posted October 26, 2010 So i have a script i've written where autocad will open a specified file, execute a bunch of commands then create a dxf out. Before it starts executing commands i would like it to select all external refrences and move it to a specific layer. i tried "(ssget "X" '((0 . "block reference")))" as well as "(ssget "X" '((0 . "EXTERNAL REFERENCE")))" nothing seems ot be working.... any ideas? Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 26, 2010 Share Posted October 26, 2010 Maybe this will work for ya... very little testing (vl-load-com) (setq ss (ssget "_X" '((0 . "INSERT"))) idx -1 ) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss (setq idx (1+ idx))))) (if (vlax-property-available-p obj 'Path) (vlax-put obj 'Layer "[color=red][i]LayerName[/i][/color]") ) ) Quote Link to comment Share on other sites More sharing options...
pinkguju Posted October 26, 2010 Author Share Posted October 26, 2010 So it has to fit in the below script. Ideally it would be done at the beginning, right after the zoom/extents. open "f:/Retail_Focus/Retail_Focus_Data/Retail_Focus_Stores/DPatel/Tests/DXF 1/1004 Test L1.dwg" .ZOOM E .layer T 0 T A350* T "BORDER INFORMATION" T AISLE* T CONST* T CORNICE T ELEC* T NOTE T "PLOT SHADE*" T FIX* T SEARS* T TAPE* T WIPEOUT T BCB* T ARCH* T DIV* T DEPT* ON 0 ON A350* ON "BORDER INFORMATION" ON AISLE* ON CONST* ON CORNICE ON ELEC* ON NOTE ON "PLOT SHADE*" ON FIX* ON SEARS* ON TAPE* ON WIPEOUT ON BCB* ON ARCH* ON DIV* ON DEPT* .XREF B **** .layer LO "*####*" LO "AISLE DEFINITION" LO TAPE* LO DIV* LO DEPT* ERASE ALL .PURGE ALL * N .REGENALL .DXFOUT "K:/KmartApplications/Intactix/ProFloor/current_dxf/1004 L1.DXF" 3 .close y Quote Link to comment Share on other sites More sharing options...
pinkguju Posted October 26, 2010 Author Share Posted October 26, 2010 I tried what you gave me, lpseifert, but i got either a "nil" or a "(_> )" at the end. Quote Link to comment Share on other sites More sharing options...
lpseifert Posted October 26, 2010 Share Posted October 26, 2010 (edited) If you've inserted the code in your script file, I would suggest you debug it to find where the error is. If you're entering the code at the command line and you're getting "(_> )" try hitting enter. If you're getting "nil" it probably worked; check the xrefs and see if the layer changed. Edited October 26, 2010 by lpseifert 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.