


























Mdl应用程序在Microstatin升级到V8过后,很多程序也需要相应的调整才能够运行。
其中代码需要变动最大的就是ModelRef和Tcb变量相关的方面,下面将陆续收集在Mdl程序升级过程中碰到的各种问题的一些解决方法。
关于TCB变量的变更:
Active Level
Active Font...
其他一些设置当前参数的tcb变量如tcb->actfont等, 可以使用mdlParams_getActive和mdlParams_setActive去访问和修改。
tcb->subpermast 和tcb->uorpersub
可以如下方法获取:
double GetUnit()
{
double unit;
DgnModelRefP pModelRef;
pModelRef
= mdlModelRef_getActive();StatusInt GetGlobalOrigin(DPoint3d *globalOrigin)
{
DgnModelRefP pModelRef;
int status;
pModelRef
= mdlModelRef_getActive();MSElementUnion
关于MSElementUnion结构体也有一些变化,主要包括:
MSElementUnion el;
el.hdr.dhdr.symb.b.weight 改为 el.hdr.dhdr.symb.weight;
el.hdr.dhdr.symb.b.style 改为 el.hdr.dhdr.symb.style;
el.hdr.dhdr.symb.b.color 改为 el.hdr.dhdr.symb.color;
mdlView_fit
该函数接口有所变化,可以使用类似如下代码:
int FitCurrent(int view)
{
int status = TRUE;
DgnModelRefP modelRef;
DgnModelRefListP modelRefListP;
mdlModelRefList_create(&modelRefListP);
modelRef = mdlModelRef_getActive();
mdlModelRefList_add(modelRefListP, modelRef);
if (mdlView_fit(view, modelRefListP) != SUCCESS) {
status = FALSE;
}
mdlModelRefList_free(&modelRefListP);
return status;
}
Set levels mark to view
在J或更低版本中,经常需要在参考文件时设置levels mark,函数原形如下:
void mdlRefFile_attachCoincident
(
char *filename, /* => name of file to attach */
char *logical, /* => logical name */
char *description, /* => description (optional) */
short levels[8][4], /* => level bit maps */
boolean snapLock, /* => initial state of snap lock */
boolean locateLock /* => initial state of locate lock */
);
//------------------------------------------------------------------------------------
// Convert level codes to level ids.
// Input levelCodes and output levelIds is a set of " " or "," delimited in a string.
// The string may contain ranges too. e.g. string: 1,10-15,3,20,25-28,31-35
//------------------------------------------------------------------------------------
void cnvLevelCodesToIds(char *levelCodes, char *levelIds, DgnModelRefP pModelRef)
{
char *token;
char *rangeDelimiter;
char tempStr[512];
int pos;
ULong i, levelCodeStart, levelCodeEnd;
ULong levelId = 0;
char seps[] = " ,";if (levelCodes == NULL || levelIds == NULL)
return;
strcpy(tempStr, levelCodes);
levelIds[
token
= strtok(tempStr, seps);mdlCnv_convertMultibyteToUnicode(logical,
-1, wcLogName, 128);mdlCnv_convertMultibyteToUnicode(description,
-1, wcDescription, 128);status
= mdlRefFile_attachCoincident(&outModelRefP, refFile, wcLogName, wcDescription,mdlBitMask_createFromBitArray(
&levelMask, 64, levels[0], 1);cnvLevelCodesToIds(levelCodes, levelIds, outModelRefP);
mdlBitMask_create(
&levelMask, 0);此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。