Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Modify a Viewport Entity

241 views
Skip to first unread message

Art Cooney

unread,
Jun 8, 2001, 12:47:10 PM6/8/01
to
ARX allows you to modify viewports including the xdata. Since the ActiveX
interfaces in AutoCAD ultimately use ARX, I think they will also allow
modification of viewports (I don't know much about the ActiveX interfaces,
so I can't say for sure). If so, then you should be able to use the LISP
ActiveX functions to modify viewports.

"Paul Turvill" <nos...@turvill.com> wrote in message
news:F5AE1ADC98EAE23E...@in.WebX.maYIadrTaRb...
> Only Autodesk's programmers know the answer to your question, and they're
> not likely to tell. It's one of those rare cases where you just have to
give
> up and use the (command ...) function.
> ___
>
> "jmodglin" <joshm...@yahoo.com> wrote in message
> news:f0577...@WebX.maYIadrTaRb...
> > I know, I know, AutoCAD help says that this cannot be done. It seems
like
> such a simple procedure. Why can you not modify (ENTMOD or any other
option)
> a Viewport entity (e.g., Add a layer object to the frozen layer group
341)?
> I have looked at Visual Lisp to do this but can't seem to find anything
> either. Suggestions? Thoughts? B.T.W. The goal is that the user selects a
> layer to freeze in all other viewports except the current viewport (and
yes
> I know there is a command like this in Express tools).Thanks in advance.
> Joshua Modglin
> >
>
>


Bobby Jones

unread,
Jun 8, 2001, 12:43:30 PM6/8/01
to
Joshua, It can be done without using (command "vplayer" ...). It is NOT a
simple procedure. I have written a group of functions for manipulating the
frozen layer list attached to viewports. I've posted them to CF. Look for
a post from me titled "Viewports". The two functions that you need to look
at are getVPFLayers & putVPFLayers. Your app will need to follow this basic
outline:

1. Get the layer name to freeze
2. Get a ss of all viewports to add this layer to
3. start a loop of all viewports selected
4. get a list of current frozen layers with getVPFLayers
5. add your new layer name to this list
6. call putVPFLayers with the new layer list

The layer list is simply a list of layer names
("layer1" "layer2" "layer...")

Both functions are expecting ActiveX viewport objects as arguments. The
help files are correct, you cannot entmod or entmake a viewport entity. You
must use ActiveX, or the vplayer command, to create and/or modify a
viewport. Currently I'm getting some sporadic errors with the putVPFLayers
function. I'm starting to think that it has to do with the UI that I've
created. Please look these over, use 'em, abuse 'em, change 'em if you need
to. Good luck and if you do decide to use them, let me know how they work
out.
--
Bobby C. Jones
p.s. - I do have a re-write of the putVPFLayers that uses the vplayer
command that works without error. If you want it, I'll post it also.
p.p.s. & f.y.i. & s.f.f.t.(some food for thought) - The express tools
command uses the vplayer command to freeze the layers.

Bobby Jones

unread,
Jun 11, 2001, 5:02:33 PM6/11/01
to
Vlad, I only found part of the thread in my meager search attempts. Did you
happen to save your code? Thanks.
--
Bobby C. Jones

"Vladimir Nesterovsky" <vne...@netvision.net.il> wrote in message
news:28258CC816EA34FB...@in.WebX.maYIadrTaRb...
> Bobby Jones <bjo...@beazer.com> wrote in message
> news:532072E3C40C950D...@in.WebX.maYIadrTaRb...
> > You are correct, my functions require that the viewport being changed is
> in
> > the current layout tab. Getting the viewports from non-active layouts
and
> > changing eed hmmm.....I don't think it's possible. Maybe it's possible
to
>
> Don't know about that particular problem, but not long ago I posted
> here a function that will make all viewports Locked, in all Layouts.
> It can even be ran from Tiled Model Space. :-) Uses exclusively
> ActiveX lisp functions.
>
> > .....
>
> Cheers,
> --
> Vlad http://vnestr.tripod.com/
> (define (list . a) a)
>
>
>
>


Paul Turvill

unread,
Jun 8, 2001, 12:01:47 PM6/8/01
to
Only Autodesk's programmers know the answer to your question, and they're
not likely to tell. It's one of those rare cases where you just have to give
up and use the (command ...) function.
___

"jmodglin" <joshm...@yahoo.com> wrote in message

Vladimir Nesterovsky

unread,
Jun 13, 2001, 8:00:37 AM6/13/01
to
Bobby Jones <bjo...@beazer.com> wrote in message
news:3C0E38021A48AE08...@in.WebX.maYIadrTaRb...

> Vlad, I only found part of the thread in my meager search attempts. Did
you
> happen to save your code? Thanks.
> --
> Bobby C. Jones

Here's that post again. :-)


Cheers,
--
Vlad http://vnestr.tripod.com/
(define (list . a) a)


----- Original Message -----
From: Vladimir Nesterovsky <vne...@netvision.net.il>
Newsgroups: autodesk.autocad.customization
Sent: Thursday, April 26, 2001 1:43 AM
Subject: Re: needing to select all viewports on multipule layouts


> A few comments, if I may --- :-)
>
> (setvar "ctab" item) when switching to new layout, will regenerate it.
> This is obviously time consuming and quickly becomes unacceptable
> when DWG has any significant size, multiple XREFs etc. Besides,
> as shocking as it may sound, I think the whole business of multiple
> paper spaces is a bad, half baked idea -- one and primary argument is
> the regens at layout switching. We can just as well put all the maps
> onto one PS, as we did before in r14.
>
> And what genius decided to limit MAXACTVP to be at least 2, and
> why, I don't know. That's besides the fact that it reports VPs number
> in a manner very confusing for a simple user, (as opposed to a
> programmer), counting the PS VP which can just as well be safely
> ignored.
>
> Nevertheless, back to the issue. It is possible to lock
> all layouts via ActiveX functions, and it works without any
> layout switching, even from ModelSpace:
>
> (defun c:vpLockAll ( / acad doc ls lay bs b e )
> (vl-load-com)
> (setq acad (vlax-get-acad-object)
> doc (vla-get-ActiveDocument acad)
> ls (vla-get-Layouts doc))
> (vlax-for lay ls
> (if (eq :vlax-false (vla-get-ModelType lay))
> (setq bs (cons (vla-get-Block lay) bs))))
> (foreach b bs
> (vlax-for e b ; for each ent in layout's block
> (if (eq (vla-get-ObjectName e) "AcDbViewport")
> (vla-put-DisplayLocked e :vlax-true))))
> (princ "\n Done. ")
> (princ))
>
> HTH
> http://vnestr.tripod.com/
>
> Keith <m...@yourmail.com> wrote in message
> news:16222AD0B25E8934...@in.WebX.maYIadrTaRb...
> > Thanks Jason. I'll look at it tomorrow at work.
> >
> > Jason Piercey <Ja...@atreng.com> wrote in message
> > news:3AE4A401...@atreng.com...
> > > If anyone is interested. Here it is.
> > >
> > > (defun C:VpLockAll (/ ss otab)
> > > (setq otab (getvar "ctab"))
> > > (foreach item (layoutlist)
> > > (setvar "ctab" item)
> > > (setq ss (ssget "x" '((0 . "VIEWPORT"))))
> > > (command ".-vports" "Lock" "On" ss "")
> > > );foreach
> > > (setvar "ctab" otab)
> > > (princ)
> > > );defun
> > >
> > > (defun C:VpUnLockAll (/ ss otab)
> > > (setq otab (getvar "ctab"))
> > > (foreach item (layoutlist)
> > > (setvar "ctab" item)
> > > (setq ss (ssget "x" '((0 . "VIEWPORT"))))
> > > (command ".-vports" "Lock" "Off" ss "")
> > > );foreach
> > > (setvar "ctab" otab)
> > > (princ)
> > > );defun
> > >
> > > -Jason
> > >
> > > Kent Elrod wrote:
> > > >
> > > > You are correct sir.
> > > >
> > > > --
> > > >
> > > > Kent Elrod
> > > > Facilities Design
> > > > Sumitomo Sitix Silicon, Inc
> > > > Albuquerque, New Mexico
> > > > kel...@stopspam.ssaq.sitix.com
> > > >
> ************************************************************************
> > > >
> > > > "Bernd A. Hoffmann" <behof...@burrisoptics.com> wrote in message
> > > > news:3AE4A42F...@burrisoptics.com...
> > > > > Only works in one layout at a time. Jason's switches layouts and
> locks
> > > > > all viewports in each layout.
> > > > >
> > > > > Kent Elrod wrote:
> > > > > >
> > > > > > (defun C:mla (/) (command "mview" "lock" "on" "all" "")
(princ ))
> > > > > >
> > > > > > --
> > > > > >
> > > > > > Kent Elrod
> > > > > > Facilities Design
> > > > > > Sumitomo Sitix Silicon, Inc
> > > > > > Albuquerque, New Mexico
> > > > > > kel...@stopspam.ssaq.sitix.com
> > > > > >
> > ************************************************************************
> > > > > >
> > > > > >
> > > > > >
> > > > > > "keithk" <kkac...@yahoo.com> wrote in message
> > > > > > news:f0452...@WebX.maYIadrTaRb...
> > > > > > I've got a dwg that's got about 15 layouts with viewports
in
> > > > > > them. How can I select them all to lock the viewports? I'm
> > > > > > using 2000
> > > > >
> > > > > --
> > > > > Regards, Bernd
> > > > > Designer
> > > > > Burris Savvy Optics
> > > > > http://www.burrisoptics.com/
> >
>
>

Art Cooney

unread,
Jun 14, 2001, 10:52:37 AM6/14/01
to
Try removing all the ACAD xdata from the viewport (make sure the viewport's
not active when you do so) and then put back all the xdata except the layers
that you don't want. I don't know if this will work, but it might.


"Bobby Jones" <bjo...@beazer.com> wrote in message

news:FE532950B8156C14...@in.WebX.maYIadrTaRb...
> The get/set XData methods are indeed available to anyone accessing the
> ActiveX model with VB, VBA, Vlisp, or whatever. I've encountered two
> problems that may hinder what Joshua is trying to do. The first is that
the
> setXData method does not 'erase' the existing eed. All 1003 layer groups
> passed to the viewport are added to the existing 1003 layer group lists.
I
> got around this by creating a copy of the original viewport w/o any 1003
> layer groups. This is were I'm thinking that you could run into trouble.
> You can't use the copy method, as it copies attached eed also. The next
> problem that I ran into is that once you copy the viewport and attach the
> eed, it doesn't update on screen. Regens and the update method have zero
> (0) effect. You can close the drawing and open it back up to see the
layers
> that were frozen, or what I did was to then issue the copy method and
erase
> the viewport that was created in the previous step. So if you can find a
> way to copy and delete objects in a block def., then I think that it's all
> possible. Or learn vc++ and ObjectARX real quick and knock that sucker
out
> over the weekend ;-)
> --
> Bobby C. Jones
> p.s. - you'll find the necessary lisp code to get and set a viewports view
> in the code that I previously posted to CF.
>
> "Art Cooney" <ar...@autodesk.com> wrote in message
> news:80ECE049A47B28A4...@in.WebX.maYIadrTaRb...
> > For AutoCAD 2000 I added methods to the AcDbViewport class to allow
> freezing/thawing layers in the viewport. These methods work regardless of
> whether the viewport is in the current paper space or not. Unfortunately,
> no VB/VBA equivalents to these methods were implemented. I don't know if
> VB/VBA methods were done for AutoCAD2000i or 2002, but I don't think they
> were.
> >
> > ARX also allows you to directly modify the XData on viewports. I think
> the get/set XData functionality is also available in VB/VBA. Since VB/VBA
> uses ARX to do the actual work, it should also be able to modify the XData
> on viewports.
> >
> > The viewport's view data is no longer stored as XData in the viewport,
but
> the get/set XData methods for viewports will translate view XData (this
was
> done for compatibility with older programs).
>
>
>


Bobby Jones

unread,
Jun 14, 2001, 11:25:42 AM6/14/01
to
Art,

Thanks for the thoughts. This project has been with me for a while and
won't soon be finished, I'm sure. I tried several things to get this to
work. I tried simply passing the xdata with just the layers that I wanted
frozen. But the existing xdata remained and any layers that I passed that
were not already stored were simply added to the list. So then I removed
all the 1003 layer groups from the xdata and passed it back with the
setxdata method and again it did not remove any existing layers. I could
not get the setxdata method to remove any existing xdata in the "ACAD" app.;
only modify and append to what was already there. Like I said before, I got
around this by re-creating the viewport without any 1003 layer groups and
then deleting the original viewport (that is much easier said than done
<g>). If there is indeed a way to remove xdata in the "ACAD" app, then I
would be eternally grateful to the kind soul that could show me the light.
Thanks again.
--
Bobby C. Jones

"Art Cooney" <ar...@autodesk.com> wrote in message

news:A936875F994B4313...@in.WebX.maYIadrTaRb...

0 new messages