⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scale_cellib.mc

📁 Bentley Microstation的二次开发工具MDL的学习源代码
💻 MC
字号:
/*================================================================================
						Step by step 之 MDL 快速入门实例十二、十九
================================================================================*/
#include <string.h>
#include <stdio.h>
#include <mdl.h>
#include <mselems.h>
#include <dlogitem.h>
#include <dlogman.fdf>
#include <rscdefs.h>
#include <cexpr.h>
#include <dlogitem.h>
#include <math.h>


void  main (int argc, char	*argv[])
{
	char filename[256];
	FILE *readcell,*writecell;
	ULong filepos,status;
	double scale;
    Transform matrix_orig,matrix_trans;
	MSElementDescr  *emd;
	RscFileHandle   rhandle;
	DialogBox       *dbp;
	char            *setp;
	long            lastaction;

	if (argc<3) 
	{
		mdlDialog_openInfoBox("您必须输入修改倍数的参数!请输入后重来。");
		goto end;
	}
	scale=atof(argv[2]);
	if(argv[3]!=NULL)   	strcpy(filename,argv[3]);
	if(strchr(filename,'.')==NULL)       mdlDialog_fileOpen(filename,0,0,NULL,"*.cel",NULL, "Select Cell Library");
	if (strchr(filename,'.')==NULL)    goto end;
	
	mdlTMatrix_getIdentity(&matrix_orig);
	mdlTMatrix_scale(&matrix_trans,&matrix_orig,scale,scale,NULL);
	
	readcell=fopen(filename,"rb");
	if (readcell==NULL)  
	{
		mdlDialog_openInfoBox("您输入的文件名称找不到。");
		goto end;
	}
	mdlDialog_fileCreate(filename,0,0,NULL,"*.cel",filename, "Transformed Cell Library");
	
	if(strchr(filename,'.')==NULL)      goto end;
	writecell=fopen(filename,"wb");
    filepos=0;

    while (status=mdlWorkDgn_read(&emd,filepos,readcell,&filepos,0))
	{   
		mdlElmdscr_transform(emd,&matrix_trans);
		mdlWorkDgn_write(emd,-1,writecell,0,0 );
		filepos=status;
		mdlElmdscr_freeAll(&emd);
	}
    
	fclose(readcell);
	fclose(writecell);
	mdlResource_closeFile(rhandle);
    mdlOutput_status("Transforming cell libarary completed");

end: mdlSystem_unloadMdlProgram("scale_cellib");
}

	

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -