leolill Posted March 16 Share Posted March 16 (edited) Hi guys and thanks in advance for any help. I have an autolisp called bigbang.lsp. (defun C:BIGBANG ( / ) ;; First we busrt everything a few times... (setq timesexplode 10) ;Change number to suit your needs (repeat timesexplode (setvar "qaflags" 1) (command ".explode" (ssget "_X" ) "") (setvar "qaflags" 0) ) ;define allobjects (setq allobjects (ssget "_X" )) ;; Now set everything by layer... (command "_SetByLayer" allobjects "" "Yes" "Yes") ;; Set everything to layer 0 (command "_CHANGE" allobjects "" "Properties" "Layer" "0" "") ;; Set current layer 0 (setvar "CLAYER" "0") ;; Purge the drawing (command "-Purge" "All" "*" "No") (princ) ) (princ) I load it through the cui and works great if I go to model space first. But stuffed if I can get it to go to model space before it starts, only does the layout1 that is current tab. Also wanted to delete all hatches and mtext, but can't get that to work. Asks for select internal point; (defun c:delete_all_hatches () ; Delete all hatches (command "_-hatch" "DELETE" "ALL" ) (princ "\nAll hatches deleted!") ) First delve into autolisp, its killing me. Wanted to put it in a script or something to run on a list of dwg files. I have 98. Any advice, I'll love you forever! Cheers, Lenny Edited March 16 by SLW210 Added Code Tags! Quote Link to comment Share on other sites More sharing options...
SLW210 Posted March 16 Share Posted March 16 I have moved your thread to the AutoLISP, Visual LISP & DCL Forum. Please post in the correct forum. Please use Code Tags (the <> in the editor toolbar) in the future. Quote Link to comment Share on other sites More sharing options...
Steven P Posted March 16 Share Posted March 16 This should take you to model space (setvar 'ctab "model" ) Going to layout1 or other paperspaces if you need to, you might want to confirm that the name exists, getting the list of paperspaces from (layoutlist) function To delete hatches I would usually select them with an ssget and delete the selection set, selection set gives the option for more filtering - could for example do all hatches on layer 0 that are coloured red (defun c:deletehatched ( / MySS ) (setq MySS (ssget "_X" '((0 . "HATCH")))) (command "erase" MySS "") ) can use a similar method for mtexts, 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.