Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modelspace viewport count by activex ...

23 REPLIES 23
Reply
Message 1 of 24
Anonymous
778 Views, 23 Replies

Modelspace viewport count by activex ...

Has anyone else found the results bogus or unreliable?

(vla-get-count
(vla-get-viewports
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)

I have a drawing with 4 modelspace vports; *NO* viewports in paperspace (
aside from paperspace itself ), yet the above code reports 27. I've toggled
the active space back and forth, re-opened the dwg. Done an audit / recover
etc. No change.

Other drawings correctly report the modelspace vport count.

Is it a flaky method or am I misinterpreting the results / failing to
understand the vla-get-viewports method ( collection of all
viewports in the drawing )?

PS: I initially encountered the problem using objectdbx, ie:

(vla-get-count
(vla-get-viewports DBXDOC)
)

but the same values ( one would hope ) are realized opening the dwg in the
editor and using

(vla-get-count
(vla-get-viewports
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)

Thanks for any enlightening thoughts fellow lithpers.

Michael.
23 REPLIES 23
Message 2 of 24
Anonymous
in reply to: Anonymous

So what's new, yeah that's not the only screwy function.

Seems to be something missing...not your code.

"michael puckett" wrote in message
news:850A9B40931ABA0588C3E7A73AAEAEB6@in.WebX.maYIadrTaRb...
> Has anyone else found the results bogus or unreliable?
>
> (vla-get-count
> (vla-get-viewports
> (vla-get-activedocument
> (vlax-get-acad-object)
> )
> )
> )
>
> I have a drawing with 4 modelspace vports; *NO* viewports in paperspace (
> aside from paperspace itself ), yet the above code reports 27. I've
toggled
> the active space back and forth, re-opened the dwg. Done an audit /
recover
> etc. No change.
>
> Other drawings correctly report the modelspace vport count.
>
> Is it a flaky method or am I misinterpreting the results / failing to
> understand the vla-get-viewports method ( collection of all
> viewports in the drawing )?
>
> PS: I initially encountered the problem using objectdbx, ie:
>
> (vla-get-count
> (vla-get-viewports DBXDOC)
> )
>
> but the same values ( one would hope ) are realized opening the dwg in the
> editor and using
>
> (vla-get-count
> (vla-get-viewports
> (vla-get-activedocument
> (vlax-get-acad-object)
> )
> )
> )
>
> Thanks for any enlightening thoughts fellow lithpers.
>
> Michael.
>
>
Message 3 of 24
Anonymous
in reply to: Anonymous

Just so you know, I'm not trying to be funny, but doesn't seem everything is
running as smooth as it should.

They (Autodesk) wrote a disclaimer regarding the functions they found to be
flawed, leaving us the rest to find.


"Rudy Tovar" wrote in message
news:D3181F710F163F2720E181F7BE294056@in.WebX.maYIadrTaRb...
> So what's new, yeah that's not the only screwy function.
>
> Seems to be something missing...not your code.
>
> "michael puckett" wrote in message
> news:850A9B40931ABA0588C3E7A73AAEAEB6@in.WebX.maYIadrTaRb...
> > Has anyone else found the results bogus or unreliable?
> >
> > (vla-get-count
> > (vla-get-viewports
> > (vla-get-activedocument
> > (vlax-get-acad-object)
> > )
> > )
> > )
> >
> > I have a drawing with 4 modelspace vports; *NO* viewports in paperspace
(
> > aside from paperspace itself ), yet the above code reports 27. I've
> toggled
> > the active space back and forth, re-opened the dwg. Done an audit /
> recover
> > etc. No change.
> >
> > Other drawings correctly report the modelspace vport count.
> >
> > Is it a flaky method or am I misinterpreting the results / failing to
> > understand the vla-get-viewports method ( collection of all
> > viewports in the drawing )?
> >
> > PS: I initially encountered the problem using objectdbx, ie:
> >
> > (vla-get-count
> > (vla-get-viewports DBXDOC)
> > )
> >
> > but the same values ( one would hope ) are realized opening the dwg in
the
> > editor and using
> >
> > (vla-get-count
> > (vla-get-viewports
> > (vla-get-activedocument
> > (vlax-get-acad-object)
> > )
> > )
> > )
> >
> > Thanks for any enlightening thoughts fellow lithpers.
> >
> > Michael.
> >
> >
>
>
Message 4 of 24
Anonymous
in reply to: Anonymous

On 17.09.2003 18:25 michael puckett wrote:

>Has anyone else found the results bogus or unreliable?
>
>
>

didn't test for long but here's what i noticed:

tilemode 1, vports from 1 to 4 - function returns 1 (last state)
tm 0 - function returns 4

so the function only returns the correct count when switching tilemode
(vanilla 2004 e-international)

same with saved viewport configurations.
tilemode 1 - vports saved & changed
after switching tilemode correct count of sum of all viewports (active
plus saved)

and: reliable so far (10 minutes ;-).

btw has nothing to do with LAYOUTREGENCTL


--
ruul
Message 5 of 24
Anonymous
in reply to: Anonymous

As much as I might enjoy jumping on the "bash Autodesk" wagon, it appears that
the dwg does have 27 vport objects:

I ran this:

(vlax-for viewport
(vla-get-viewports
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(print
(vl-remove-if 'null
(mapcar
'(lambda (x) (if (member (car x) '(-1 0 5)) x))
(entget (vlax-vla-object->ename viewport))
)
)
)
)

