SetcurrentVPORT及封装ARX函数 联系客服

发布时间 : 星期五 文章SetcurrentVPORT及封装ARX函数更新完毕开始阅读285b8afa700abb68a982fb65

extern \acedSetCurrentVPort( AcDbViewport* pVp);

pVp Input pointer to viewport to make current

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. 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.

Acad::ErrorStatus acedSetCurrentVPort( int vpnumber);

vpnumber Input index number of viewport to make current

This function sets the current viewport from the viewport index vpnumber. Viewport index numbers are the numbers reported by the CVPORT system variable.

SysVarWillChange and SysVarChanged notification are generated by this function.

Returns Acad::eOk if successful.

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

Include File

aced.h

Acad::ErrorStatus acedSetCurrentView(

AcDbViewTableRecord * pVwRec, AcDbViewport * pVP);

pVwRec Input pointer to ViewTableRecord to read data from pVP

Input pointer to Viewport to set view within

This function uses the information from the AcDbViewTableRecord pointed to by pVwRec to set the view in the AcDbViewport pointed to by pVP (if pVP != NULL) or in the current viewport (if pVP == NULL).

Note The ViewTableRecord pointed to by pVwRec should be opened for read, not for write.

If pVwRec points to a ViewTableRecord defining a non-paper space view, paper space is active, and pVP is not NULL, then the current viewport is changed to pVP.

If the pVwRec ViewTableRecord points to a paper space view, and paper space is not currently active, then an attempt is made to switch to paper space. Trans-space view changes are not allowed.

This function cannot be used while an acedCommand is active. Returns Acad::eOk on success.

Returns Acad::eCommandWasInProgress if a trans-space view change is attempted or an acedCommand is in progress and fastzoom is off. Returns Acad::eNullObjectPointer if pVwRec is NULL. Returns the same if pVP is NULL, pVwRec points to a ViewTableRecord that defines a non-paper space view, and paper space is active.

Returns Acad::eBadPaperspaceView if the pVwRec points to a paper space view, and paper space is not active.

Returns Acad::eNotInPaperspace if an attempt is made to switch to paper space, but tilemode is 1.

Include File

aced.h

Re: Paperspace activate

Acad::ErrorStatus acedPspace(AcDbDatabase* db); Andy

Discussion Groups Index > AutoCAD Groups > Autodesk ObjectARX > CurrentView You currently have browse capabilities only. Please log in for additional capabilities.

CurrentView (7 replies) Posted by: alex

Date: Jul/04/04 - 03:41 (GMT)

Hello group,

Is there a Get method parallel to acedSetCurrentView() ? I can't seem to find one in the docs. Thanks, alex

--------------------------------------------------------------------------------

Reply From: Justavian Date: Jul/09/04 - 00:05 (GMT)

Re: CurrentView

I'm pretty sure that you have to manually assemble the current system values in order to get an AcDbViewTableRecord of the current view. What are you hoping to retrieve? Here are some useful system variables:

VIEWMODE VIEWCTR VIEWDIR VIEWSIZE VIEWTWIST BACKZ FRONTZ

LENSLENGTH TARGET

Using the values stored in those variables, you can create an

AcDbViewTableRecord of the current view. If you're a member of the ADN, i believe there's an article on this. If you're not, just look at the documentation for the AcDbViewTableRecord - there's a function for setting most of those values. So just retrieve the system variable and call the associated function to set it in the view record.

Let me know if you need some more tips...