Dannyboy Posted May 4, 2012 Posted May 4, 2012 Hi Guys, I am fairly new to Lisp and need help with a program to do the following: Switch from model space to paper space. Change layer to "defpoints" Make a viewport. Switch back to the original layer. defun c:MV () (COMMAND "TILEMODE" "0" ) (setq oldlayer (getvar "CLAYER")) (command "layer" "m" "defpoints" "") (command "MVIEW") (setvar "CLAYER" oldlayer) (COMMAND "TILEMODE" "1" (PRINC)) I have played around with the attached and am having difficulties. Any help appreciated Dannyboy Quote
ReMark Posted May 4, 2012 Posted May 4, 2012 I would not recommend purposely creating a layer called Defpoints and putting your viewports on that layer. Use a different name and set the layer to "no print" in your Layer Properties Manager. Quote
Dannyboy Posted May 4, 2012 Author Posted May 4, 2012 Our company drawing standards are that all viewport have to be on hte defpoints layer, that is why I chose it. Quote
ReMark Posted May 4, 2012 Posted May 4, 2012 Fine with me. Could cause some inexplicable problems but I'm sure you handled them in the past and will continue to do so in the future. Quote
David Bethel Posted May 4, 2012 Posted May 4, 2012 Maybe : (command "MVIEW") (while (> (getvar "CMDACTIVE") 1) (command pause)) Also you need to check all of your opening and closing parentheses -David Quote
Lee Mac Posted May 4, 2012 Posted May 4, 2012 To get you going, try something like this: (defun c:MV ( / cl p1 p2 ) (setvar 'tilemode 0) (if (and (setq p1 (getpoint "\nSpecify First Corner of Viewport: ")) (setq p2 (getcorner p1 "\nSpecify Opposite Corner: ")) ) (progn (setq cl (getvar "CLAYER")) (command "_.-layer" "_m" "defpoints" "" "_.mview" "_non" p1 "_non" p2) (setvar "CLAYER" cl) ) ) (princ) ) I would also suggest you read the Code Posting Guidlines so that you know how to frame the code in your post. PS: The company for which I used to work also used defpoints for Viewports, I think it is common practice... Quote
Tharwat Posted May 4, 2012 Posted May 4, 2012 I think the defpoints layer must be with no plot option . Quote
ReMark Posted May 4, 2012 Posted May 4, 2012 Not necessarily. Objects on the Defpoints layer won't print. Quote
eyde Posted May 4, 2012 Posted May 4, 2012 The defpoints layer holds the "definition points" for dimensions and therefore placing other objects on this layer will significantly increase the possibility accidently moving these "definition points" and corrupting dimensions in the drawing.. Quote
Blackfish Posted May 4, 2012 Posted May 4, 2012 (edited) Maybe a simple macro: ^C^C_-layer;m;Vport_layer;;tilemode;0;_-vports \\tilemode;1;layerp; I agree, don't use Defpoint layer. It could cause problems later on. PS. Why create lisp or macro for something like that at all? How many times will you use it? Sometimes you waste as much time looking for a lisp or macro as you need to do what need to be done Edited May 14, 2012 by Blackfish wrong coding Quote
Dadgad Posted May 5, 2012 Posted May 5, 2012 Welcome to the forum Dannyboy. I am quite partial to Lee Mac's Layer Director lisp, and have added the VIEWPORT commands with a wildcard, so that when creating a viewport it is created on the MVIEW (modelview) layer. If the layer does not yet exist in the drawing it will create it, switch to that layer, and after you have specified where you want the viewport it will return to whichever layer you started the lisp from. I, agree with ReMark, and see no advantage whatsoever to putting viewports on the DEFPOINTS layer, seems like a bad idea to me. Just make sure that you set your MVIEW layer to not print. If I am dimensioning or checking a drawing I want to be able to see the viewports while I am doing it. I also am quite inclined to agree with Blackfish's (welcome to the forum, by the way) postscript note. If the time spent accessing a specific tool to do something, is greater than time required to do something without that tool? What is the point? I run LAYER DIRECTOR nonstop, and it is awesome.......on so many levels (or layers). Thanks Lee! Quote
Lee Mac Posted May 5, 2012 Posted May 5, 2012 I am quite partial to Lee Mac's Layer Director lisp, and have added the VIEWPORT commands with a wildcard, so that when creating a viewport it is created on the MVIEW (modelview) layer. If the layer does not yet exist in the drawing it will create it, switch to that layer, and after you have specified where you want the viewport it will return to whichever layer you started the lisp from. I run LAYER DIRECTOR nonstop, and it is awesome.......on so many levels (or layers). Thanks Lee! Hi Dadgad, You're very welcome! I'm delighted that you find my Layer Director program so useful and beneficial in your work. Thanks for all the recommendations! Lee Quote
Blackfish Posted May 6, 2012 Posted May 6, 2012 Working with LT I have a poor subsitute of Lee's Layer Director using modified command for text, dimensions, viewports, and hatches revclouds etc. I had to modified all of them by hand. And I cannot return to the previous current layer with some commands for example using "_layerp" e.g. ^C^C_-layer;m;VPORT;;tilemode;0;_-vports \\tilemode;1;layerp; ^C^C_-layer;m;DIM;^C^C_dimlinear \layerp; ^C^C_-layer;m;TEXT;^C^C_dtext \layerp; ^C^C_-layer;m;REV;^C^C_revcloud \layerp; Any idea? Quote
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.