明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 791|回复: 0

通过CADViewer+控件在管理系统中、移动设备中安全浏览CAD文件的心得!

[复制链接]
发表于 2015-6-19 15:43 | 显示全部楼层 |阅读模式
CADViewer+分为:CADViewer+ for HTML;CADViewer+ for Android;CADViewer+ for IOS;三个版本,在下载包中含有例子,通过查看例子可也很方便的将这个控件集成到系统中。
例如:IOS版只需要如下就可

步骤一: 在 AppDelegate在完成 图纸 驱动 初始化, 这步 必须 完成, 否则 后续 图 纸打开 会失败。
#import "AppDelegate.h"
#import <CADViewerSDK/CADViewerSDK.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[CADViewer InitCADViewer]; // 图纸浏览驱动初始化,必须调用
return YES;
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[CADViewer UninitCADViewer]; // 图纸浏览驱动释放,必须调用
}
步骤 二:在浏览 视图 中调用 图纸 浏览 视图, 如下 代码:
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property(weak, nonatomic) UINavigationController *navContro;
-(IBAction)OpenDwg:(id)sender;
-(IBAction)PushDwg:(id)sender;
@end
#import "ViewController.h"
#import <CADViewerSDK/CADViewerSDK.h>
//弹出视图模式
-(IBAction)OpenDwg:(id)sender
{
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"CADViewerResources" withExtension:@"bundle"]];
NSString* dwgFile = [[bundle resourcePath] stringByAppendingPathComponent:@"tztest.dwg"];
//NSString* dwgFile = @"test.dwg";
// dwgFile必须是本地的文件,如果是HTTP和FTP文件,请先下载到本地
[CADViewer OpenCADViewer:dwgFile DocName:@"test.dwg" ViewControl:self ];
}
// 导航模式
-(IBAction)PushDwg:(id)sender
{
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"CADViewerResources" withExtension:@"bundle"]];
NSString* dwgFile = [[bundle resourcePath] stringByAppendingPathComponent:@"tztest.dwg"];
//NSString* dwgFile = @"test.dwg";
// dwgFile必须是本地的文件,如果是HTTP和FTP文件,请先下载到本地
[CADViewer PushCADViewer:dwgFile DocName:@"test.dwg" NavControl: _navContro];
}


该贴已经同步到 yttxsoft1234的微博
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 05:37 , Processed in 0.261370 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表