Jump to content

Make a viewport


Dannyboy

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Our company drawing standards are that all viewport have to be on hte defpoints layer, that is why I chose it.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Maybe :

 

 
 (command "MVIEW")
 (while (> (getvar "CMDACTIVE") 1)
          (command pause))

 

 

Also you need to check all of your opening and closing parentheses

 

-David

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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 by Blackfish
wrong coding
Link to comment
Share on other sites

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! :beer:

Link to comment
Share on other sites

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! :beer:

 

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...