stevsmith Posted August 8, 2008 Share Posted August 8, 2008 Hello, I was wondering if anybody could help me as I have no knowledge of AutoLisp. Does anybody have a lisp command that allows me to put my "dims" layer to the back of the drawing when it is inserted ( i have it set up so that when i insert a dimension it is automatically assigned to the "dims" layer. ) This is so I don't always have to use the draw order command to move the "dim" layer to the back. Also, if someone does have it handy, how do you load it? lol... Quote Link to comment Share on other sites More sharing options...
borgunit Posted August 8, 2008 Share Posted August 8, 2008 Just asking, why would you need to have your dims in a different draworder? Quote Link to comment Share on other sites More sharing options...
minnies Posted August 18, 2008 Share Posted August 18, 2008 Did you have found the solution ??? I need to do the same thing for x-ref. I have problem with the plotter PDF995. He does'nt merge line. So I have to make a patch I have to do a draw order before each plotting. Quote Link to comment Share on other sites More sharing options...
ABuckingham Posted August 18, 2008 Share Posted August 18, 2008 Here is some code that takes the "dims" layer and moves all the objects on it to the back. ;; Moves all objects on the "dims" layer to the back (defun c:layerback() ;; creates a selection set of all objects on the "dims" layer. (setq sel1 (ssget "x" '((8 . "dims")))) ;; Uses the draworder command to move the objects to the back (command "draworder" sel1 "" "back") ) To use this code open autocad and go to the following menus Tools -> AutoLISP -> AutoLISP Editor This will open an editor. Choose the File -> New File menu then paste the code into the window. Save the file by some meaningful name anywhere you want. Now you can close the editor and go back to AutoCAD. Go to Tools -> AutoLISP -> Load Application... and select the file name you just saved. This is all you have to do once you've saved it. You can see from the code that the name of the command is layerback. Just type layerback into the command line and it will move all objects on the "dims" layer to the back. I chose to keep the code simple so you could understand what's going on and maybe make some adjustments as needed. Quote Link to comment Share on other sites More sharing options...
stevsmith Posted August 19, 2008 Author Share Posted August 19, 2008 Thanks for that Bucingham, Exactly what I have been looking for. Cheers. Minnes, I downloaded a pdf writr called Bullzip PDF. I found that it works alot better than 995, You should try it. Quote Link to comment Share on other sites More sharing options...
minnies Posted August 19, 2008 Share Posted August 19, 2008 Thanks, Stevsmith, but Bullzip Pdf does'nt work. I found Acropolt et UDC. These two converter work well, but there are expensive So I have to do a patch to solve this problem Patch = Each time we select plot Go in pspace Choose all xrefs who have a "a" for the fourth letter Send these xrefs back (draworder) Go back in mspace Open plot dialogue box I dont knok if I have to do a lisp or VBA? Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 18, 2009 Share Posted March 18, 2009 Hi , How can I make it works in a block? tks Here is some code that takes the "dims" layer and moves all the objects on it to the back. ;; Moves all objects on the "dims" layer to the back (defun c:layerback() ;; creates a selection set of all objects on the "dims" layer. (setq sel1 (ssget "x" '((8 . "dims")))) ;; Uses the draworder command to move the objects to the back (command "draworder" sel1 "" "back") ) To use this code open autocad and go to the following menus Tools -> AutoLISP -> AutoLISP Editor This will open an editor. Choose the File -> New File menu then paste the code into the window. Save the file by some meaningful name anywhere you want. Now you can close the editor and go back to AutoCAD. Go to Tools -> AutoLISP -> Load Application... and select the file name you just saved. This is all you have to do once you've saved it. You can see from the code that the name of the command is layerback. Just type layerback into the command line and it will move all objects on the "dims" layer to the back. I chose to keep the code simple so you could understand what's going on and maybe make some adjustments as needed. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 18, 2009 Share Posted March 18, 2009 Do you mean change the order of the nested entities inside a block? Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 19, 2009 Share Posted March 19, 2009 Hi, When I use layer back,it only works on the object out of the block.Maybe would be more clear see the attached small smaple. And it would be better that can make layer draw order automatically,like helpline will be always the bottom one,intenral wall the second one ,structure always the above,etc. tks sample.dwg Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 19, 2009 Share Posted March 19, 2009 Ohh, thats a tough one - maybe someone else with a bit more knowledge on this can help Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 22, 2009 Share Posted March 22, 2009 Hi, How about just make draworder,like layer 1 above layer 2;layer 2 above layer 3,layer 3 above layer 4,etc.can you help me to make this ? thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2009 Share Posted March 22, 2009 Not sure if this would do it? (defun c:orderlay (/ laylist ss) (vl-load-com) (vlax-for layer (vla-get-layers (vla-get-ActiveDocument (vlax-get-Acad-Object))) (setq laylist (cons (vla-get-name layer) laylist))) (foreach lay (reverse laylist) (if (setq ss (ssget "X" (list (cons 8 lay)))) (command "_draworder" ss "" "_B"))) (princ)) Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 22, 2009 Share Posted March 22, 2009 Hi,can I choose layer name by myself,maybe we needn't take all the layer since we have 50 layer.maybe can just set 10 layers first.(you can just write layer 1,layer 2,layer3 ,ect first,later I can replace our layer name) Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2009 Share Posted March 22, 2009 It is difficult to "order" layers imo - in the LISP routine above, I just send each layer to the back consecutively, so that they are "ordered". Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 22, 2009 Share Posted March 22, 2009 I see,then can you also add into send each layer to the front consecutively?thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2009 Share Posted March 22, 2009 I suppose this? (defun c:orderlay (/ laylist ss) (setq laylist '("LAYER1" ; <---<< List Layers Here. "LAYER2" "LAYER3" )) (foreach lay laylist (if (and (tblsearch "LAYER" lay) (setq ss (ssget "X" (list (cons 8 lay))))) (command "_draworder" ss "" "_F"))) (princ)) Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 22, 2009 Share Posted March 22, 2009 Yes!that's one we want,but I guess it's hard to make it works in the block? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 22, 2009 Share Posted March 22, 2009 Well, yes, as I said earlier, draw order is a bit of a funny thing to play around with, I have no idea how to make it work within blocks Sorry Quote Link to comment Share on other sites More sharing options...
ichlove Posted March 23, 2009 Share Posted March 23, 2009 Hi Lee Mac. Sorry,one more request!Is that possible make the lisp run automatically without use the command,means everytime when I draw a line,the computer will help me to make the draw order,and if I make any manual change about the order,it will stay my manual change. thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 23, 2009 Share Posted March 23, 2009 Hi Lee Mac. Sorry,one more request!Is that possible make the lisp run automatically without use the command,means everytime when I draw a line,the computer will help me to make the draw order,and if I make any manual change about the order,it will stay my manual change. thanks You could use a reactor I suppose, but then in my posted function, I have used command calls, which aren't good to use with reactors... but, if someone can work out how to alter draw-order without resorting to command calls, then, yes, it is possible. 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.