Results 1 to 9 of 9

Thread: might be a pipe dream - creation of layouts based on data within the model space?

  1. #1
    Member
    Join Date
    2012-11
    Posts
    8
    Login to Give a bone
    0

    Default might be a pipe dream - creation of layouts based on data within the model space?

    hello,

    got a bit of a question which may be an absolute pipe dream but here goes....

    if i have a drawing with one layout, does anybody know or heard of a way to do the following using a lisp or script?

    If i create lets say 4 rectangles which represent 1:500 viewports at A1 in my model, is there a way to duplicate the original layout and center each new viewport within these new layouts based on the rectangles within the model space?

    Layout 1 = viewport matches rectangle 1
    Layout 2 = viewport matches rectangle 2
    Layout 3 = viewport matches rectangle 3
    Layout 4 = viewport matches rectangle 4

    i know how to set the view ports based on a centroid using a lisp, but not sure if new layouts can be copied/created based on some specific objects within the model space.

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    Why not save model space views instead of drawing rectangles? Then set view 1 current in viewport 1, view 2 current in viewport 2…
    You could also zoom object and select a rectangle for each viewport.

    Paper Space has been around more that the 20+ years I've been doing this, so I've never attempted a Model Space view. Concept of "1:500 viewports at A1 in my model" escapes me.

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    I also use 'frames' for our sheets as well, and simply 'twist' my Paperspace Viewport's view, followed by ZOOM + Window (endpoint [bottom left]-endpoint [upper right] as example)... Takes only a few seconds, once to setup the sheet, and then I lock the Viewports.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    Member
    Join Date
    2005-07
    Posts
    40
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    Quote Originally Posted by Tom Beauford View Post
    Why not save model space views instead of drawing rectangles? Then set view 1 current in viewport 1, view 2 current in viewport 2…
    You could also zoom object and select a rectangle for each viewport.

    Paper Space has been around more that the 20+ years I've been doing this, so I've never attempted a Model Space view. Concept of "1:500 viewports at A1 in my model" escapes me.
    I have been framing the sheet view within my working model or model space for close to a decade now. One of the primary reason for doing this is it allows everyone to see the defined drawing areas for both the floor plan and remaining white space. I have worked with people who didn't clearly define the working space and it usually leads to unclear scattered information or poorly configured viewports. By the way, I then use the frames to create views and utilize Sheet Set Manager and Project Navigator to setup the sheet (I prefer to follow the AIA Model file/Sheet file concept instead of a bunch of tabs within the same drawing).

    To the OP ... the code below doesn't currently include an error trap, object filtering on the entsel (expects polyline rectangle), layout manipulation (tilemode will switch to last selected layout tab), or the option to create the viewport as a standalone command. It is provided more as a starting point, you may need to modify portions to get it to function properly. It also currently expects the views and viewports to reside in the same drawing ...

    Code:
    ;; Use polyline rectangle to create a named model view and then recreate viewport on layout tab
    ;; Switch to associated layout tab before running or modify as needed to handle layout switch
    (defun c:rec2view ( / old_osmode poly_list obj_poly poly_vertex x_min x_max y_min y-max lower_pt1 upper_pt2 name vscale insert_pt)
      ;; select polyline rectangle to create named model view
      (setq old_osmode (getvar "osmode"))
      (setvar "osmode" 0)
      (setq poly_list (entget (car (setq obj_poly (entsel))))) ;requires user to select polyline rectangle
      (setq poly_vertex (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) poly_list)))
      (if (> (car (car poly_vertex)) (car (cadr poly_vertex)))
          (progn (setq x_max (car (car poly_vertex))) (setq x_min (car (cadr poly_vertex))))
          (progn (setq x_min (car (car poly_vertex))) (setq x_max (car (cadr poly_vertex))))
      )
      (if (> (cadr (car poly_vertex)) (cadr (cadddr poly_vertex)))
          (progn (setq y_max (cadr (car poly_vertex))) (setq y_min (cadr (cadddr poly_vertex))))
          (progn (setq y_min (cadr (car poly_vertex))) (setq y_max (cadr (cadddr poly_vertex))))
      )
      (setq lower_pt1 (list x_min y_min))
      (setq upper_pt2 (list x_max y_max))
      (command "chprop" obj_poly "" "la" "G-Anno-Nplt" "") ;change layer name to match normally available layer or remove line
      (setq name (getstring T "\nEnter view name <ENTER>: "))
      (while (tblsearch "view" name)
        (setq name (getstring T "\nView name already exists, please enter new name <ENTER>: "))
      )
      (command "-view" "s" name "e" "l" name "s" "" "")
      (command "-view" "w" name lower_pt1 upper_pt2)
      (setq vscale (/ 1 (getvar "cannoscalevalue"))) ;can be switched out for (getvar "dimscale") or forced to be a specific scale
      (command "-text" "j" "br" upper_pt2 (* 0.0975 vscale) "" (strcat "View Name: " name "   Dimscale: " (rtos (getvar "dimscale") 2 0)) "")
      (command "chprop" (entlast) "" "la" "G-Anno-Nplt" "") ;change layer name to match normally available non-plot layer or remove line
    
      ;; create viewport and set to named model view
      (setvar "tilemode" 0)
      (setvar "osmode" old_osmode)
      (while (not insert_pt)
        (setq insert_pt (getpoint "\nSelect insert point of view: "))
      )
      (setvar "osmode" 0)
      (command "rectangle" insert_pt (strcat "@" (rtos (/ (- (car upper_pt2) (car lower_pt1)) vscale)) "," (rtos (/ (- (cadr upper_pt2) (cadr lower_pt1)) vscale))))
      (command "chprop" (entlast) "" "la" "G-Vprt" "") ;change layer name to match normally available viewport layer or remove line
      (command "mview" "object" (entlast))
      (command "mspace")
      (command "view" "restore" name)
      (command "pspace")
      (command "mview" "lock" "on" "all" "") 
      (setvar "osmode" old_osmode)
    )
    Last edited by BlackBox; 2015-04-16 at 09:08 PM. Reason: Please use [CODE] Tags

  5. #5
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    Should be possible - it sounds like a subset of what I'm working on now. It gets a little... "involved"... in places due to things like arbitrary viewing directions, variable title blocks vs. viewport scale vs. paperspace viewport size, providing a reasonable visualization of modelspace location of viewport *and* front/back clipping planes (if present), and a few extra automation goodies. Trying to avoid trouble with users modifying/erasing objects which they shouldn't, keeping modelspace uncluttered, and how much synchronization is going to be present between model/paperspace and viewports/viewport proxy indicators.

  6. #6
    Member
    Join Date
    2012-11
    Posts
    8
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    Quote Originally Posted by Tom Beauford View Post
    Why not save model space views instead of drawing rectangles? Then set view 1 current in viewport 1, view 2 current in viewport 2…
    You could also zoom object and select a rectangle for each viewport.

    Paper Space has been around more that the 20+ years I've been doing this, so I've never attempted a Model Space view. Concept of "1:500 viewports at A1 in my model" escapes me.
    basically i'll have a set of drawings, lets say min 30 to start, which would be all set up for 1 sheet per particular layout..so after the design is done, all i want to do is go into my design base, add a couple of 1:500 sheets (just basic polygons) that the lisp within the other drawing can go, all right i have a couple of additional rectangles, hence i need a couple more layouts than the 1 sheet i have now. On some projects i might have 10 layouts and others it might just have the one. At the end of the day, everything is done by using the scales within a viewport, i wrote a simple lisp/script that will set the scale and position based on the eastings and northings supplied by me. i was just wanting to take it to the next level by getting a bit of automation.

    I've already worked out my inital batch file to copy the files from a nice hidden away location on a server, prompt for a project number, rename the files using the place holder, rename and repath all the xrefs within the drawing using a loop in a script, now i was thinking out side of the box. About 7 years ago we had a programmer write some pretty ingenious code to generate 100's of survey plans after the base file was nicely setup. unfortunately both him and i no longer work there so i cant actually ring him to pick his brain.

    I work in a civil engineering office, so each set of layouts will look completely different to others as on different themes certain services will take precedence.

  7. #7
    Member
    Join Date
    2012-11
    Posts
    8
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    Quote Originally Posted by Rob_Miller View Post
    I have been framing the sheet view within my working model or model space for close to a decade now. One of the primary reason for doing this is it allows everyone to see the defined drawing areas for both the floor plan and remaining white space. I have worked with people who didn't clearly define the working space and it usually leads to unclear scattered information or poorly configured viewports. By the way, I then use the frames to create views and utilize Sheet Set Manager and Project Navigator to setup the sheet (I prefer to follow the AIA Model file/Sheet file concept instead of a bunch of tabs within the same drawing).

    To the OP ... the code below doesn't currently include an error trap, object filtering on the entsel (expects polyline rectangle), layout manipulation (tilemode will switch to last selected layout tab), or the option to create the viewport as a standalone command. It is provided more as a starting point, you may need to modify portions to get it to function properly. It also currently expects the views and viewports to reside in the same drawing ...

    Code:
    ;; Use polyline rectangle to create a named model view and then recreate viewport on layout tab
    ;; Switch to associated layout tab before running or modify as needed to handle layout switch
    (defun c:rec2view ( / old_osmode poly_list obj_poly poly_vertex x_min x_max y_min y-max lower_pt1 upper_pt2 name vscale insert_pt)
      ;; select polyline rectangle to create named model view
      (setq old_osmode (getvar "osmode"))
      (setvar "osmode" 0)
      (setq poly_list (entget (car (setq obj_poly (entsel))))) ;requires user to select polyline rectangle
      (setq poly_vertex (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) poly_list)))
      (if (> (car (car poly_vertex)) (car (cadr poly_vertex)))
          (progn (setq x_max (car (car poly_vertex))) (setq x_min (car (cadr poly_vertex))))
          (progn (setq x_min (car (car poly_vertex))) (setq x_max (car (cadr poly_vertex))))
      )
      (if (> (cadr (car poly_vertex)) (cadr (cadddr poly_vertex)))
          (progn (setq y_max (cadr (car poly_vertex))) (setq y_min (cadr (cadddr poly_vertex))))
          (progn (setq y_min (cadr (car poly_vertex))) (setq y_max (cadr (cadddr poly_vertex))))
      )
      (setq lower_pt1 (list x_min y_min))
      (setq upper_pt2 (list x_max y_max))
      (command "chprop" obj_poly "" "la" "G-Anno-Nplt" "") ;change layer name to match normally available layer or remove line
      (setq name (getstring T "\nEnter view name <ENTER>: "))
      (while (tblsearch "view" name)
        (setq name (getstring T "\nView name already exists, please enter new name <ENTER>: "))
      )
      (command "-view" "s" name "e" "l" name "s" "" "")
      (command "-view" "w" name lower_pt1 upper_pt2)
      (setq vscale (/ 1 (getvar "cannoscalevalue"))) ;can be switched out for (getvar "dimscale") or forced to be a specific scale
      (command "-text" "j" "br" upper_pt2 (* 0.0975 vscale) "" (strcat "View Name: " name "   Dimscale: " (rtos (getvar "dimscale") 2 0)) "")
      (command "chprop" (entlast) "" "la" "G-Anno-Nplt" "") ;change layer name to match normally available non-plot layer or remove line
    
      ;; create viewport and set to named model view
      (setvar "tilemode" 0)
      (setvar "osmode" old_osmode)
      (while (not insert_pt)
        (setq insert_pt (getpoint "\nSelect insert point of view: "))
      )
      (setvar "osmode" 0)
      (command "rectangle" insert_pt (strcat "@" (rtos (/ (- (car upper_pt2) (car lower_pt1)) vscale)) "," (rtos (/ (- (cadr upper_pt2) (cadr lower_pt1)) vscale))))
      (command "chprop" (entlast) "" "la" "G-Vprt" "") ;change layer name to match normally available viewport layer or remove line
      (command "mview" "object" (entlast))
      (command "mspace")
      (command "view" "restore" name)
      (command "pspace")
      (command "mview" "lock" "on" "all" "") 
      (setvar "osmode" old_osmode)
    )
    thanks mate, i will have a look at this when i get a lazy couple of minutes, i think this will give me a good base to start.

  8. #8
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    From a civil road design point of view you draw an alingment the layouts are created automatically based on a scale and they follow the direction of the alignmnet using UCS to orient along the page.

  9. #9
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: might be a pipe dream - creation of layouts based on data within the model space?

    The answer is yes.

    I would suggest making a rectangular dynamic block for the boundaries in the modelspace.

    I would attach to them as xdata or ldata the necessary parameters to create the layouts and viewports.

    SIze , scale, layoutname etc...

    Then search the modelspace for the dynamic blocks and read the xdata (scale/layoutname) /dynamicblockproperties (length/width) and create the layout and the viewport using activex. The attach to the viewport xdata/ldata that includes the handle of the dynamic block it associates with.

    Then if you change the boundary in modelspace you could have the viewport update itself.

    Or something like that.

    P=
    Quote Originally Posted by camardi View Post
    hello,

    got a bit of a question which may be an absolute pipe dream but here goes....

    if i have a drawing with one layout, does anybody know or heard of a way to do the following using a lisp or script?

    If i create lets say 4 rectangles which represent 1:500 viewports at A1 in my model, is there a way to duplicate the original layout and center each new viewport within these new layouts based on the rectangles within the model space?

    Layout 1 = viewport matches rectangle 1
    Layout 2 = viewport matches rectangle 2
    Layout 3 = viewport matches rectangle 3
    Layout 4 = viewport matches rectangle 4

    i know how to set the view ports based on a centroid using a lisp, but not sure if new layouts can be copied/created based on some specific objects within the model space.
    AutomateCAD

Similar Threads

  1. Replies: 40
    Last Post: 2022-03-21, 08:19 PM
  2. Pipe Render Material Based On Pipe System
    By matt__w in forum Revit MEP - General
    Replies: 14
    Last Post: 2017-04-18, 12:04 PM
  3. Variable creation indicating how many existing layouts within our drawing
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2011-11-16, 09:23 PM
  4. Reducing Pipe Fitting Sizing Issue Based on Pipe Size
    By cdsuggs in forum Revit MEP - Families
    Replies: 0
    Last Post: 2010-07-22, 08:06 PM
  5. Dream Site Dream Client
    By Roger Evans in forum Revit - Gallery
    Replies: 4
    Last Post: 2005-01-04, 07:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •