Jump to content

Viewports in macros and command lines?


MrCrozzB

Recommended Posts

Can I modify an existing viewport in a macro or in the command line?

 

Using a macro, I want to modify (specifically delete) the viewport from a layout tab after chspace from model space.

 

Does anyone know how to do this?

 

I have LT so no LISP. :ouch:

qselect works but cannot be put into a macro. :x

 

If I "select all" on a layout tab in paperspace ACAD says 1 of the objects selected is the viewport so I know autocad recognizes the viewport as a different kind of object.

 

Thanks for your help.:)

Link to comment
Share on other sites

LT doesn't give us a lot of options, you could try select and then enter "p" for previous, for me that selects the viewport after you have used pspace. when you are in a viewport "cvport" will tell you the number of that viewport and you can use that to swap between viewports on a layout (providing you know the numbers).It all depends on what you are doing. You can enter coordinates at the select prompt for a selection window. If at some point you can put the viewport into a named group, then select offers you the chance to select that as well.

Jusdt a few ideas to look at. :)

Edit ---oops the first option doesn't work, I had resized the viewport to try things thats why it showed up as the previous selection---

Edited by steven-g
Link to comment
Share on other sites

There are a couple of other methods you could use to just select viewports but it would only select all viewports, if you only have one viewport then ok but if you want to select one from many ??

Link to comment
Share on other sites

Lets assume I only have single viewport. I have written a maco to generate a generic viewport at extents on a new layout tab but then i want delete the viewport later in the macro. The whole point is to make a scale copy of everything in model space but save it on a layout tab in paperspace. Kind of a poor mans revision tracker.

Link to comment
Share on other sites

OK it's LT so a bit long winded, but probably your easiest would be create the viewport on it's own layer. Then when you are done you can use the command line -LAYER to lock all layers using "*" and then unlock the layer for the viewport using it's layer name, after that just select "all" and delete, everything else on locked layers is left alone, now just unlock everything.

That's just a basic outline, I hope you can follow the line of thought, but sometimes in order to get something done, you have to start somewhere else.

Link to comment
Share on other sites

I should mention that I wrote a macro that works using a combination of select all, previous, and remove but I would like to be able to be able to do other things with the viewport in the macro.

 

I don't particularly mind if it takes longer, since its just going into a button so I will give this a try.

 

If you can find a way to be able to select the viewport using the command line because ACAD will do it with qselect. What I would really like is to use command line for the same things you can do in qselect so that the same things can be done with macros if you know things like object type or color etc.

Edited by MrCrozzB
Link to comment
Share on other sites

It isn't straight forward. I use tricks like the above, but it does mean planning ahead, do things like putting objects onto named layers, another method is putting things into named groups (you can select a group from the command line, for viewports you could draw a rectangle, use mview to to change it into a viewport and then use the selectsimilar command, it all depends on what you are doing and what you want to achive.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...