Author Topic: viewport handle..  (Read 2921 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
viewport handle..
« on: April 04, 2006, 03:45:22 PM »
Hi all..

Im trying to make a routine to get the Handle name of current Viewport..
but How can i do that ?

                VIEWPORT  Layer: "0"
                            Space: Paper space
                           Layout: Layout1
                           Handle = f8
                            Status: On and Active
                            Scale relative to Paper space:    0.4855xp
            center point, X= 128.5000  Y=  97.5000  Z=   0.0000
             width  205.6000
            height  156.0000
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: viewport handle..
« Reply #1 on: April 04, 2006, 04:03:16 PM »
ok..i got it...

thanks anyway..

Code: [Select]
(setq ent (cdr (assoc 5 (entget (acet-currentviewport-ename)))))
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: viewport handle..
« Reply #2 on: April 04, 2006, 05:24:50 PM »
Whada bout....


Code: [Select]
(vla-get-Handle (vlax-ename->vla-object (car (entsel "\n Select Viewport..."))))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Re: viewport handle..
« Reply #3 on: April 05, 2006, 05:30:52 PM »
Whada bout....


Code: [Select]
(vla-get-Handle (vlax-ename->vla-object (car (entsel "\n Select Viewport..."))))


thanks ronjonp..
but with your routine..
I need to select the viewport....
is not what i need...

but i'll take it in my library... :roll:

Keep smile...

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: viewport handle..
« Reply #4 on: April 05, 2006, 08:41:14 PM »
Andrea,
If you would like your own routine so as to not rely on ExpressTools being installed.....
Code: [Select]
(defun getActVP ()
  (if (= (getvar "TILEMODE") 1)
    (vla-get-activeviewport
      (vla-get-activedocument
(vlax-get-acad-object)))
    (vla-get-activepviewport
      (vla-get-activedocument
(vlax-get-acad-object)))
    )
  )

(defun vpHand ()
  (vla-get-handle (getActVP))
  )

Andrea

  • Water Moccasin
  • Posts: 2372
Re: viewport handle..
« Reply #5 on: April 05, 2006, 09:49:19 PM »
thanks Jeff..

I'll take it..

but modified...

Code: [Select]
(defun getActVP ()
  (if (and (> (getvar "CVPORT") 1)
   (eq (getvar "TILEMODE") 0)
      )
    (vla-get-handle (vla-get-activepviewport
      (vla-get-activedocument
(vlax-get-acad-object)))
    )
))
Keep smile...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: viewport handle..
« Reply #6 on: April 05, 2006, 10:10:32 PM »
Andrea, choose to ignore this if you like ..

but shouldn't that revised function be named :-

(defun getActiveVPHandle () .....

'cause it's not actually returning the VP object ....
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: viewport handle..
« Reply #7 on: April 06, 2006, 02:35:13 PM »
your right Kerry...

thanks.
Keep smile...