+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default Set View in Paper Space Viewport Relative to Size of Finished Drawing

    Registered forum members do not see this ad.

    I'm still messing with this automated project and one of the things the users have asked me is this question. And remember, there is no user input allowed. If this is possible, it needs to be done completely by code.

    When the drawing is completed there are three layout tabs, each containing 11x17, 17x22 and 24x36 title block. The scale for 11x17 and 17x22 is 1:16 and the scale for the 24x36 is 1:12. The viewpoint is positioned by yours truly and I simply chose something that would kinda keep things centered. Kinda is the operative word. Because based on the dimensions the user requested for the assembly, the size of the finished drawing will change. Not the scale, we are hoping to keep those left alone however, it's understood that not every size assembly will fit in the viewports as they are presently scaled and this will be one of the only times the user will be allowed to manually adjust the drawing parameters.

    It won't be too hard to determine middle of a diagonal line drawn from the upper most right to the lower most left of the limits of the finished drawing. What I'd like to know is how could I place the center of that diagonal line in the center of the viewport....again, completely automated. No user input will be asked for or allowed.
    It's deja vu, all over again.

  2. #2
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Just use the zoom C option you just need to work out the zoom factor for 1:16 etc

    Just make a viewport then MS then Z C use the model point picked you can do plan, left elevs, right etc thsi way.

    this is bits cut out not tested
    Code:
     (setvar "tilemode" 0)
    (command "_.pspace")
    (command "_.ZOOM" "ALL")
    (command "_.mview" mp1 mp2) ;mp1 & mp2 is size of mview reqd
    (command "_.mspace")
    (command "zoom" "e")
    (setq zc (getpoint "\nPick pt in new window")) 
    (setq sc (getstring "\nScale for this window 1:  "))
    (setq sc3 (strcat "1/" sc "xp"))
    (command "_.zoom" "_center" zc sc3)
    A man who never made mistakes never made anything

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,708

    Default

    If I've understood what you are trying to achieve, collect a Selection Set of all objects in Modelspace and calculate the overall bounding box of the set. From the bounding box, you can determine the central point.

    Activate the viewport in the layout (ActivePViewport and MSpace Document properties), use the ZoomCenter method of the Application object to zoom to the calculated central point and set the viewport CustomScale property to the scale that you require. Done.

    Here is a quick demo of a 'CVP - Center Viewport' function:

    CVP.gif
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  4. #4
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Nice one Lee a picture is more than worth 49 words
    A man who never made mistakes never made anything

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,708

    Default

    How did you get on Bill?
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    I haven't tried to take that part of the process any further. As I examined this point with my supervisor we had to agree that with all the different sizes of assemblies being drawn, there are just too many options. This is becoming clear with other portions of this project as well. Too many variables to try and make a one size fits all. We may visit this again but not until more modules are created to cover the other product lines.
    It's deja vu, all over again.

  7. #7
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,780

    Default

    Maybe as your sheet size is fixed you could compare the size of the bounding box and the plot sheet size this will be some form of ratio that it would fit in a scale.

    eg say ratio is 55 scale 1:50 = 0-50 1:100 = 50-100 1:200 =101-200 so this would fit at 1:100 on sheet press OK.
    if say 237 message this outline will not fit on this sheet size and a reasonable scale do you want to use larger sheet or repick objects to fit on multiple sheets.
    A man who never made mistakes never made anything

  8. #8
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    I had time to finally revisit this topic and I think I have it. The code may not be elegant but it does the trick. Now if I could ask for the following assistance:

    1. Presently, the code will create a new Viewport one of the six layout tabs.
    2. It then sets the layer for the viewport using the (entlast) method.
    3. The scale for the viewport is set. I still have to add some more code to calculate which scale will work best based on the size of the assembly chosen by the user.
    4. The viewport is activated.
    5. The view is zoomed using the Center method with the center being the midpoint of a diagonal line drawn between the upper right and lower left of the scope to be included in the viewport. There are two other essential items in the model space which are left out of this viewport, one being a detail which I hope to use a similar method to scale in a separate viewport, and second a Bill of Materials table which is imported as an OLE object from Excel. The BOM is placed on the last two layout tabs, one being 8-1/2 x 11 and the other 11 x 17.

    It is imperative to remember that this is part of an automated process...no user input is allowed. Everything must be done programatically. The next milestone I'd like to reach with this is to use the existing Viewports in lieu of creating new ones. I create new ones on each run because using the (entlast) method is the only way I've been able to select the viewport to set the scale and to then zoom in with it. Like I said, this may not be pretty but it is working. This is the code for the 8-1/2 x 11 layout tab. I will repeat this for the other three tabs which are 11x17, 17x22 and 24x36. A loop would be nice, I'm working on that now.

    Code:
    (vl-load-com)
     
    (defun zoomit ()
     
      (setvar "CTAB" "8.5x11")
      (command "._pspace")
      (command "._zoom" "a")
      (command "._mview" '(0.125 7.875) '(10.4375 1.28125))
      (setq vp1 (entlast))
      (command "._CHPROP" vp1 "" "LA" "Viewports" "")
      (vlax-put-property (vlax-ename->vla-object vp1) 'CustomScale (/ 1.0 30))
     
      (setq doc (vla-get-activedocument (vlax-get-acad-object)) layouts (vla-get-Layouts doc))
     
     
      ;;;ACTIVATE VIEWPORT
       (vla-put-ActiveSpace doc acPaperSpace)
       (vla-put-MSpace doc acFalse)
       (vl-catch-all-apply 'vlax-invoke-method (list pviewport 'Display acTrue))
       (vla-put-MSpace doc acTrue)
      (setq _tl (polar (polar pt1 pi 20) a90 20)
              _br (polar (polar pt6 0 30) a270 51))
      (command "._ZOOM" "C" (polar _tl (angle _tl _br) (/ (distance _tl _br) 2.)) "")
      (command "._pspace")
     
      (princ)
    ); end zoomit function
    It's deja vu, all over again.

  9. #9
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2013
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    33,026

    Default

    Once everything is fully automated how many CAD techs will be laid off?

    "No user input allowed..." What do your CAD techs do with all their spare time? Is it possible that your firm does not have any CAD techs and all the engineers are responsible for producing their own drawings and that's the reason for automating the entire process? That could be a real financial boon to your company re: keeping costs down.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

  10. #10
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2013
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    870

    Default

    Registered forum members do not see this ad.

    Actually this place is pretty progressive with seeking new ways to improve the production rather than replace production. I think they see the work that I do more as how to get more out of the existing workers rather than how to eliminate existing workers. The do have some loyalty at this place. And their goals are to increase sales by 14% over last year which means they will have to produce 14% more drawings than they did last year.

    As for what do the CAD users do with all the spare time...they produce that 14% more drawings. And as far as the ROI on my time, we have examined this really closely and the time they have saved has more than offset the hourly rate they pay for my time. Plus, they have lots of extra projects, database stuff, housekeeping (clearing old files out of the server after expiration times) that I've automated for them as well.

    Still I hear what you're saying but in this case, at least, they are not looking to layoff anyone. This works by allowing the designers to get away from the drudgery of producing the standard assembly drawings for their core product lines. And the goal will become to place all these processes on the web so their outside sales people can use it as well.
    It's deja vu, all over again.

Similar Threads

  1. How to make sectional view layout on paper space from 3D drawing?
    By Elcyclista in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 20th Dec 2011, 01:49 pm
  2. Bring Paper Space object through Viewport into Model Space
    By karenreeves in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 8
    Last Post: 24th Nov 2011, 08:58 pm
  3. Acad 2010 - Text size changes in model space behave as if in paper space.
    By Trickinitup in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 7th Sep 2011, 03:44 am
  4. paper space: how to move a drawing within a viewport?
    By nilou in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 23rd Jul 2009, 01:52 pm
  5. Enlarge background sheet size(paper space)?
    By lars84 in forum AutoCAD General
    Replies: 4
    Last Post: 16th Nov 2008, 04:08 pm

Bookmarks

Posting Permissions

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