猿大师CAD助手:基于跨浏览器的原生小程序系统-猿大师中间件网络高级版开发,底层调用Autodesk公司的AutoCAD软件自动化接口、DWG TrueView或Design Review的OCX控件接口实现的dwg、dxf等工程图在线查看、编辑、审阅等,可分别将AutoCAD、DWG TrueView、Design Review等软件窗口内嵌到网页指定区域运行并调用内部实现的各种接口功能。最低可用在Chrome 41、Firefox 50、Edge 80(Chromium内核)、360极速/安全、IE 8、Opera、Electron、Vivaldi、Brave、QQ、搜狗等浏览器,也兼容运行于这些浏览器的最新版本。
支持Autodesk公司AutoCAD 2007及以上版本的桌面安装版、建议使用官方发布的AutoCAD 2013及以上版本的激活版,AutoCAD商标及相关软件版权归Autodesk所有。
1、猿大师中间件的安装:
1)、如果是exe的安装程序,请直接运行安装;
2)、如果是绿色版的程序包,请解压到磁盘某个目录后,双击“InstallWrl.bat”进行安装;
3)、安装完成时会启动猿大师中间件服务,在安装目录下的Data子目录有ZbaService.txt日志文件输出运行情况。
2、ACAD网页组件控制相关接口:
说明:以下功能请通过Web Socket连接猿大师主服务(ws://localhost:83?sid=12345&flag=1)后可执行,如默认侦听端口不是83(关于如何配置侦听端口,请参考SDK包中的文档“猿大师开发者手册.pdf”),请在连接地址中指定端口号进行连接。
HTTP网页在线测试:http://test.yuanmaster.com/acadfull.html
HTTPS网页在线测试:https://test.yuanmaster.com/acadframe.html
HTML网页测试页面:http://test.yuanmaster.com/CadJS/
如还需兼容IE浏览器使用,网络版测试网页中 <object ID="WrlWS" CLASSID="CLSID:C0971B90-4513-4E2D-A0B6-15B915FE748A" width="0" height="0"></object>
的CLSID需要替换为:21ADE2E6-B4DD-4F3E-8BD5-9DDAD1785F3A
前端集成可参考以上测试网页进行,需要嵌入用到的JS脚本,脚本程序是开源的。
1)、请求启动ACAD网页组件实现网页中局部加载dwg/dxf等文档进行操作:
Type为浏览器类型,传0自动判断(前提是当前浏览器已启动并显示在最前端,Flag指定当前页加载时必须是0) 可强制指定浏览器类型Type(2代表Chrome 4代表Firefox 8代表Opera 16代表Edge(Chromium内核) 20代表Electron 32代表360极速浏览器 33代表360安全浏览器 34代表360企业安全浏览器 50代表QQ浏览器 60代表搜狗浏览器)
Title:网页标题中的关键词
Url:加载小程序所在的网页实际地址,在网页中指定小程序的显示位置和大小,不建议使用了,建议改用Web参数
Flag掩码标记:1指定新标签加载(1和16都不指定时为当前页加载) 2网页组件显示窗口边框 4不自动裁剪越界窗口 8自动适配网页高度和宽度显示 64启用Web参数 128防截屏 256强制显示到副屏 512允许同一网页加载多实例
Web:打开配置(新增方式),可代替Url使用,Flag值+64使用此配置,此命令中必须指定Left、Top、Width、Height的值
Web中参数说明:
Edit代表编辑权限 1只读打开 4禁止另存 8禁止打印
Hide代表隐藏的界面元素 1隐藏菜单 2隐藏标准工具栏
PW代表打开文档需要的密码
DataPath代表文档查找和保存默认路径
IframeX和IframeY分别为iframe嵌套的横竖偏移修正坐标
BarW和BarH分别是网页右侧和底部预留区域,ScrollTop为顶部滚动预留高度
网页组件实际显示首先会基于Url或Web中指定的坐标和大小,再根据IframeX、IframeY、BarW、BarH设定的值做修正
Option:0启动AutoCAD实现在线编辑 1启动DWG TrueView在线查看和转换 2启动Design Review在线审阅 可提前通过接口Wrl_CADInfo获取当前电脑是否已经安装相关软件
Open:为需要打开的文档路径,磁盘目录斜杠用/
注意:Open、Web中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递
举例:
自动识别当前浏览器并启动AutoCAD程序在线编辑dwg、dxf等文档
{"req":"Wrl_ACADApplet","rid":6,"para":{"Type":"0","Title":"Autodesk Applet","Flag":66,"Left":20,"Top":20,"Width":480,"Height":320,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Web":[],"Option":"0","Open":"D:/Zorro/test.dwg"}}
自动识别当前浏览器并启动DWG TrueView程序在线查看或转换dwg文档
{"req":"Wrl_ACADApplet","rid":6,"para":{"Type":"0","Title":"Autodesk Applet","Flag":66,"Left":20,"Top":20,"Width":480,"Height":320,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Web":[],"Option":"1","Open":"D:/Zorro/test.dwg"}}
自动识别当前浏览器并启动Design Review程序在线审阅dwg、dxf文档(推荐方式启动)
{"req":"Wrl_ACADApplet","rid":6,"para":{"Type":"0","Title":"Autodesk Applet","Flag":66,"Left":20,"Top":20,"Width":480,"Height":320,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Web":[],"Option":"2","Open":"D:/Zorro/test.dxf"}}
自动识别当前浏览器指定位置自动适配网页区启动(推荐方式启动):
{"req":"Wrl_ACADApplet","rid":6,"para":{"Type":"0","Title":"Autodesk Applet","Flag":72,"Left":0,"Top":0,"Width":0,"Height":0,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Web":[],"Option":"0","Open":"D:/Zorro/test.dwg"}}
当前页指定位置自动适配网页加载测试
http://test.yuanmaster.com/acadframe.html
启动后会前后收到三个JSON数据包
A、{"ret":0,"rid":6,"data":{"ID":3}}
代表网页组件WS侦听服务就绪
B、{"event":"Wrl_Listen","aid":3,"rid":6,"data":{"SID":"123","PID":"ACadApplet","port":997}}
返回的侦听端口,可再建立一个Web Socket连接后,调用网页组件中的相关功能,比如放大缩小图纸。
代表网页组件创建成功,返回ID为当前网页组件运行实例ID,通过此ID,可执行Wrl_AppletControl、Wrl_AppletScroll、Wrl_AppletResize等命令。
C、{"event":"Wrl_AppletOK","aid":3,"rid":6,"data":{"SID":"123","PID":"ACadApplet","Port":997}}
关于接口Wrl_CADInfo的说明:
请求:{"req":"Wrl_CADInfo","rid":1,"para":{}},返回信息举例:
{"ret":0,"rid":1,"req":"Wrl_CADInfo","data":{"Info":[{"Type":1,"Option":0,"X64":1,"Ver":"R24.1.51.0.0","Path":"F:/Soft/Autodesk/AutoCAD 2022/acad.exe"},{"Type":1,"Option":1,"X64":1,"Ver":"22.0.50.0.0","Path":"C:/Program Files/Common Files/Autodesk Shared/dwgviewrAcCtrl.dll"},{"Type":1,"Option":2,"X64":0,"Ver":"14.0.0.177","Path":"C:/Program Files (x86)/Common Files/Autodesk Shared/DWF Common/AdView.dll"}]}}
Type等于1的代表AutoCAD相关小程序的安装信息
2)、请求控制ACAD网页组件:
当前端不再需要网页组件时可指定关闭,或者显示/隐藏及全屏显示等
ID为启动网页组件时返回JSON中的ID值,Code代表控制类型掩码:1正常关闭 128强制迅速关闭 2全屏显示 4自动隐藏 8还原显示 16自动适配网页高度和宽度显示模式切换 32强制隐藏。其中全屏显示2,可直接通过热键ESC或取消,4和32隐藏后可通过8恢复显示
{"req":"Wrl_AppletControl","rid":2,"para":{"ID":"1","Code":4}}
3)、请求滚动ACAD网页组件:
当前端截取到网页滚动通知时,需要调用此接口实现网页组件和网页的滚动联动
ID为启动网页组件时返回JSON中的ID值
Code为滚动方向1是水平直,2是垂直,3是同时
Left为横向滚动条位置,Top为纵向滚动条位置
{"req":"Wrl_AppletScroll","rid":3,"para":{"ID":"1","Code":2,"Left":0,"Top":100}}
4)、请求改变ACAD网页组件显示位置或大小:
当前端网页显示区域缩放时,可动态修改网页组件的显示位置或大小
ID为启动网页组件时返回JSON中的ID值,Width和Height分别为新的宽度和高度,X和Y分别为新的显示位置,不指定时保持不变,指定时原设置的IframeX和IframeY失效
{"req":"Wrl_AppletResize","rid":4,"para":{"ID":1,"Width":500,"Height":600}}
或同时设置网页组件显示起始坐标
{"req":"Wrl_AppletResize","rid":5,"para":{"ID":1,"Width":500,"Height":600,"X":20,"Y":20}}
5)、请求设置网页预留右侧宽度和底部高度,滚动条信息、垂直滚动及水平滚动位置:
当网页组件显示区域超过当前网页时,需去除滚动条的显示影响
ID为启动网页组件时返回JSON中的ID值,BarW为预留右侧宽度 BarH为预留底部高度
Code 1代表有水平滚动条,2代表有垂直滚动条,3代表都有
ScrollTop垂直滚动条位置 ScrollTop水平滚动条位置
{"req":"Wrl_ScrollBar","rid":6,"para":{"ID":"1","Code":2,"BarW":0,"BarH":0,"ScrollTop":0,"ScrollLeft":0}}
6)、请求对网页组件窗口做Alpha透明处理,便于前端临时显示覆盖到网页组件窗口的菜单等:
ID为Wrl_ACADApplet启动网页组件时返回的ID值,Alpha为透明度百分比,1-100
{"req":"Wrl_AppletAlpha","rid":7,"para":{"ID":1,"Alpha":30}}
7)、请求对网页组件窗口内容进行截图:
ID为启动网页组件时返回JSON中的ID值,
File为指定截图文件保存路径或扩展名
Base64指定为1时代表返回BASE64编码的图像内容
{"req":"Wrl_AppletSnap","rid":10,"para":{"ID":1,"Base64":1,"File":".jpg"}}
8)、请求缩放ACAD网页组件,用于浏览器网页按比例缩放,一般不需要处理:
eID为启动网页组件时返回JSON中的ID值,不指定Scale时,获取当前网页组件所用的缩放百分比,一般和系统缩放比例一致
{"req":"Wrl_AppletScale","rid":11,"para":{"ID":1,"Scale":120}}
3、网页组件安装、升级、卸载
1)、请求安装ACAD网页组件
请在测试网页输入框中,输入如下请求,然后点击发送,完成安装:
{"req":"Plugin_Install","rid":1,"para":{"Name":"ACAD网页组件","PID":"ACadApplet","Date":"2024-03-12","Desc":"跨浏览器的dwg、dxf等工程图纸在线编辑小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中内嵌AutoCAD等程序进行在线编辑、查看或审阅工程图","DownAddr":"http://local.zorrosoft.com/Files/Net/ACadApplet.pid","MD5":"E5FD2589A52D4BC8C4384C7E12B85619","Version":"2.2.13.2","Size":3964928,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"981EB5CDD2A4541D78A37E5749DBAC225789A70B1AC26D6133072280B4DAD4E1EEBFD4B6E2CC7AAD71BA55D83DCC03AFE90DBC97901BA709BA1342CC7850F17574FE58B1B2F1EC4E45584A484FCDCBB97121321B7FF15A8E5A26C59B2197F7495CFD5AF34402FC573288E9944941DAE125DC15AD00D961518D060301AF2E1CBB814133555EC4E38C7E452101AC869A27E22CF5F9D16433A0DC6C9477DB85FB8D20501D52F01F45D4DFC22AD9C0973ADC3F17DF6B8A6C34F845F7980D8DBFC76966BE4E9B4E82A9A9BFC88E33EDBA55F1A5E79AC0C3CB547DE2CC874B90861EAEA4E8D3A143BDFC624F963F11918400EFB98C26C7D638C20D3917E3E06F418951"}}
启动安装后,会不断收到安装进度直到安装结束。
在发布时,也可以把此网页组件目录文件和中间件一起打包后发布,不用单独分发。
2)、请求升级ACAD网页组件:
{"req":"Plugin_Update","rid":1,"para":{"Name":"ACAD网页组件","PID":"ACadApplet","Date":"2024-03-12","Desc":"跨浏览器的dwg、dxf等工程图纸在线编辑小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中内嵌AutoCAD等程序进行在线编辑、查看或审阅工程图","DownAddr":"http://local.zorrosoft.com/Files/Net/ACadApplet_Update.pid","MD5":"11AC15B6DDDB64505D660242DF365638","Version":"2.2.13.2","Size":3964928,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"07D7DFA369FFAD2B20ED93A8A8D813B789596C5E943B0BCC007A2B5F473EBE81E1D46E0CA40C23E7DBD17E1B15A1C1042A45C859A21B4D3C215CAE7267ACA740E89B9679E0FB87415CCC4B752A1F1176B24E56F0F34D48F54978D7E7534FA6429BE2DD4BD586B91231E3D344D4AF9EFCE5C3DD809544B22BBC1E03BF1290FC9D372A5D929C7F76DAB91B7C03B17D124C2FE400E0BBB5D9DC15CA3D7C72A28945BDB9E23ADA103A138D7158D600D0DF1EE0A94B2CFA37387EB2C0B7B675C29F1ED2C975F73B9CC1272C2B82AD8DCD5673A381AB54A5E351A52E71DB6A959DF0E3954E89817B5124FEBEC5240EF2B1AE8211BED91ADFD59BEF64738803728DFE16"}}
以上安装和升级的JSON请求包,可能因版本升级导致内容不同,如遇安装或升级时报错,请联系客服获取最新的请求包。
3)、请求卸载ACAD网页组件:
正式版需要添加TK校验,具体规则请参考SDK包中文档“猿大师中间件安全解决方案.doc”,可在SDK包中的打包程序ZbaPackage.exe的中间件维护生成带TK的请求。
{"req":"Plugin_Remove","rid":3,"para":{"PID":"ACadApplet","Type":8}}
4、ACAD网页组件转调用Autodesk的AutoCAD软件自动化接口、DWG TrueView或Design Review的OCX控件接口,先根据Wrl_ACADApplet请求启动后返回的端口号,新建立一个WebSocket连接后可执行如下指令:
A、常用功能请求:
1)、请求获取当前打开文档信息 适用于autocad、DWG TrueView及Design Review软件
{"req":"CAD_GetCurOpen","rid":1,"para":{}}
返回:{"ret":0,"rid":1,"data":{"Ret":"0","File":"C:/CADDoc/test.dwg","Edit":0,"Option":0,"Hide":0}}
2)、请求关闭当前打开的文档 适用于autocad、DWG TrueView及Design Review软件
Save指定是否保存,不指定时根据程序配置判断是否自动保存
{"req":"CAD_Close","rid":2,"para":{"Save":0}}
返回: {"ret":0,"rid":2,"data":{"Ret":"0"}} Ret为0代表成功
3)、请求打开文档 适用于autocad、DWG TrueView及Design Review软件
Open打开文档路径,如有特殊字符或中文的需要用URLCode先编码 如非全路径,除非启动时指定了数据文件目录DataPath,否则默认使用中间件程序Data子目录作为根目录使用
PW打开密码
Edit设置编辑权限,含义和启动时相同 Hide控制界面显示标记
{"req":"CAD_Open","rid":3,"para":{"Open":"D:/Zorro/test.dwg","PW":"","Edit":0,"Hide":0}}
返回: {"ret":0,"rid":3,"data":{"Ret":"0"}} Ret为0代表成功
4)请求保存,如是新建文档,会创建一个临时文件名保存,适用于autocad软件
如果指定了CAD_NetFile接口中的Url等参数,代表保存到本地的同时上传到服务器
{"req":"CAD_Save","rid":4,"para":{}}
{"req":"CAD_Save","rid":4,"para":{"Agent":"","Cookie":"","Auth":"","Para":"","Url":"http://zorrosoft.com/wp-admin/admin-ajax.php"}}
返回:{"ret":0,"rid":4,"data":{"Ret":"0","FilePath":""}} 其中FilePath为实际保存路径
5)请求另保存 NewFile为另保存路径,有中文或特殊字符等需要UrlEncode编码,适用于autocad软件
支持相对路径,如非全路径,除非启动时指定了数据文件目录DataPath,否则默认使用中间件程序Data子目录作为根目录使用
如果指定了CAD_NetFile接口中的Url等参数,代表保存到本地的同时上传到服务器
{"req":"CAD_SaveAs","rid":5,"para":{"NewFile":"D:/Zorro/test.dxf"}}
{"req":"CAD_SaveAs","rid":5,"para":{"NewFile":"D:/Zorro/testSA.dwg"}}
{"req":"CAD_SaveAs","rid":5,"para":{"NewFile":"D:/Zorro/test.pdf"}}
{"req":"CAD_SaveAs","rid":5,"para":{"NewFile":"D:/Zorro/upload.dwg","Agent":"","Cookie":"","Auth":"","Para":"","Url":"http://zorrosoft.com/wp-admin/admin-ajax.php"}}
返回:{"ret":0,"rid":5,"data":{"Ret":"0","FilePath":""}} 其中FilePath为实际保存路径
6)、打开文档转换到其它格式文档,适用于autocad软件
SrcFile打开文档路径,如有特殊字符或中文的需要用URLCode先编码 PW打开密码,如操作当前已打开文档,不用设置
DestFile转换目标路径,如有特殊字符或中文的需要用URLCode先编码
当选中某些图形元素时,支持转换为bmp、jpg、png、wmf等文件
支持转换到pdf、jpg、png、dwf等格式文件
{"req":"CAD_ConvertTo","rid":6,"para":{"SrcFile":"D:/Zorro/test1.dwg","DestFile":"D:/Zorro/test1.pdf","PW":""}}
返回: {"ret":0,"rid":6,"data":{"Ret":"0"}} Ret为0代表成功
7)创建指定目录 适用于autocad、DWG TrueView及Design Review软件
Dir为子目录名称,可为全路径,需要确保有创建子目录权限,非全路径时,为启动指定数据文件路径DataPath的子目录,没指定DataPath时为中间件data的子目录
{"req":"CAD_CreateDir","rid":7,"para":{"Dir":"/doc"}}
返回:{"ret":0,"rid":7,"data":{"Ret":"0"}}
8)切换全屏编辑状态 适用于autocad、DWG TrueView及Design Review软件
{"req":"CAD_SwitchFullScreen","rid":8,"para":{}}
返回:{"ret":0,"rid":8,"data":{"Ret":"0"}}
9)网络文件操作 适用于autocad、DWG TrueView及Design Review软件
Type 1上传文件 0下载文件
Agent、Cookie及Auth Cookie可传浏览器中的Cookie或通过Auth授权验证上传权限,默认为空,非空时需要先做UrlEnocde编码
Local 上传文件本地路径或下载文件保存路径,如果不指定默认用当前打开文档,需要做UrlEncode编码
Url 上传或下载的地址,需要做UrlEncode编码
Type为1时,可增加参数Para,对应POST数据包中需要传递的参数param 默认上传文件名为upfile,否则可通过NodeName设置自己的文件参数名称
Type为0时,可增加参数MD5及FileSize,下载文件的哈希值及大小,用于校验下载文件的完整性,可默认空或0
{"req":"CAD_NetFile","rid":9,"para":{"Type":0,"Agent":"","Cookie":"","Auth":"","FileSize":0,"MD5":"","Local":"C:/OfficeDoc/test.dwg","Url":"http://local.zorrosoft.com/Files/test.dwg"}}
{"req":"CAD_NetFile","rid":9,"para":{"Type":1,"Agent":"","Cookie":"","Auth":"","Para":"","Local":"","Url":"http://zorrosoft.com/wp-admin/admin-ajax.php"}}
返回:{"ret":0,"rid":35,"data":{"Ret":"0"}}
10)、打印文档,适用于autocad软件
SrcFile打开文档路径,如有特殊字符或中文的需要用URLCode先编码 PW打开密码,如操作当前已打开文档,不用设置
Count 打印份数,不设置默认1
{"req":"CAD_Print","rid":10,"para":{"SrcFile":"D:/Zorro/test1.dwg","PW":"","Count":1}}
返回: {"ret":0,"rid":10,"data":{"Ret":"0"}} Ret为0代表成功
B、DWG TrueView专用功能请求:
101)、对应OCX中的方法Plot 切换到平面图
{"req":"CADVIEW_Plot","rid":101,"para":{}}
返回: {"ret":0,"rid":101,"data":{"Ret":"0"}}
102)、对应OCX中的方法Plot_Preview 平面图预览
{"req":"CADVIEW_PlotPreview","rid":102,"para":{}}
返回: {"ret":0,"rid":102,"data":{"Ret":"0"}}
103)、对应OCX中的方法ViewPlotDetails 查看平面图详情
{"req":"CADVIEW_ViewPlotDetails","rid":103,"para":{}}
返回: {"ret":0,"rid":103,"data":{"Ret":"0"}}
104)、对应OCX中的方法PublishForMarkup
{"req":"CADVIEW_PublishForMarkup","rid":104,"para":{"FullPath":"D:/Zorro/Publish.dwg","Space":1}}
返回: {"ret":0,"rid":104,"data":{"Ret":"0","Status":"0"}}
105)、对应OCX中的方法Publish 发布图
{"req":"CADVIEW_Publish","rid":105,"para":{}}
返回: {"ret":0,"rid":105,"data":{"Ret":"0"}}
106)、对应OCX中的方法ViewPublishDetails 查看发布图详情
{"req":"CADVIEW_ViewPublishDetails","rid":106,"para":{}}
返回: {"ret":0,"rid":106,"data":{"Ret":"0"}}
107)、对应OCX中的方法Drawing_Properties 图纸属性
{"req":"CADVIEW_DrawingProperties","rid":107,"para":{}}
返回: {"ret":0,"rid":107,"data":{"Ret":"0"}}
108)、对应OCX中的方法Zoom_Realtime 实时缩放
{"req":"CADVIEW_ZoomRealtime","rid":108,"para":{}}
返回: {"ret":0,"rid":108,"data":{"Ret":"0"}}
109)、对应OCX中的方法Zoom_Previous 缩放预览
{"req":"CADVIEW_ZoomPrevious","rid":109,"para":{}}
返回: {"ret":0,"rid":109,"data":{"Ret":"0"}}
110)、对应OCX中的方法Zoom_Window 缩放窗口
{"req":"CADVIEW_ZoomWindow","rid":110,"para":{}}
返回: {"ret":0,"rid":110,"data":{"Ret":"0"}}
111)、对应OCX中的方法Zoom_Dynamic 动态缩放
{"req":"CADVIEW_ZoomDynamic","rid":111,"para":{}}
返回: {"ret":0,"rid":111,"data":{"Ret":"0"}}
112)、对应OCX中的方法Zoom_Center 居中缩放
{"req":"CADVIEW_ZoomCenter","rid":112,"para":{}}
返回: {"ret":0,"rid":112,"data":{"Ret":"0"}}
113)、对应OCX中的方法Zoom_In 视图放大
{"req":"CADVIEW_ZoomIn","rid":113,"para":{}}
返回: {"ret":0,"rid":113,"data":{"Ret":"0"}}
114)、对应OCX中的方法Zoom_Out 视图缩小
{"req":"CADVIEW_ZoomOut","rid":114,"para":{}}
返回: {"ret":0,"rid":114,"data":{"Ret":"0"}}
115)、对应OCX中的方法Zoom_All 缩放全部
{"req":"CADVIEW_ZoomAll","rid":115,"para":{}}
返回: {"ret":0,"rid":115,"data":{"Ret":"0"}}
116)、对应OCX中的方法Zoom_Extents 缩放范围
{"req":"CADVIEW_ZoomExtents","rid":116,"para":{}}
返回: {"ret":0,"rid":116,"data":{"Ret":"0"}}
117)、对应OCX中的方法Pan_Realtime 实时平移
{"req":"CADVIEW_PanRealtime","rid":117,"para":{}}
返回: {"ret":0,"rid":117,"data":{"Ret":"0"}}
118)、对应OCX中的方法Pan_Point 按点平移
{"req":"CADVIEW_PanPoint","rid":118,"para":{}}
返回: {"ret":0,"rid":118,"data":{"Ret":"0"}}
119)、对应OCX中的方法Named_Views 命名视图
{"req":"CADVIEW_NamedViews","rid":119,"para":{}}
返回: {"ret":0,"rid":119,"data":{"Ret":"0"}}
120)、对应OCX中的方法View_3D_Orbit 查看3D轨道
{"req":"CADVIEW_View3DOrbit","rid":120,"para":{}}
返回: {"ret":0,"rid":120,"data":{"Ret":"0"}}
121)、对应OCX中的方法Shade_2D_Wireframe 着色2D线框
{"req":"CADVIEW_Shade2DWireframe","rid":121,"para":{}}
返回: {"ret":0,"rid":121,"data":{"Ret":"0"}}
122)、对应OCX中的方法Shade_3D_Wireframe 着色3D线框
{"req":"CADVIEW_Shade3DWireframe","rid":122,"para":{}}
返回: {"ret":0,"rid":122,"data":{"Ret":"0"}}
123)、对应OCX中的方法Shade_Hidden 着色隐藏
{"req":"CADVIEW_ShadeHidden","rid":123,"para":{}}
返回: {"ret":0,"rid":123,"data":{"Ret":"0"}}
124)、对应OCX中的方法Shade_Flat_Shaded 遮挡平面阴影
{"req":"CADVIEW_ShadeFlatShaded","rid":124,"para":{}}
返回: {"ret":0,"rid":124,"data":{"Ret":"0"}}
125)、对应OCX中的方法Shade_Gourand_Shaded 遮挡Gourand阴影
{"req":"CADVIEW_ShadeGourandShaded","rid":125,"para":{}}
返回: {"ret":0,"rid":125,"data":{"Ret":"0"}}
126)、对应OCX中的方法Shade_Flat_Shaded_Edges_On 遮蔽平坦的阴影边缘
{"req":"CADVIEW_ShadeFlatShadedEdgesOn","rid":126,"para":{}}
返回: {"ret":0,"rid":126,"data":{"Ret":"0"}}
127)、对应OCX中的方法Shade_Gourand_Shaded_Edges_On 遮荫Gourand阴影边缘
{"req":"CADVIEW_ShadeGourandShadedEdgesOn","rid":127,"para":{}}
返回: {"ret":0,"rid":127,"data":{"Ret":"0"}}
128)、对应OCX中的方法callBackImageResolve 回调图像解析
{"req":"CADVIEW_callBackImageResolve","rid":128,"para":{"ParentFileName":"","EmbeddedName":""}}
返回: {"ret":0,"rid":128,"data":{"Ret":"0","FileName":"","Code":""}}
129)、对应OCX中的方法callBackFileResolve 回调文件解析
{"req":"CADVIEW_callBackFileResolve","rid":129,"para":{"ParentFileName":"","EmbeddedName":""}}
返回: {"ret":0,"rid":129,"data":{"Ret":"0","FileName":"","Code":""}}
130)、对应OCX中的方法Layer_Properties_Manager 图层属性管理器
{"req":"CADVIEW_LayerPropertiesManager","rid":130,"para":{}}
返回: {"ret":0,"rid":130,"data":{"Ret":"0"}}
131)、对应OCX中的方法Options 显示选项
{"req":"CADVIEW_Options","rid":131,"para":{}}
返回: {"ret":0,"rid":131,"data":{"Ret":"0"}}
132)、对应OCX中的方法Help 显示帮助
{"req":"CADVIEW_Help","rid":132,"para":{}}
返回: {"ret":0,"rid":132,"data":{"Ret":"0"}}
133)、获取OCX中的属性ActiveSheet 获取活动表单号
{"req":"CADVIEW_GetActiveSheet","rid":133,"para":{}}
返回: {"ret":0,"rid":133,"data":{"Ret":"0","ActiveSheet":""}}
134)、设置OCX中的属性ActiveSheet 设置活动表单号
{"req":"CADVIEW_PutActiveSheet","rid":134,"para":{"ActiveSheet":""}}
返回: {"ret":0,"rid":134,"data":{"Ret":"0"}}
135)、对应OCX中的方法CheckAutocadActiveState 检查AutoCAD激活状态
{"req":"CADVIEW_CheckAutocadActiveState","rid":135,"para":{}}
返回: {"ret":0,"rid":135,"data":{"Ret":"0","ActiveState":""}}
136)、对应OCX中的方法Deactivate 关闭
{"req":"CADVIEW_Deactivate","rid":136,"para":{}}
返回: {"ret":0,"rid":136,"data":{"Ret":"0"}}
137)、对应OCX中的方法SilentPublish 静默发布
{"req":"CADVIEW_SilentPublish","rid":137,"para":{}}
返回: {"ret":0,"rid":137,"data":{"Ret":"0"}}
138)、对应OCX中的方法VisualStyle_2D_Wireframe
{"req":"CADVIEW_VisualStyle2DWireframe","rid":138,"para":{}}
返回: {"ret":0,"rid":138,"data":{"Ret":"0"}}
139)、对应OCX中的方法VisualStyle_3D_Wireframe
{"req":"CADVIEW_VisualStyle3DWireframe","rid":139,"para":{}}
返回: {"ret":0,"rid":139,"data":{"Ret":"0"}}
140)、对应OCX中的方法VisualStyle_Hidden
{"req":"CADVIEW_VisualStyleHidden","rid":140,"para":{}}
返回: {"ret":0,"rid":140,"data":{"Ret":"0"}}
141)、对应OCX中的方法VisualStyle_Realistic
{"req":"CADVIEW_VisualStyleRealistic","rid":141,"para":{}}
返回: {"ret":0,"rid":141,"data":{"Ret":"0"}}
142)、对应OCX中的方法VisualStyle_Conceptual
{"req":"CADVIEW_VisualStyleConceptual","rid":142,"para":{}}
返回: {"ret":0,"rid":142,"data":{"Ret":"0"}}
143)、对应OCX中的方法SetPc3File 设置Pc3文件
{"req":"CADVIEW_SetPc3File","rid":143,"para":{}}
返回: {"ret":0,"rid":143,"data":{"Ret":"0"}}
C、Design Review专用功能请求:
201)、对应OCX获取属性BackColor
{"req":"CADREVIEW_GetBackColor","rid":201,"para":{}}
返回: {"ret":0,"rid":201,"data":{"Ret":"0","BackColor":""}}
202)、对应OCX设置属性BackColor
{"req":"CADREVIEW_PutBackColor","rid":202,"para":{"BackColor":""}}
返回: {"ret":0,"rid":202,"data":{"Ret":"0"}}
203)、对应OCX获取属性EmbedSourceDocument
{"req":"CADREVIEW_GetEmbedSourceDoc","rid":203,"para":{}}
返回: {"ret":0,"rid":203,"data":{"Ret":"0","EmbedSourceDoc":""}}
204)、对应OCX设置属性BackColor
{"req":"CADREVIEW_PutEmbedSourceDoc","rid":204,"para":{"EmbedSourceDoc":""}}
返回: {"ret":0,"rid":204,"data":{"Ret":"0"}}
205)、对应OCX调用方法ShowPrintDialog
{"req":"CADREVIEW_ShowPrintDialog","rid":205,"para":{}}
返回: {"ret":0,"rid":205,"data":{"Ret":"0"}}
206)、对应OCX调用方法NavigateToUrl
{"req":"CADREVIEW_NavigateToUrl","rid":206,"para":{"Url":""}}
返回: {"ret":0,"rid":206,"data":{"Ret":"0"}}
207)、对应OCX调用方法ExecuteCommand或ExecuteCommandEx
自定了Val参数的调用ExecuteCommandEx
{"req":"CADREVIEW_ExecuteCommand","rid":207,"para":{"Command":"","Val":""}}
返回: {"ret":0,"rid":207,"data":{"Ret":"0"}}
208)、对应OCX获取属性DocumentParams
{"req":"CADREVIEW_GetDocParams","rid":208,"para":{}}
返回: {"ret":0,"rid":208,"data":{"Ret":"0","DocParams":""}}
209)、对应OCX获取属性HistoryParams
{"req":"CADREVIEW_GetHistoryParams","rid":209,"para":{}}
返回: {"ret":0,"rid":209,"data":{"Ret":"0","HistoryParams":""}}
210)、对应OCX获取属性LocalFilePath
{"req":"CADREVIEW_GetLocalFilePath","rid":210,"para":{}}
返回: {"ret":0,"rid":210,"data":{"Ret":"0","LocalFilePath":""}}
211)、对应OCX获取属性ViewerParams
{"req":"CADREVIEW_ViewerParams","rid":211,"para":{}}
返回: {"ret":0,"rid":211,"data":{"Ret":"0","ViewerParams":""}}
212)、对应OCX设置属性ViewerParams
{"req":"CADREVIEW_PutViewerParams","rid":212,"para":{"ViewerParams":""}}
返回: {"ret":0,"rid":212,"data":{"Ret":"0"}}
213)、对应OCX调用方法GoBack
{"req":"CADREVIEW_GoBack","rid":213,"para":{}}
返回: {"ret":0,"rid":213,"data":{"Ret":"0"}}
214)、对应OCX调用方法GoForward
{"req":"CADREVIEW_GoForward","rid":214,"para":{}}
返回: {"ret":0,"rid":214,"data":{"Ret":"0"}}
215)、对应OCX调用方法SaveHistory
{"req":"CADREVIEW_SaveHistory","rid":215,"para":{}}
返回: {"ret":0,"rid":215,"data":{"Ret":"0"}}
216)、对应OCX调用方法ShowHelp
{"req":"CADREVIEW_ShowHelp","rid":216,"para":{}}
返回: {"ret":0,"rid":216,"data":{"Ret":"0"}}
217)、对应OCX获取属性DocType
{"req":"CADREVIEW_GetDocType","rid":217,"para":{}}
返回: {"ret":0,"rid":217,"data":{"Ret":"0","DocType":""}}
218)、对应OCX获取属性GradientBackColor
{"req":"CADREVIEW_GetGradientBackColor","rid":218,"para":{}}
返回: {"ret":0,"rid":218,"data":{"Ret":"0","GradientBackColor":""}}
219)、对应OCX设置属性GradientBackColor
{"req":"CADREVIEW_PutGradientBackColor","rid":219,"para":{"GradientBackColor":""}}
返回: {"ret":0,"rid":219,"data":{"Ret":"0"}}
220)、对应OCX获取属性GradientBackgroundEnabled
{"req":"CADREVIEW_GetGradientBackgroundEnabled","rid":220,"para":{}}
返回: {"ret":0,"rid":220,"data":{"Ret":"0","GradientBackgroundEnabled":""}}
221)、对应OCX设置属性GradientBackColor
{"req":"CADREVIEW_PutGradientBackgroundEnabled","rid":221,"para":{"GradientBackgroundEnabled":""}}
返回: {"ret":0,"rid":221,"data":{"Ret":"0"}}
222)、对应OCX获取属性CanvasEmpty
{"req":"CADREVIEW_GetCanvasEmpty","rid":222,"para":{}}
返回: {"ret":0,"rid":222,"data":{"Ret":"0","CanvasEmpty":""}}
223)、对应OCX设置属性CanvasEmpty
{"req":"CADREVIEW_PutCanvasEmpty","rid":223,"para":{"CanvasEmpty":""}}
返回: {"ret":0,"rid":223,"data":{"Ret":"0"}}
5、事件通知:
A、AutoCAD事件
1)
B、DWG TrueView事件
1) CADVIEW_callBackFileResolve回调结果通知
{"event":"CADVIEW_FileResolve","data":{"ParentFileName":"","InEmbeddedName":"","OutFileName":"","Code":""}}
2) CADVIEW_callBackImageResolve回调结果通知
{"event":"CADVIEW_ImageResolve","data":{"ParentFileName":"","InEmbeddedName":"","OutFileName":"","Code":""}}
C、Design Review事件
1)
D、支持的事件通知:
1) 小程序是否响应了热键全屏
{"event":"CAD_FullScreen","data":{"FullScreen":0}} FullScreen为当前是否全屏标记
2) Wrl_AppletExit 小程序退出通知
{"event":"Wrl_AppletExit","data":{"ID":1}}
6、其它
请求参数的JSON数据包,请确保是UTF-8无签名的编码。
更多接口请求说明,请参考安装目录中的文档TestWrl.txt、SDK包中的“猿大师开发者手册.pdf”及“猿大师中间件安全解决方案.pdf”。