iztok14 Posted Thursday at 08:40 AM Posted Thursday at 08:40 AM 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 Quote
BIGAL Posted Thursday at 10:22 PM Posted Thursday at 10:22 PM 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. Quote
iztok14 Posted Friday at 09:47 AM Author Posted Friday at 09:47 AM 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 Quote
Saxlle Posted Friday at 11:51 AM Posted Friday at 11:51 AM 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.? Quote
BIGAL Posted Friday at 11:17 PM Posted Friday at 11:17 PM 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. Quote
BIGAL Posted Friday at 11:52 PM Posted Friday at 11:52 PM 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. ; 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 Quote
iztok14 Posted 3 hours ago Author Posted 3 hours ago Sorry fot late answer, i was away for weekend. I tried "rec2lays" lisp but doesnt work for me ? noting hapend when i type command "rec2lays". Yes i d like to have vieports in only one layout side by side ? The scale is 1:1 model layout. thy, Iztok Quote
Steven P Posted 1 hour ago Posted 1 hour ago try: (rec2lays) Include the ( ) - looks like BigAl has done it all 'wrong' - or it is a part of a more complex thing (a lot more likely) and has forgotten to add the c in the function name, Could also alter first line to be: (defun c:rec2lays ( / ss en..... 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.