create layout based on polygons in model space

create layout based on polygons in model space

CNinBC
Advocate Advocate
2,041 Views
7 Replies
Message 1 of 8

create layout based on polygons in model space

CNinBC
Advocate
Advocate

We have been asked to create 8.5X11 drawings for each property along our roadwork project to show the homeowner the property impacts. there are hundreds of properties. is there a quick and easy way to create layouts by selecting the property line polygons in the model space and fit each polygon into the layout viewport template?

 

Thanks. 

0 Likes
Accepted solutions (1)
2,042 Views
7 Replies
Replies (7)
Message 2 of 8

pendean
Community Legend
Community Legend
Not exactly what you asked for, but how about this freebie in the interim from the Autodesk App Store https://apps.autodesk.com/ACD/en/Detail/Index?id=2430986909281925511&appLang=en&os=Win32_64

0 Likes
Message 3 of 8

maratovich
Advisor
Advisor

Try it - AutoViewport 

 

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

CodeDing
Advisor
Advisor

@CNinBC ,

 

If neither of the above mentioned items are what you're looking for, then could please post an example dwg with what you start with and your desired end state?

 

Best,

~DD

0 Likes
Message 5 of 8

CNinBC
Advocate
Advocate

thanks @pendean , @maratovich & @CodeDing for your suggestions, however, those are not exactly what I wanted,  please see attached sample drawing, I wish by selecting the property line polygons, I can use the layout template in the same drawing to create multiple layouts to show each property.

0 Likes
Message 6 of 8

CodeDing
Advisor
Advisor
Accepted solution

@CNinBC ,

 

Maybe this?

(defun c:V4P ( / tmp ssVP tab ssPL scaleList sweetRngMax sweetRngMin sweetRngAvg vpVal vpArea n cnt ePL plArea goodVal bestVal bestScale pref eVP)
;Viewports for(4) Properties
(cond
  ((= 1 (getvar 'TILEMODE))
    (setq tmp "\nYou must start on a layout tab you wish to use as a template.") (prompt tmp) (alert tmp) (exit))
  ((not (setq ssVP (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 (setq tab (getvar 'CTAB))) '(-4 . "<NOT") '(69 . 1) '(-4 . "NOT>")))))
    (setq tmp "\nNo viewports were found on your template layout tab.") (prompt tmp) (alert tmp) (exit))
  ((> (sslength ssVP) 1)
    (setq tmp "\nThere can only be 1 viewport on your template layout tab.") (prompt tmp) (alert tmp) (exit))
  ((not (setq ssPL (ssget "_X" '((0 . "LWPOLYLINE") (8 . "PROPERTY LINES")  (70 . 1) (410 . "Model")))))
    (setq tmp "\nNo closed PROPERTY LINES were found in model space.") (prompt tmp) (alert tmp) (exit))
);cond
(if (> (getvar 'CVPORT) 1) (command "_.PSPACE"))
(setq scaleList '(10 25 50 100 150 200 250 500 1000 1250 1500 1750 2000 3000 5000)
      sweetRngMax 0.85
      sweetRngMin 0.6
      vpVal 1000 ;<-- 1 Model Space unit equals [vpVal] Paper Space units
      sweetRngAvg (* 0.5 (+ sweetRngMax sweetRngMin))
      vpArea (* (getpropertyvalue (ssname ssVp 0) "Height") (getpropertyvalue (ssname ssVp 0) "Width"))
      vpVal (* vpVal vpVal)
);setq
(setq n 1)
(repeat (setq cnt (sslength ssPL))
  (setq ePL (ssname ssPL (setq cnt (1- cnt)))
	plArea (* vpVal (getpropertyvalue ePL "Area"))
	goodVal nil
	bestVal nil
	bestScale nil
  );setq
  (foreach scale scaleList
    (if (< 0.0 (setq goodVal (/ (* plArea (/ 1.0 scale)) (* vparea scale))) 1.0)
      (if (> (- sweetRngAvg (abs (- sweetRngAvg goodVal)))
	     (- sweetRngAvg (abs (- sweetRngAvg (if bestVal bestVal (setq bestScale scale bestVal goodVal))))))
	(setq bestVal goodVal bestScale scale)
      );if
    );if
  );foreach
  (if bestScale
    (progn
      (setq pref "PROP ")
      (while (member (strcat pref (itoa n)) (layoutlist)) (setq n (1+ n)))
      (command "-LAYOUT" "copy" tab (strcat pref (itoa n)))
      (setvar 'CTAB (strcat pref (itoa n)))
      (setq eVP (ssname (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 (strcat pref (itoa n))) '(-4 . "<NOT") '(69 . 1) '(-4 . "NOT>"))) 0))
      (command "_.MSPACE") (command "_.ZOOM" "o" ePL "") (command "_.PSPACE")
      (setpropertyvalue eVP "CustomScale" (/ 1.0 (* 0.001 bestScale)))
      (setq n (1+ n))
    );progn
  ;else
    (prompt "\nNo acceptable scale found for property.")
  );if
);repeat
(prompt "\nV4P Complete.")
(princ)
);defun

Best,

~DD

Message 7 of 8

CNinBC
Advocate
Advocate

thanks @CodeDing , that works great.

0 Likes
Message 8 of 8

saravanan_shanmugam
Community Visitor
Community Visitor

it's not working For me, can please look into my attched dwg

0 Likes