and this was the result:

((-1 . ) (0 . "VPORT") (5 . "A1E2"))
((-1 . ) (0 . "VPORT") (5 . "A1E3"))
((-1 . ) (0 . "VPORT") (5 . "A1E4"))
((-1 . ) (0 . "VPORT") (5 . "A1E5"))
((-1 . ) (0 . "VPORT") (5 . "A1E6"))
((-1 . ) (0 . "VPORT") (5 . "A1E7"))
((-1 . ) (0 . "VPORT") (5 . "A1E8"))
((-1 . ) (0 . "VPORT") (5 . "A1E9"))
((-1 . ) (0 . "VPORT") (5 . "A1EA"))
((-1 . ) (0 . "VPORT") (5 . "A1EB"))
((-1 . ) (0 . "VPORT") (5 . "A1EC"))
((-1 . ) (0 . "VPORT") (5 . "A1ED"))
((-1 . ) (0 . "VPORT") (5 . "A1EE"))
((-1 . ) (0 . "VPORT") (5 . "A1EF"))
((-1 . ) (0 . "VPORT") (5 . "A1F0"))
((-1 . ) (0 . "VPORT") (5 . "A1F1"))
((-1 . ) (0 . "VPORT") (5 . "A1F2"))
((-1 . ) (0 . "VPORT") (5 . "A1F3"))
((-1 . ) (0 . "VPORT") (5 . "A1F4"))
((-1 . ) (0 . "VPORT") (5 . "A1F5"))
((-1 . ) (0 . "VPORT") (5 . "A1F6"))
((-1 . ) (0 . "VPORT") (5 . "A1F7"))
((-1 . ) (0 . "VPORT") (5 . "A1F8"))
((-1 . ) (0 . "VPORT") (5 . "BA6E"))
((-1 . ) (0 . "VPORT") (5 . "BA6F"))
((-1 . ) (0 . "VPORT") (5 . "BA70"))
((-1 . ) (0 . "VPORT") (5 . "BA71"))

Why there are 27 in the dwg when modelspace only sports 4 (and none in
paperspace) is a mystery at this point. Residual artifacts from earlier vport
command sequences?

Hmmmm ...

"Rudy Tovar" wrote in message
news:D3181F710F163F2720E181F7BE294056@in.WebX.maYIadrTaRb...
So what's new, yeah that's not the only screwy function.

Seems to be something missing...not your code.

"michael puckett" wrote in message
news:850A9B40931ABA0588C3E7A73AAEAEB6@in.WebX.maYIadrTaRb...

> Has anyone else found the results bogus or unreliable?

< snippage >
Message 6 of 24
Anonymous
in reply to: Anonymous

why not use: (vports)
Message 7 of 24
Anonymous
in reply to: Anonymous

Thanks Luis, but I'm writing an auditing program for our company using
objectdbx 🙂

