Jump to content

Multiple polyline viewport from model to layout


Recommended Posts

Posted

Hi, 

Im new here. I was wondering if exist any lisp routine to create multiple viewport from model space to layout at once. I have 190 polyline object "rectangular" in modelspace and i want to create viewports in paprespace at one time with the same scale besides each other?

 

Thx ... Iztok

 

 

Posted

Yes like many others as suggetsed @aridzv I have something, and have made like 50+ in one go.

 

You need to post a sample dwg to see how you are attempting to do this.

Posted
11 hours ago, BIGAL said:

Yes like many others as suggetsed @aridzv I have something, and have made like 50+ in one go.

 

You need to post a sample dwg to see how you are attempting to do this.

Thank s for answer. Here is my case . In this drawing need to create 355 viewports in ONE layout paperspace.

The rectangul of viewport is on layer "SHEMA_RECT".

 

 

sheme_JAS.dwg

Posted

Do you have a desired layout format (paper size), desired scale, etc. or you just want to display of each viewport from model space no matter the scale, paper size, etc.?

Posted

As suggested can be done you would look for the "Mx" value then find the co-ords of the rectang, make a layout and create a viewport.

 

You need to provide a couple of things, it would be best to have 1 true size title block in say "Layout1" this would be copied repeatedly. If you dont use a title block ignore.

 

Part 2 as already requested you need to set one size for the layouts. Say a A4 etc. The rectangs are different sizes you need to set the size to match the biggest rectang say M15 as example then a proper scale can be used for the viewport. The layouts are then consistent. So get something like this at a fixed scale.

image.png.450ca6a46190dfd913d6bb45ca541069.png

Posted

This is very much proof of concept, and needs some extra work but you can try it. I just did 162 layouts by selection did not try all 300+.

 

You must use this new dwg as it has Layout1 set up correctly. I removed layout2 not needed.

 

Obvious bug is if rectangs are not made in correct label sequence but can fix that if it happens. It uses creation order at moment.

 

You should use 1 size for all the rectangs.

 

image.png.21f0262581aac758d051b99b71082c48.png

 

; https://www.cadtutor.net/forum/topic/98809-multiple-polyline-viewport-from-model-to-layout/

; rectangs to layouts by AlanH
; Nov 2025

(defun rec2lays ( / ss ent txt ins pt2 pts ent2 co-ord mp )

(setvar 'ctab "Model")
(setq ss (ssget (list (cons 0 "*TEXT") (cons 8 "SHEMA_NAME")(cons 410 "Model"))))

(repeat (setq x (sslength ss))
  (setq ent (entget (ssname ss (setq x (1- x)))))
  (setq txt (cdr (assoc 1 ent)))
  (setq ins (cdr (assoc 10 ent)))
  (setq pt2 (polar ins 5.4977 2.5))
  (setq pts (list ins pt2))
  (setq ent2 (ssname (ssget "F" pts (list (cons 0 "LWPOLYLINE")(cons 8 "SHEMA_RECT"))) 0))
  (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent2))))
  (setq mp (mapcar '* (mapcar '+ (car co-ord) (caddr co-ord)) '(0.5 0.5)))
  (command "layout" "C" "Layout1" txt)
  (setvar 'ctab txt)
  (command "Mspace")
  (command "zoom" "c" mp 10)
  (command "zoom" "15XP") ; a custom scale of 15 seems to suit
  (command "Pspace")
  (setvar 'ctab "Model")
)

(princ)
)

 

sheme_JAS.dwg

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