Share

acedSetCurrentVPort

C++

ACCORE_PORT Acad::ErrorStatus acedSetCurrentVPort(
    const AcDbViewport* pVp
);

File

aced.h

Description

This function sets the current viewport from the AcDbViewport object pointed to by pVp.

SysVarWillChange and SysVarChanged notification are generated by this function.

You must be in model space for this function to work properly.

This can be done using the following steps:

  1. Turn TILEMODE off and switch to paper space if necessary.
  2. Create a viewport using acedCommand/MVIEW.
  3. Use acedCommand/zoom-extents to ensure that the view was on the screen.
  4. Make sure that the viewport was turned on using acedCommand MVIEW/ON last.
  5. Switch to model space using acedCommand /MSPACE.
  6. Set CVPORT to the number of your viewport to ensure that your viewport is active.
Alternatively, to avoid the use of acedCommand, you can use the following steps:
  1. Instantiate a viewport object
  2. Turn TILEMODE off and switch to paper space if necessary.
  3. Use acedSetCurrentView to zoom out to make sure that the viewport is viewable.
  4. Open the viewport for write, and ensure that it is activated.
  5. Switch to model space using acedSetCurrentView.
  6. Close the viewport.

Parameters

Parameters Description
pVp Input pointer to viewport to make current

Returns

Returns Acad::eOk if successful.

Returns Acad::eOutOfRange if the specified viewport isn't valid for the current environment.

Returns Acad::eNullObjectPointer if pVP is NULL.

Previous Declaration

AutoCAD 2025 and Earlier

Acad::ErrorStatus acedSetCurrentVPort(const AcDbViewport* pVp);

Was this information helpful?