当前位置:首页 > SetcurrentVPORT及封装ARX函数
alex
\
If tilemode == 0, then you can use acedGetCurViewportObjectId() to get the objectId of the current AcDbViewport, open that and read the view information from it.
If tilemode == 1, then you can use acedVports2VportTableRecords() to force the *active records to be updated to match the current views on screen. After that, the first *active record will be for the currently active view.
Don't use acedVports2VportTableRecords() any more than absolutely necessary because it erases the existing *active records and creates new ones for the current views, so every time you use this function you will increase memory usage because erased objects stay in memory until the drawing is closed.
\Hi Art,
If I understand you correctly, there is no way to get the current view info other than going thru' the
[get System var + AcDbViewTableRecord.setXX()] process. And there are 17 of them. Pity. Thanks, alex n.b.
To be sure, I don't need the zoom prev info, just the current view parameters.
[Attachment: att1.html]
--------------------------------------------------------------------------------
Reply From: Art Cooney Date: Jul/12/04 - 04:48 (GMT)
Re: CurrentView
For tilemode == 1 you can use acedSetCurrentVPort() (in aced.h) to try and set the current viewport index to a value greater than 2. If that succeeds, then there are multiple views.
For tilemode == 0 you can use acedGetCurViewportObjectId() (in aced.h) to get the objectId of the currently active viewport. Then open that viewport and use AcDbViewport methods on it to get the information you want.
\Hi Art,
Thanks for the help.
One more question (actually two): how can I check - in tilemode == 1 - if there is only one view or the
screen is split into views.
Also, I'm not clear about the setup in acad2000/samples/Campus.dwg: how do I know - programatically - what is the current view (tilemode == 0), perspective mode and space (paper or model). alex
\
If tilemode == 0, then you can use acedGetCurViewportObjectId() to get the objectId of the current AcDbViewport, open that and read the view information from it.
If tilemode == 1, then you can use acedVports2VportTableRecords() to force the *active records to be updated to match the current views on screen. After that, the first *active record will be for the currently active view.
Don't use acedVports2VportTableRecords() any more than absolutely necessary because it erases the existing *active records and creates new ones for the current views, so every time you use this function you will increase memory usage because erased objects stay in memory until the drawing is closed.
\Hi Art,
If I understand you correctly, there is no way to get the current view info other than going thru' the
[get System var + AcDbViewTableRecord.setXX()] process. And there are 17 of them. Pity. Thanks, alex n.b.
To be sure, I don't need the zoom prev info, just the current view parameters.
[Attachment: att1.html]
? Copyright 2006 Autodesk, Inc. All rights reserved. Legal Notices & Trademarks - Privacy Policy
封装ARX函数
2010年03月24日 星期三 下午 04:11 选择指定图层上的所有实体
Acad::ErrorStatus selectEntityInLayer(const char* nLayerName,AcDbObjectIdArray& nIDs) {
Acad::ErrorStatus es = Acad::eOk; ads_name ents;
struct resbuf *rb;
rb=acutNewRb(AcDb::kDxfLayerName); rb->restype=8;
rb->resval.rstring=(char*)nLayerName; rb->rbnext=NULL;
acedSSGet(\long entNums=0;
acedSSLength(ents,&entNums); if (entNums == 0)
es = Acad::eInvalidInput; else {
for (long a = 0; a < entNums ; a ++) {
AcDbObjectId objId; ads_name ent;
acedSSName(ents,a,ent);
acdbGetObjectId(objId, ent); nIDs.append(objId); } }
acedSSFree(ents); acutRelRb(rb); return es; }
设置当前层
Acad::ErrorStatus SetCurLayer(const char* lpLayerName, AcDbDatabase* pDb/* = NULL */) {
AcDbDatabase* pCurDb = pDb; if (pCurDb == NULL)
pCurDb = acdbHostApplicationServices()->workingDatabase(); AcDbLayerTableRecordPointer spRecord(lpLayerName, pCurDb, AcDb::kForRead);
Acad::ErrorStatus es = spRecord.openStatus(); if (es == Acad::eOk) {
es = pCurDb->setClayer(spRecord->objectId()); }
return es; }
生成新组
//生成新组(sGroupName)
//追加数组中所有实体到该组中 //组名字 , Id数组
int createGroup(CString sGroupName, const AcDbObjectIdArray *idArr) {
AcDbGroup *pGroup = new AcDbGroup((LPSTR)(LPCTSTR)sGroupName); AcDbObjectId groupObjectId;
AcDbDictionary *pGroupDict = NULL;
acdbHostApplicationServices()->workingDatabase() ->getGroupDictionary(pGroupDict, AcDb::kForWrite); pGroupDict->setAt(sGroupName, pGroup, groupObjectId); pGroupDict->close(); pGroup->close();
acdbOpenObject(pGroup, groupObjectId, AcDb::kForWrite); for (int i = 0; i < idArr->length(); i++) {
groupObjectId = idArr->at(i); pGroup->append(groupObjectId); }
pGroup->close(); return TRUE; }
建立文本格式表函数
AcDbObjectId CreateNewTextStyle() {
AcDbTextStyleTable *pTextStyleTable;
AcDbTextStyleTableRecord *pTextStyleTableRcd AcDbObjectId textId;
共分享92篇相关文档