Author Topic: Visible in a viewport window  (Read 2783 times)

0 Members and 1 Guest are viewing this topic.

A_LOTA_NOTA

  • Guest
Visible in a viewport window
« on: May 26, 2011, 09:04:56 AM »
Is it possible to get the IDs of all entities visible in a viewport window? What I would like to do is freeze any layer that is turned off in a viewport or not shown in the viewport window.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Visible in a viewport window
« Reply #1 on: May 26, 2011, 09:16:00 AM »
You would have to perhaps translate the Viewport frame coordinates relative to Model Space (accounting for scale/twist etc), then create a SelectionSet using a Window Polygon with these translated points.

I think gile has created a few functions to translate from VP coords to Modelspace.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Visible in a viewport window
« Reply #2 on: May 26, 2011, 09:22:09 AM »
You would have to perhaps translate the Viewport frame coordinates relative to Model Space (accounting for scale/twist etc), then create a SelectionSet using a Window Polygon with these translated points.

I think gile has created a few functions to translate from VP coords to Modelspace.
Don't forget to take into account nested objects.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Visible in a viewport window
« Reply #3 on: May 26, 2011, 09:24:38 AM »
You would have to perhaps translate the Viewport frame coordinates relative to Model Space (accounting for scale/twist etc), then create a SelectionSet using a Window Polygon with these translated points.

I think gile has created a few functions to translate from VP coords to Modelspace.
Don't forget to take into account nested objects.

Ah yes, that could complicate things a little - perhaps it would be best to use a Crossing Polygon.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Visible in a viewport window
« Reply #4 on: May 26, 2011, 09:37:34 AM »
You would have to perhaps translate the Viewport frame coordinates relative to Model Space (accounting for scale/twist etc), then create a SelectionSet using a Window Polygon with these translated points.

I think gile has created a few functions to translate from VP coords to Modelspace.
Don't forget to take into account nested objects.

Ah yes, that could complicate things a little - perhaps it would be best to use a Crossing Polygon.
You'll just have to step though any selected block definitions, just to be sure.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Visible in a viewport window
« Reply #5 on: May 29, 2011, 05:14:00 PM »
Rather dated by may be useful:
http://www.theswamp.org/index.php?topic=9461.msg129670#msg129670

Also found this:
;;; vpsel.lsp
;;;
;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com / http://jtbworld.vze.com
;;; E-mail: info@jtbworld.com / jtbworld@hotmail.com
;;;
;;; 2000-04-14 - First release
;;; Tested on AutoCAD 2000
;;;
;;;---------------------------------------------------------------------------;
;;;  DESCRIPTION
;;;
;;;  Select all visible objects in selected or active paperspace viewport
;;;  Works transparently when in modelspace and for polygonal viewports too
;;;  Example1: ERASE ALL R 'VPC >>> Erase all in model except what is visible
;;;  Example2: (command "erase" "all" "r" (c:vpc) "")
;;;  Example3: VPC ERASE >>> VPC is run previous the command and the objects
;;;                            are also in previous selection set
;;;
;;;  c:vpc - select all visible objects with crossing in viewport
;;;  c:vpw - select all visible objects with window in viewport
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.