Zoom2Layer

Short description

  • Displays a filterable layer selection dialog and then zooms the view to the extents of all objects on the chosen layer.
  • Supports picking a layer directly from a selected object in the drawing and remembers the last filter used.
zoom2layer 000

Command:

  • Command: Zoom2Layer

Description:

  • Builds a list of layers that are visible and unfrozen, then shows a temporary DCL popup where the user can filter and select a layer.
  • The filter field supports wildcards * and ? and is restored from the environment variable CHLAY-LAST-FILTER (defaults to *).
  • After a layer is selected, the command gathers all entities on that layer and computes a combined bounding rectangle, then performs a window zoom to that area.

Helper function: (if any)​

  • LayerList-popup creates and manages the layer selection dialog and returns the chosen layer name when confirmed.
  • Drawing-Visible-Layers-lst iterates layer records via tblnext and keeps only layers that are not off and not frozen by checking flag bits in group code 70.
  • Update-List filters the full layer list using wcmatch against the current filter pattern and repopulates the list box.
  • Highlight-Layer attempts to locate a layer inside the filtered list and sets the list box selection to it.
  • Show-Dialog loads the temporary DCL file, wires dialog actions, returns the dialog exit code, and supports a special return value for the pick-from-drawing workflow.
  • c:Zoom2Layer selects all entities on the chosen layer, aggregates bounding boxes via ActiveX GetBoundingBox, and executes ZoomWindow.

Functionalities:

  • Layer filtering with wildcard patterns entered in the dialog filter box.
  • Layer list scope includes only layers that are not off and not frozen (visible/unfrozen set).
  • Pick Layer from Drawing button temporarily exits the dialog so the user can select an object and adopt that object’s layer as the new filter, then reopens the dialog.
  • Persisted filter stored in CHLAY-LAST-FILTER and restored on next run.
  • Zoom-to-layer extents by collecting all objects on the selected layer and computing min/max XY bounds from each entity’s bounding box.
  • Robustness uses guarded ActiveX calls and skips entities that do not support GetBoundingBox.

Result:

  • If the user confirms a layer selection, the view zooms to the combined extents of entities on that layer.
  • If no objects exist on the selected layer, prints No objects found on layer for that layer.
  • If objects exist but none provide a valid bounding box, prints No valid geometry to zoom to for that layer.
  • If the user cancels or no layer is selected, prints No layer selected or cancelled and performs no zoom.

Images, animations etc.

zoom2layer 000
Pixel

Additional info:

Share this page:

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tags: Layers
Tags: Layers
0
Would love your thoughts, please comment.x
()
x