# 导出ForgeViewer

# 概述

Autodesk Forge (opens new window)是AutoDesk的产品,由一组强大的Web服务API,SDK开发包以及开发人员社区组成。

vjmap能将AutoCADDWG图形导出 forgeviewer 要求的f2d格式,从来可以利用forgeviewerSDK进行开发,并进行离线部署

# 示例



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=no"/>
    <title>forgeViewer-Vjmap.com</title>
	<link rel="stylesheet" type="text/css" href="./style.min.css">
	<script src="./viewer3D.min.js"></script>
</head>
<body style="margin:0px">
	<div id="viewer-local"></div>
<script>
    var config = {
        extensions: [
            "Autodesk.Viewing.ZoomWindow"
        ],
        disabledExtensions: {
            measure: false,
            section: false,
        },
        memory: {
            limit: 32 * 1024    //32 GB
        }
    };

    var element = document.getElementById('viewer-local');
    var viewer = new Autodesk.Viewing.Private.GuiViewer3D(element, config);

    var options = {
        env: 'Local',
        offline: 'true',
        useADP: false
    };

    Autodesk.Viewing.Initializer (options, function () {

        var startedCode = viewer.start();
        if (startedCode > 0) {
            console.error('Failed to create a Viewer: WebGL not supported.');
            return;
        }

        viewer.loadModel("./f2d/zp.f2d", { "skipPropertyDb": false, bgColor: 0x212830}, onLoadSuccess, onLoadError);
		viewer.setSwapBlackAndWhite(true);
    });

    function onLoadSuccess(event) {
        console.log('success');
    }

    function onLoadError(event) {
        console.log('fail');
    }

</script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59