SetcurrentVPORT及封装ARX函数.docx
- 文档编号:28125757
- 上传时间:2023-07-08
- 格式:DOCX
- 页数:19
- 大小:20.22KB
SetcurrentVPORT及封装ARX函数.docx
《SetcurrentVPORT及封装ARX函数.docx》由会员分享,可在线阅读,更多相关《SetcurrentVPORT及封装ARX函数.docx(19页珍藏版)》请在冰豆网上搜索。
SetcurrentVPORT及封装ARX函数
extern"C"Acad:
:
ErrorStatus
acedSetCurrentVPort(
AcDbViewport*pVp);
pVp
Inputpointertoviewporttomakecurrent
ThisfunctionsetsthecurrentviewportfromtheAcDbViewportobjectpointedtobypVp.
SysVarWillChangeandSysVarChangednotificationaregeneratedbythisfunction.
Youmustbeinmodelspaceforthisfunctiontoworkproperly.Thiscanbedoneusingthefollowingsteps:
1.TurnTILEMODEoffandswitchtopaperspaceifnecessary.
2.CreateaviewportusingacedCommand/MVIEW.
3.UseacedCommand/zoom-extentstoensurethattheviewwasonthescreen.
4.MakesurethattheviewportwasturnedonusingacedCommandMVIEW/ONlast.
5.SwitchtomodelspaceusingacedCommand/MSPACE.
6.SetCVPORTtothenumberofyourviewporttoensurethatyourviewportisactive.
Alternatively,toavoidtheuseofacedCommand,youcanusethefollowingsteps:
1.Instantiateaviewportobject
2.TurnTILEMODEoffandswitchtopaperspaceifnecessary.
3.UseacedSetCurrentViewtozoomouttomakesurethattheviewportisviewable.
4.Opentheviewportforwrite,andensurethatitisactivated.
5.SwitchtomodelspaceusingacedSetCurrentView.
6.Closetheviewport.
ReturnsAcad:
:
eOkifsuccessful.
ReturnsAcad:
:
eOutOfRangeifthespecifiedviewportisn'tvalidforthecurrentenvironment.
ReturnsAcad:
:
eNullObjectPointerifpVPisNULL.
Acad:
:
ErrorStatus
acedSetCurrentVPort(
intvpnumber);
vpnumber
Inputindexnumberofviewporttomakecurrent
Thisfunctionsetsthecurrentviewportfromtheviewportindexvpnumber.ViewportindexnumbersarethenumbersreportedbytheCVPORTsystemvariable.
SysVarWillChangeandSysVarChangednotificationaregeneratedbythisfunction.
ReturnsAcad:
:
eOkifsuccessful.
ReturnsAcad:
:
eOutOfRangeifvpnumberisn'tvalidforthecurrentenvironment.
IncludeFile
aced.h
Acad:
:
ErrorStatus
acedSetCurrentView(
AcDbViewTableRecord*pVwRec,
AcDbViewport*pVP);
pVwRec
InputpointertoViewTableRecordtoreaddatafrom
pVP
InputpointertoViewporttosetviewwithin
ThisfunctionusestheinformationfromtheAcDbViewTableRecordpointedtobypVwRectosettheviewintheAcDbViewportpointedtobypVP(ifpVP!
=NULL)orinthecurrentviewport(ifpVP==NULL).
NoteTheViewTableRecordpointedtobypVwRecshouldbeopenedforread,notforwrite.
IfpVwRecpointstoaViewTableRecorddefininganon-paperspaceview,paperspaceisactive,andpVPisnotNULL,thenthecurrentviewportischangedtopVP.
IfthepVwRecViewTableRecordpointstoapaperspaceview,andpaperspaceisnotcurrentlyactive,thenanattemptismadetoswitchtopaperspace.
Trans-spaceviewchangesarenotallowed.
ThisfunctioncannotbeusedwhileanacedCommandisactive.
ReturnsAcad:
:
eOkonsuccess.
ReturnsAcad:
:
eCommandWasInProgressifatrans-spaceviewchangeisattemptedoranacedCommandisinprogressandfastzoomisoff.
ReturnsAcad:
:
eNullObjectPointerifpVwRecisNULL.ReturnsthesameifpVPisNULL,pVwRecpointstoaViewTableRecordthatdefinesanon-paperspaceview,andpaperspaceisactive.
ReturnsAcad:
:
eBadPaperspaceViewifthepVwRecpointstoapaperspaceview,andpaperspaceisnotactive.
ReturnsAcad:
:
eNotInPaperspaceifanattemptismadetoswitchtopaperspace,buttilemodeis1.
IncludeFile
aced.h
Re:
Paperspaceactivate
Acad:
:
ErrorStatusacedPspace(AcDbDatabase*db);
Andy
DiscussionGroupsIndex>AutoCADGroups>AutodeskObjectARX>CurrentView
Youcurrentlyhavebrowsecapabilitiesonly.Pleaseloginforadditionalcapabilities.
CurrentView(7replies)
Postedby:
alex
Date:
Jul/04/04-03:
41(GMT)
Hellogroup,
IsthereaGetmethodparalleltoacedSetCurrentView()?
Ican'tseemtofindoneinthedocs.
Thanks,
alex
--------------------------------------------------------------------------------
ReplyFrom:
Justavian
Date:
Jul/09/04-00:
05(GMT)
Re:
CurrentView
I'mprettysurethatyouhavetomanuallyassemblethecurrentsystemvalues
inordertogetanAcDbViewTableRecordofthecurrentview.Whatareyou
hopingtoretrieve?
Herearesomeusefulsystemvariables:
VIEWMODE
VIEWCTR
VIEWDIR
VIEWSIZE
VIEWTWIST
BACKZ
FRONTZ
LENSLENGTH
TARGET
Usingthevaluesstoredinthosevariables,youcancreatean
AcDbViewTableRecordofthecurrentview.Ifyou'reamemberoftheADN,i
believethere'sanarticleonthis.Ifyou'renot,justlookatthe
documentationfortheAcDbViewTableRecord-there'safunctionforsetting
mostofthosevalues.Sojustretrievethesystemvariableandcallthe
associatedfunctiontosetitintheviewrecord.
Letmeknowifyouneedsomemoretips...
-Rich
"alex"wroteinmessagenews:
40e77991_1@newsprd01...
>Hellogroup,
>
>IsthereaGetmethodparalleltoacedSetCurrentView()?
>Ican'tseemtofindoneinthedocs.
>
>Thanks,
>
>alex
>
>
--------------------------------------------------------------------------------
ReplyFrom:
alex
Date:
Jul/09/04-02:
30(GMT)
Re:
CurrentView
HiRich,
Mylogictellsmethattheysurelymusthaveabettermeansofdoingit.
(maybeundocumented?
)
IamtryingtosavethecurentviewinanAcDbViewTableRecordsoastobe
abletoreturntoit
later(infactaZoomPrevious-w/oanySendStringToExecute()stuff).
Justhowdoesacadrememberthepreviouszooms?
etc.
BTW,IamtryingtogetatthecurrentviewthrutheViewportTableand
lookingforthe*Active
viewport.Itseemsthattherearemorethanonemarkedasactive.Not
finishedyet.
Anyideas?
--------------------------------------------------------------------------------
ReplyFrom:
ArtCooney
Date:
Jul/09/04-03:
10(GMT)
Re:
CurrentView
Thezoompreviousinformationisnotstoredinthedrawingdatabase-it's
keptinAutoCAD'smemoryinacompletelydifferentdatastructurefrom
AcDbViewportTableRecordandisnotaccessible.
The*activerecordsintheViewportTableareonlyusedwhentilemode==1
andeventhenonlywhenthedrawingisfirstloadedintoAutoCADorwhenyou
switchfromtilemode==0totilemode==1.The*activerecordsarenot
keptuptodatewiththeactualviewsdisplayedonscreen-theyareonly
updatedatsavetimeandwhenyouswitchfromtilemode==1totilemode==
0.
Thereisone*activerecordforeachtiledviewportpresentwhenthe*active
recordsarecreated/updated.
TheacedVports2VportTableRecords()functionwillforceanupdateofthe
*activerecords,butthisonlyworkswhentilemode==1.
TheacedVportTableRecords2Vports()willforcethedisplaytobeupdatedto
matchthecurrent*activerecords-againonlywhentilemode==1.
Ijustnoticedthatthedocsforthesetwofunctionshaveanerror-they
shouldsaythateNotApplicableisreturnedwhentilemodeis0.
"alex"wroteinmessagenews:
40ee02ec_1@newsprd01...
>HiRich,
>
>Mylogictellsmethattheysurelymusthaveabettermeansofdoingit.
>(maybeundocumented?
)
>IamtryingtosavethecurentviewinanAcDbViewTableRecordsoastobe
>abletoreturntoit
>later(infactaZoomPrevious-w/oanySendStringToExecute()stuff).
>Justhowdoesacadrememberthepreviouszooms?
>etc.
>
>BTW,IamtryingtogetatthecurrentviewthrutheViewportTableand
>lookingforthe*Active
>viewport.Itseemsthattherearemorethanonemarkedasactive.Not
>finishedyet.
>Anyideas?
>
>
>
--------------------------------------------------------------------------------
ReplyFrom:
alex
Date:
Jul/09/04-04:
15(GMT)
Re:
CurrentView
HiArt,
IfIunderstandyoucorrectly,thereisnowaytogetthecurrentviewinfootherthangoingthru'the
[getSystemvar+AcDbViewTableRecord.setXX()]process.Andthereare17ofthem.
Pity.
Thanks,
alex
n.b.
Tobesure,Idon'tneedthezoomprevinfo,justthecurrentviewparameters.
[Attachment:
att1.html]
--------------------------------------------------------------------------------
ReplyFrom:
ArtCooney
Date:
Jul/09/04-07:
27(GMT)
Re:
CurrentView
Iftilemode==0,thenyoucanuseacedGetCurViewportObjectId()togettheobjectIdofthecurrentAcDbViewport,openthatandreadtheviewinformationfromit.
Iftilemode==1,thenyoucanuseacedVports2VportTableRecords()toforcethe*activerecordstobeupdatedtomatchthecurrentviewsonscreen.Afterthat,thefirst*activerecordwillbeforthecurrentlyactiveview.
Don'tuseacedVports2VportTableRecords()anymorethanabsolutelynecessarybecauseiterasestheexisting*activerecordsandcreatesnewonesforthecurrentviews,soeverytimeyouusethisfunctionyouwillincreasememoryusagebecauseerasedobjectsstayinmemoryuntilthedrawingisclosed.
"alex"wroteinmessagenews:
40ee1a36_1@newsprd01...
HiArt,
IfIunderstandyoucorrectly,thereisnowaytogetthecurrentviewinfootherthangoingthru'the
[getSystemvar+AcDbViewTableRecord.setXX()]process.Andthereare17ofthem.
Pity.
Thanks,
alex
n.b.
Tobesure,Idon'tneedthezoomprevinfo,justthecurrentviewparameters.
[Attachment:
att1.html]
--------------------------------------------------------------------------------
ReplyFrom:
alex
Date:
Jul/12/04-03:
55(GMT)
Re:
CurrentView
HiArt,
Thanksforthehelp.
Onemorequestion(actuallytwo):
howcanIcheck-intilemode==1-ifthereisonlyonevieworthe
screenissplitintoviews.
Also,I'mnotclearaboutthesetupinacad2000/samples/Campus.dwg:
howdoIknow-programatically-whatisthecurrentview(tilemode==0),perspectivemodeandspace(paperormodel).
alex
"ArtCooney"wroteinmessagenews:
40ee48d6$1_3@newsprd01...
Iftilemode==0,thenyoucanuseacedGetCurViewportObjectId
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SetcurrentVPORT 封装 ARX 函数