LISP to create viewports from modelspace

LISP to create viewports from modelspace

Anonymous
Not applicable
10,164 Views
13 Replies
Message 1 of 14

LISP to create viewports from modelspace

Anonymous
Not applicable

Hello,

I am looking for a LISP program that is able to create a viewport in paper space from model space selection. Does anyone know of one?

 

I found the thread below and the lisp seemed to "nearly work" I guess? It worked a few times but would often give back an error.

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-create-viewport-from-selecte...

 

Thanks!

Michael

0 Likes
Accepted solutions (2)
10,165 Views
13 Replies
Replies (13)
Message 2 of 14

maratovich
Advisor
Advisor

Use search.
Or that :

 

 

 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 3 of 14

vladimir_michl
Advisor
Advisor
Message 4 of 14

pendean
Community Legend
Community Legend
Message 5 of 14

Anonymous
Not applicable

Thanks everyone. These all look great, but I'm having a hard time getting them to download with our firewalls and what-not. I work for state government and I have yet to try and figure out how to download apps like this.

That's why I thought there might be some lisp code that I could just plug into VLISP.

 

Thanks!

Michael

0 Likes
Message 6 of 14

pendean
Community Legend
Community Legend
Ask your I.T. for guidance/assistance with the tools you need to do to complete your work.

0 Likes
Message 7 of 14

davinatkins
Advocate
Advocate
Accepted solution

Michael, what version of AutoCAD are you using?

Versions of AutoCAD later that 2018.2 make it really easy to place model views as viewports. Both named and unnamed.

 

If you have one of those versions, go to a paperspace view. On the layout tab - near the left - is a button Insert View. You you already have a named view, you just choose that. If you don't have a named view it'll automatically take you to modelspace and invite you to draw a rectangle around the area you want. Hit enter when you are happy with the rectangle. That shoots you right back to paperspace, where you can click to place that viewport - or right-click to change the scale beforehand.

 

You can't select an object as your boundary - like some of the other answers do - but you didn't say you needed that so maybe this does what you wanted?

0 Likes
Message 8 of 14

Anonymous
Not applicable

Oh great. I was having a hard time finding it for a few minutes, but I found it! Thank you this is exactly what I needed.

I do have Civil and AutoCAD 2019.

 

Thank you,

Michael

0 Likes
Message 9 of 14

Ed__Jobe
Mentor
Mentor

@davinatkins wrote:

Michael, what version of AutoCAD are you using?

Versions of AutoCAD later that 2018.2 make it really easy to place model views as viewports. Both named and unnamed.


 

The icon might be new, but its just the New option of the MVIEW command.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 10 of 14

Anonymous
Not applicable

I did notice that.  And I've been using a shortcut for MVIEW all this time. As I am all for quick commands via LISPs, how would I create a command to automatically choose "NEW" after initiating the MVIEW command?

 

Thanks,

Michael

0 Likes
Message 11 of 14

Ed__Jobe
Mentor
Mentor
Accepted solution

For a menu macro in the cui, "^C^C mview NE ", but that's what the UI already does in the context-sensitive Layout ribbon tab. If you want a lisp so that you could create a two letter command, then use:

(defun C:NV () (command "mview" "NE"))

 

Now you can type NV for New Viewport.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 12 of 14

Anonymous
Not applicable

That's funny I was just doing exactly what you suggested. I found a Zoom All lisp just like that  (defun c:za() (command "zoom" "all" "")). Out of curiosity, I noticed that my lisp has another set of quotations marks ("") after the two command inputs and yours doesn't. Are they unnecessary?

 

Thank you for the reply!

Michael

0 Likes
Message 13 of 14

Ed__Jobe
Mentor
Mentor

The (command) function takes separate strings as arguments. The last empty double quote you refer to is like hitting the {Enter} key. So, whether you add that or not is context sensitive. Does the command require it? The ZOOM command needs it to execute the options. The MVIEW command doesn't need it, as its waiting for user input to select a window.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 14 of 14

Anonymous
Not applicable

Ah yes! Now it is clear, thank you!

0 Likes