"Luis Esquivel" wrote in message
news:f18aff4.4@WebX.maYIadrTaRb...
why not use: (vports)
Message 8 of 24
Anonymous
in reply to: Anonymous

So what you're saying is that there's 23 hidden vports or stored?

"michael puckett" wrote in message
news:6EB36962680E4D6EA5E20402F80144D5@in.WebX.maYIadrTaRb...
> Thanks Luis, but I'm writing an auditing program for our company using
> objectdbx 🙂
>
> "Luis Esquivel" wrote in message
> news:f18aff4.4@WebX.maYIadrTaRb...
> why not use: (vports)
>
>
Message 9 of 24
Anonymous
in reply to: Anonymous

Michael,
Do you want the number of paperspace viewports? If so then
you don't want vla-get-viewports. Viewports are objects that
contain the view settings of vports in model space. Each saved
viewport configuration has a number of viewports associated with
it. The active viewport configuration also (I think) has a copy
of the viewports that have been saved. There is also a relationship
between layouts and model space viewports but I don't know
the specifics.
Does that help?

"michael puckett" wrote in message
news:6EB36962680E4D6EA5E20402F80144D5@in.WebX.maYIadrTaRb...
> Thanks Luis, but I'm writing an auditing program for our company using
> objectdbx 🙂
>
> "Luis Esquivel" wrote in message
> news:f18aff4.4@WebX.maYIadrTaRb...
> why not use: (vports)
>
>
Message 10 of 24
Anonymous
in reply to: Anonymous

Also,

I run the -vports command and save the configuration to "test"

then...

(tblnext "vport" "test")
(setq vla_vport (vlax-ename->vla-object (tblobjname "vport" "test")))

(vla-delete vla_vport) <= but does not work....
Message 11 of 24
Anonymous
in reply to: Anonymous

Hi Doug,

What I'm trying to do is get the modelspace vport count.

But - your info helped. Lots. Said drawing has 12 named viewports in
modelspace ( including the *Active* Viewport, which sports 4 ).

Between all of the named viewports there are precisely 27 possible vports.

THANKS 🙂

( and thanks to Luis and Rudy who prompted me to think of other things too ).

"Doug Broad" wrote in message
news:6D8B885AF0F1479953CD51271E37E35A@in.WebX.maYIadrTaRb...
Michael,
Do you want the number of paperspace viewports? If so then
you don't want vla-get-viewports. Viewports are objects that
contain the view settings of vports in model space. Each saved
viewport configuration has a number of viewports associated with
it. The active viewport configuration also (I think) has a copy
of the viewports that have been saved. There is also a relationship
between layouts and model space viewports but I don't know
the specifics.
Does that help?
Message 12 of 24
Anonymous
in reply to: Anonymous

Michael,

return the number of viewports in model:

(setvar "tilemode" 1)
(length (vports))

> What I'm trying to do is get the modelspace vport count.
Message 13 of 24
Anonymous
in reply to: Anonymous

Oops, Ruul too 🙂

"michael puckett" wrote in message
news:F22147A850D98AF788249F129CCDAD00@in.WebX.maYIadrTaRb...

< snip >

( and thanks to Luis and Rudy who prompted me to think of other things too ).

< snip >
Message 14 of 24
Anonymous
in reply to: Anonymous

B y o b j e c t d b x .

But thanks 🙂

"Luis Esquivel" wrote in message
news:5DC806B080E86C9132F934AFF63969F7@in.WebX.maYIadrTaRb...
Michael,

return the number of viewports in model:

(setvar "tilemode" 1)
(length (vports))

> What I'm trying to do is get the modelspace vport count.
Message 15 of 24
Anonymous
in reply to: Anonymous

Sorry SIR I did not read your previous... it won't happen again... I
promised!... cross my heart! 😉


"michael puckett" wrote in message
news:55C05DFC40F54DAF16001E00846DB3E0@in.WebX.maYIadrTaRb...
> B y o b j e c t d b x .
>
> But thanks 🙂
>
> "Luis Esquivel" wrote in message
> news:5DC806B080E86C9132F934AFF63969F7@in.WebX.maYIadrTaRb...
> Michael,
>
> return the number of viewports in model:
>
> (setvar "tilemode" 1)
> (length (vports))
>
> > What I'm trying to do is get the modelspace vport count.
>
>
Message 16 of 24
Anonymous
in reply to: Anonymous

