Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Viewport Creation Tool to share with you.

  1. #1
    Active Member Shinyhead's Avatar
    Join Date
    2006-07
    Location
    Gainesville, FL
    Posts
    84


    Default Viewport Creation Tool to share with you.

    I am sharing one of my tools I made to create viewports in LT 08 on layout tabs.
    I hope it saves someone time the way it does me. If you catch any problems with it let me know, its fairly new and has not been through a lot of troubleshooting.


    You may need to modify the macro to put the viewport on whatever layer you use in your drawings, this one uses "VIEWPORTS"

    It works as follows.
    Start on a layout tab where you want to create a viewport.
    Start the command.
    Enter the scale desired for the viewport.
    It will switch to model space and prompt you to create a rectangle to define the area you want shown in the viewport.
    It will then switch back to the layout tab and prompt you to draw the viewport you want.
    It will then create the viewport, zoom to the area, delete the rectangle, zoom to the correct scale and set the annotation scale, then lock the viewport.

    Here is the macro text

    _DYNMODE;0;_SETENV;USERI2;\_SETENV;USERS1;$M=$(GETVAR,CTAB);-LAYOUT;S;MODEL;CANNOSCALE;1:$M=$(GETENV,USERI2);RECTANGLE;\\-LAYOUT;S;"$M=$(GETENV,USERS1)";-LA;S;VIEWPORTS;;VPORTS;\\MSPACE;ZOOM;O;L;;ERASE;L;ZOOM;S;1/$M=$(GETENV,USERI2)XP;PSPACE;-VPORTS;L;ON;ALL;;DYNMODE;1;

    Here is a breakdown of how it works.
    _DYNMODE;0;

    (turns of dynamic input, necessary for the macro to work)
    _SETENV;USERI2;\

    (type in the scale of the viewport you will want here)

    _SETENV;USERS1;$M=$(GETVAR,CTAB);
    (records name of your current layout tab)

    -LAYOUT;S;MODEL;
    (switches to model space)

    CANNOSCALE;1:$M=$(GETENV,USERI2);
    (sets annotation scale to the scale of the viewport you will create)

    RECTANGLE;\\
    (creates a rectangle to define what you want to show in the viewport)

    -LAYOUT;S;"$M=$(GETENV,USERS1)";
    (switches back to your layout tab)

    -LA;S;VIEWPORTS;;VPORTS;\\
    (create the viewport)

    MSPACE;ZOOM;O;L;;
    (zoom object to the rectangle you created in model space)

    ERASE;L;;
    (erases the model space rectangle you made)

    ZOOM;S;1/$M=$(GETENV,USERI2)XP;
    (zooms to the correct scale)

    PSPACE;-VPORTS;L;ON;ALL;;
    (locks the viewport (all of them on that layout actually))

    DYNMODE;1;
    (turns dynamic input back on)

  2. #2
    Member
    Join Date
    2007-04
    Posts
    20


    Smile Re: Viewport Creation Tool to share with you.

    Hi!

    Look pretty good and its a great idea. It will help a lot. As the CAD
    manager for the office, I'm always looking for ways to make it easier
    for my user. Some of them are having problem grasping the viewport
    modelspace/paperspace environment.

    The only question I have....I'm assuming that you are using only scales existing
    in your scales list? I tried your tool and it work fine as long as I stay within the
    scale list. If I punch in anything else, it dies. To correct the problem, I have to
    go to "editscalelist", then add a new one. When I try the command again, it work
    for the newly created scale. I don't know if it was your original intent, but it would
    be awesome if it would create the new scale on the fly as you input then through
    your tool.

    I have been playing around with variation of your command but had no luck so far.
    I get around good with srcipt, but I'm not too good when it comes to MACRO.

    Any ideas????

    Jean

  3. #3
    Active Member Shinyhead's Avatar
    Join Date
    2006-07
    Location
    Gainesville, FL
    Posts
    84


    Default Re: Viewport Creation Tool to share with you.

    Hey,
    Thanks for the input and critique.

    First off, the command has refined itself a bit and here is my latest version

    _SETENV;USERI2;\_SETENV;USERS1;$M=$(GETVAR,CTAB);-LAYOUT;S;MODEL;CANNOSCALE;1:$M=$(GETENV,USERI2);RECTANGLE;\\-LAYOUT;S;"$M=$(GETENV,USERS1)";-LA;S;VIEWPORTS;;VPORTS;\\MSPACE;ZOOM;O;L;;ERASE;L;;ZOOM;S;1/$M=$(GETENV,USERI2)XP;PSPACE;-VPORTS;L;ON;ALL;;MSPACE;-LA;S;NOTES;;-INSERT;VIEWLABEL;\;1;;


    Now, as for scale, it should not matter what scale you input, but you should know the format you need to use (I should have posted that before, sorry)

    for instance to get your scale you need to know the ratio. i.e. full scale is 1:1, 3" scale is 1:4
    3/4" scale is 1:16. The number you need is the one after the colon. So to get 1/4" scale you simply type in 48 at the scale prompts.

    Should work better for you now with that explained.

    Also, this particular version also will prompt for you to insert an annotative block on the "NOTES" layer too. My view label block is annotative AND fills out the scale automatically. Handy, but I had to use full to create the block.

    Let me know if this version works better for you, I tweaked it and cleaned it up a bit since the first version was posted.

  4. #4
    Member
    Join Date
    2007-04
    Posts
    20


    Talking Re: Viewport Creation Tool to share with you.

    Hi!

    Just a quick one....

    First off, I tried your new version with some modification.
    I changed the "VIEWPORTS" layer name to our own (_ANNO_NPLT) and changed
    the "NOTES" layer to match our own also (_ANNO_TXTE).

    As for the scale input, I had already figured it out. We use metric and therefore is very
    easy for us (i.e. if we need 1 to 10, we just punch 10....).

    But there is one part that I keep getting an error. It is looking for a drawing call
    "VIEWLABEL". So my question is...

    What are you trying to acheive with the "-INSERT;VIEWLABEL;\;1;;"

    Once I know, I can try to adjust.

    Thanks again, much appreciated!

    Jean

  5. #5
    Active Member Shinyhead's Avatar
    Join Date
    2006-07
    Location
    Gainesville, FL
    Posts
    84


    Default Re: Viewport Creation Tool to share with you.

    That portion inserts a viewlabel block (annotative so it stays at a scale of 1)

    I have attached an example block that has a field with a diesel routine embedded for showing view scale. (I had to get the field using acad full, but it displays fine in LT).
    Attached Files Attached Files

  6. #6
    Member
    Join Date
    2007-04
    Posts
    20


    Talking Re: Viewport Creation Tool to share with you.

    Hi!

    Now it make more sense and I like the idea of the title block inserted
    as you create the viewport. As a mather of fact, I tweak your routine
    to use one of our standard block for title and it work no problem.

    But I still get error when I use a scale that is not already in the scale list.

    I know you said that it should work no mather but it does have issue with scale.

    I have attached a screen copy of the error. Maybe you can see what's wrong....

    Jean

    Thanks again...help much appreciated!!!
    Attached Images Attached Images

  7. #7
    Active Member Shinyhead's Avatar
    Join Date
    2006-07
    Location
    Gainesville, FL
    Posts
    84


    Default Re: Viewport Creation Tool to share with you.

    I think I have it. I had to replicate the error to see what was happening.
    Edit your scale list to have 1:750 as one of your standard scales. If a scale is not on the list, it cannot change to it.

    I would make sure your base template has all your scales so you don't run into that . Then you won't have that problem in the future. That is one of the sticky points to annotative objects, but its easily solved.

  8. #8
    Member
    Join Date
    2007-04
    Posts
    20


    Thumbs up Re: Viewport Creation Tool to share with you.

    Hummmm!

    I was hoping that the scale would add themselves to the list....
    like an autocreate scale tool. The things is, I can have the list updated
    with all the commons scale used by the office. But there is always
    the times when a scale will not be part of the list or the user will
    require a printout of the available scale because he won't remember
    what to punch in and try many variation and get frustrated (yes, we do
    have a bunch of these guys. Some of them have been trying to work
    with AutoCAD since 1995 and still don't know how to use it). So by
    making it "dummy" proof it would make my life easier.

    There must be a way....I'll have to look into it deeper.

    Well, Thanks you very much for all the help. It is much appreciated.

    Jean

  9. #9
    Active Member Shinyhead's Avatar
    Join Date
    2006-07
    Location
    Gainesville, FL
    Posts
    84


    Default Re: Viewport Creation Tool to share with you.

    Hows this for service!!!

    _SETENV;USERI2;\_SETENV;USERS1;$M=$(GETVAR,CTAB);-LAYOUT;S;MODEL;-SCALELISTEDIT;A;1:$M=$(GETENV,USERI2);1:$M=$(GETENV,USERI2);E;CANNOSCALE;1:$(GETENV,USERI2);RECTANGLE;\\-LAYOUT;S;"$M=$(GETENV,USERS1)";-LA;S;VIEWPORTS;;VPORTS;\\MSPACE;ZOOM;O;L;;ERASE;L;;ZOOM;S;1/$M=$(GETENV,USERI2)XP;PSPACE;-VPORTS;L;ON;ALL;;MSPACE;-LA;S;NOTES;;-INSERT;CUI_VIEWLABEL;\;1;;


    This will now also add the scale to the scalelist for you. Wasn't sure it would work because of the length, but it fits in the character limit for macros.

  10. #10
    Member
    Join Date
    2007-09
    Posts
    2


    Default Re: Viewport Creation Tool to share with you.

    Is there any way to use a layout tab with spaces in the name (s0407-1 S1.1)?

    I use the layout tab in a portion of my plot stamp (since LT doesn't have fields).

    Thanks,
    Lance

Page 1 of 2 12 LastLast

Similar Threads

  1. What's the best way to share tool palettes?
    By Pierre P in forum AutoCAD Customization
    Replies: 20
    Last Post: 2016-02-10, 05:33 PM
  2. Viewport creation and frozen layers
    By cwjean76 in forum AutoCAD General
    Replies: 3
    Last Post: 2008-07-10, 06:00 PM
  3. Easiest way to share a tool bar???
    By cmason in forum AutoCAD CUI Menus
    Replies: 10
    Last Post: 2008-05-30, 04:26 PM
  4. Replies: 4
    Last Post: 2005-07-28, 09:02 PM
  5. Create and share multiple Tool Palettes in AutoCAD 2005
    By caduzer in forum AutoCAD Customization
    Replies: 2
    Last Post: 2004-12-08, 07:46 PM

Posting Permissions

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