VDF常见问题整理(六十六):通过Web服务将VDS另存为WebControl上的DWG

本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习。本文将会介绍如何通过Web服务将VDS另存为WebControl上的DWG。

VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。

VectorDraw Developer Framework


问:如何通过VectorDraw WebControl将VDS文件保存到DWG / DGN/span>

答:VectorDraw WebControl只能显示.vds文件,这是我们的web组件的文件格式,所以当你在页面上有一个.vds文件,并且你想把文件保存为DXF/DWG时,你必须创建一个服务,把vds文件上传到服务器上,把它转换为首选的支持的文件格式,然后通过网页下载。

下面是一些关于转换操作的说明。

为了做到这一点,需要编写一个web服务,用vdDocumentComponent引用VDF库,并且有两种方法让你的软件用户能够打开/保存DWG/DGN文件。

  • 如果您的应用程序的用户想要打开/保存DWG/DGN文件,那么他们需要在他们的机器上安装FileConverter(Lite或Full)终端用户应用程序。
  • 另一种方法是成为OpenDesign的会员,如果您还没有成为会员的话,可以使用他们的库,并将其与您的应用程序一起发布(在您应用程序的设置中)。

在这种情况下,必须在 “客户的机器 “中安装OpenDesign库中包含的一些dlls。

        //Javascript code in the client machine        vdcanvas.vdAfterSaveDocument =function(saveData)        {            //get the original filename            var path = saveData.dataObject.pathname;            if (!path) path = 'vdDocument.vds';            //Call the webservice here --> convert(saveData.dataStream,saveData.dataObject.pathname+".dwg");        }        vdcanvas.SaveDocument();        //Webservice in the server machine        //inputdata: inputdata is the data as come from web javascript method .Represents the contents of a vds file         [System.Web.Services.WebMethod]        public static void convert(string inputdata, string exportedfilename)        {            vdDocumentComponent vdc = new vdDocumentComponent();            vdDocument doc = vdc.Document;            bool success = doc.FromScriptData(inputdata);            if (success)            {                //save to a temporary relative folder in the server                string exportedrelativefile = "./Drawings/"+ System.IO.Path.GetFileNameWithoutExtension(exportedfilename)                success = doc.ExportToFile(exportedrelativefile);            }        }

=======================================================

如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。

标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年1月16日
下一篇 2021年1月16日

相关推荐

发表回复

登录后才能评论