No worries mang! Appreciate you dropping by my thread; cheers 🙂

"Luis Esquivel" wrote in message
news:B6023E49589859CC7996FA7A4CCB377A@in.WebX.maYIadrTaRb...

Sorry SIR I did not read your previous... it won't happen again... I
promised!... cross my heart! 😉
Message 17 of 24
Anonymous
in reply to: Anonymous

Glad to help.
Look at the object model for more "good" info and you might
find this revealing:

(vlax-map-collection
(vla-get-viewports
(vla-get-activedocument
(vlax-get-acad-object)))
'vlax-dump-object)


"michael puckett" wrote in message
news:F22147A850D98AF788249F129CCDAD00@in.WebX.maYIadrTaRb...
> Hi Doug,
>
> What I'm trying to do is get the modelspace vport count.
>
> But - your info helped. Lots. Said drawing has 12 named viewports in
> modelspace ( including the *Active* Viewport, which sports 4 ).
>
> Between all of the named viewports there are precisely 27 possible vports.
>
> THANKS 🙂
>
> ( and thanks to Luis and Rudy who prompted me to think of other things too ).
>
> "Doug Broad" wrote in message
> news:6D8B885AF0F1479953CD51271E37E35A@in.WebX.maYIadrTaRb...
> Michael,
> Do you want the number of paperspace viewports? If so then
> you don't want vla-get-viewports. Viewports are objects that
> contain the view settings of vports in model space. Each saved
> viewport configuration has a number of viewports associated with
> it. The active viewport configuration also (I think) has a copy
> of the viewports that have been saved. There is also a relationship
> between layouts and model space viewports but I don't know
> the specifics.
> Does that help?
>
>
Message 18 of 24
Anonymous
in reply to: Anonymous

While this may not be pretty it works ...

(setq Count 0)
(vlax-for vport (vla-get-viewports OBJDBX)
(if (eq "*ACTIVE" (strcase (vla-get-name vport)))
(setq Count (1+ Count))
)
)

I use 'vlax-dump-object quite extensively, it is most useful. Between it, the
object model map and my little atoms.vlx app there are not too many secrets 🙂

Thanks again Doug.

"Doug Broad" wrote in message
news:75EEC832208B2181A24DDAAFCA76D008@in.WebX.maYIadrTaRb...
Glad to help.
Look at the object model for more "good" info and you might
find this revealing:

(vlax-map-collection
(vla-get-viewports
(vla-get-activedocument
(vlax-get-acad-object)))
'vlax-dump-object)
Message 19 of 24
Anonymous
in reply to: Anonymous

That seems the best technique. The current configuration is a
viewport and if split into other viewports, each viewport has
the same name, "*ACTIVE"....

You're welcome.

"michael puckett" wrote in message
news:D25B21CFB7D0F7C72D6286DEC4918FCC@in.WebX.maYIadrTaRb...
> While this may not be pretty it works ...
>
> (setq Count 0)
> (vlax-for vport (vla-get-viewports OBJDBX)
> (if (eq "*ACTIVE" (strcase (vla-get-name vport)))
> (setq Count (1+ Count))
> )
> )
>
> I use 'vlax-dump-object quite extensively, it is most useful. Between it, the
> object model map and my little atoms.vlx app there are not too many secrets 🙂
>
> Thanks again Doug.
>
> "Doug Broad" wrote in message
> news:75EEC832208B2181A24DDAAFCA76D008@in.WebX.maYIadrTaRb...
> Glad to help.
> Look at the object model for more "good" info and you might
> find this revealing:
>
> (vlax-map-collection
> (vla-get-viewports
> (vla-get-activedocument
> (vlax-get-acad-object)))
> 'vlax-dump-object)
>
>
Message 20 of 24
Anonymous
in reply to: Anonymous

saved for undo?

"michael puckett" wrote in message
news:25E6085CD43DA2ACF8C5E0BB9EE01DFA@in.WebX.maYIadrTaRb...
> As much as I might enjoy jumping on the "bash Autodesk" wagon, it appears
that
> the dwg does have 27 vport objects:

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost