Lisp to Create multiple viewport

Lisp to Create multiple viewport

francine.zimmermannSRSWJ
Advocate Advocate
6,230 Views
44 Replies
Message 1 of 45

Lisp to Create multiple viewport

francine.zimmermannSRSWJ
Advocate
Advocate

I'm looking for a lisp to create multiple viewport.

I've found a lisp on the internet that almost meets my expectations, its name is NV.lsp. (see attached file)

I need 2 things, redo the same operation several times and insert the window not in the centre but in relation to a corner (for example the bottom left corner).

Does anyone know how to integrate this into this lisp?

Thank you very much in advance for the help

 

 

0 Likes
Accepted solutions (2)
6,231 Views
44 Replies
Replies (44)
Message 21 of 45

allanthebruce
Advocate
Advocate

Thanks Paullimapa, 

To help answer questions.

  1.  I have multiple blocks for different sheet names A3-A0 sizes.
  2. Yes correct, perfect.
  3. Yes it should just go to a new viewport and call it 2.
  4. Would be great to have a xy location from 0,0  in this location i set x=13 y=53
  5. Scale would be a good added feature I am not sure how best this would work. Maybe like the feature prompted....

Thanks and appreciate this will save me alot of time and effore, just setting multi sheets for normal drafting, thanks for any help.

Cheers

Allan

0 Likes
Message 22 of 45

paullimapa
Mentor
Mentor

Since you have multiple block names to represent different sizes, do all of them have the same Attribute Tag name of MAPSHTNUM?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 23 of 45

allanthebruce
Advocate
Advocate

Yes they do but if an issue I could change to anything...

0 Likes
Message 24 of 45

paullimapa
Mentor
Mentor

No don't change it...that's good that all the blocks have matching Attribute Tag name of MAPSHTNUM

Let me spend a bit of time working this out and will get back to you if I have more questions.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 25 of 45

allanthebruce
Advocate
Advocate

Thanks mate!

0 Likes
Message 26 of 45

paullimapa
Mentor
Mentor

NVB.lsp seems to work. Just make sure your scalelist 1:1 actually = 1 and not 0.001

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 27 of 45

Sea-Haven
Mentor
Mentor

A front end so you can make choices about sheet sizes. Part 1 make the rectangs, 2 methods. 

SeaHaven_0-1718262267503.png

Like Paulliama each sheet is numbered. The actual make layouts is done as a part 2 as the rectangs can be moved or rotated before making layouts. A second code does the walk down a path. So can mix and match rectangs.

 

0 Likes
Message 28 of 45

allanthebruce
Advocate
Advocate

Thanks so much for this But I'm still having an issue.

See attached and the titleblocks in layouts, must be a scale issue. Wondering if can be changed to suite the title block?

The attached has 5 sample viewports and 5 layouts.....

Thanks again.

Cheers

Allan

 

0 Likes
Message 29 of 45

paullimapa
Mentor
Mentor

I scaled all your A1_horizontal blocks from 0.100 to 1.00

paullimapa_0-1718317179208.png

I placed dimensions on them so you can clearly see their size and also fields linking to the block name & attribute value so you can see they're properly going to their corresponding layouts.

I also renamed all your layouts dropping the "0" in front because you told me in one of your previous replies that you  just want to have "1":

paullimapa_1-1718317205761.png

Now when you run NVB.lsp & select 1:1_1 it will create the vports filling out the entire sheet in each layout:

paullimapa_2-1718317273855.png

paullimapa_3-1718317308885.png

I've attached the drawing prior to running NVB.lsp so you can try and see if you get the same results as I do in each layout.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 30 of 45

allanthebruce
Advocate
Advocate

Worked a treat, The viewports are now at 1:1000, how can this be changed to say 1:100 or 1:200?

Thanks a million, can these viewports be the same layer "VIEWPORT-AUTO"?

This is a brilliant lisp that will help so many.

Thanks Allan

 

 

0 Likes
Message 31 of 45

paullimapa
Mentor
Mentor

I've added the layer name for vports to be placed onto in the attached updated NVB.lsp.

The variables for attribute tag name, vp insertion x,y coordinates & the layer name can all be adjusted in the lisp as seen here:

paullimapa_0-1718320563001.png

I'll let you ponder over the vport scale dilemma.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 32 of 45

allanthebruce
Advocate
Advocate

Great and thanks again!

 

0 Likes
Message 33 of 45

paullimapa
Mentor
Mentor

Once again glad to have helped…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 34 of 45

paullimapa
Mentor
Mentor

Here's a version I called NVS.lsp which takes the scale of the Block and uses that to scale the vport.

I've attached the dwg where I've positioned the 5 Block with various scales ranging from 1:50 down to 1:5

That's typically how I'd do the scaling of the Block to get an idea how much of the view I'd see at a particular scale.

All of this is based on drawing at 1 unit = 1mm and not 1M.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 35 of 45

allanthebruce
Advocate
Advocate

Pretty Cool! Yes we drawin in meters no mm.

Thanks I will have a look into this one!

0 Likes
Message 36 of 45

paullimapa
Mentor
Mentor

Attached dwg is setup using 1 unit = 1 Meter and using the same lisp routine gives equal results.

Since the lisp routine relies on using the block scale to set the pspace vport zoom factor, the key is applying the proper scale to the block in model space. For example for the block to represent a 1:50 scale window the XYZ scale = 1/50 = 0.050. The Pspace Vport factor = 1/0.05xp = 20 zoom factor


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 37 of 45

andkal
Collaborator
Collaborator

hi
Thread already solved but you can also check out VIEWPORT TOOLS plugin. Maybe you will find it interresting. It contains simillar function that you described.
https://apps.autodesk.com/ACD/pl/Detail/Index?id=768080633918045495&appLang=en&os=Win32_64


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
Message 38 of 45

rolisonfelipe
Collaborator
Collaborator

IT IS POSSIBLE TO ADAPT THIS LSP WITH THE FUNCTION, WHEN INSERTING THE LIMITS IN THE LAYOUT CREATE A NEW VIEWPORT FOR THE SELECTION MADE PREVIOUSLY IN THE MODEL

0 Likes
Message 39 of 45

paullimapa
Mentor
Mentor

Please explain how this is different than what NV.lsp does now.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 40 of 45

rolisonfelipe
Collaborator
Collaborator

THIS LISP HAS A LOT OF POTENTIAL, IF YOU SUGGESTED A SUB ROSTINE WITH 3 POINTS AND THEN ROTATING IT WOULD BE FANTASTIC.

MY GREETINGS FROM NOW, THIS IS A GREAT PROJECT

 

 

MEUS CUMPRIMENTOS DE AGORA, ESTE É UM GRANDE PROJETO

0 Likes