-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathquick-start.html
410 lines (331 loc) · 18.5 KB
/
quick-start.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="xbim toolkit is an Open Source toolkit for IFC and BIM. You can use it to do anything with IFC. It implements IFC2x3 and IFC4 and allows to develop SW agnostic to IFC version and file format.">
<meta name="author" content="xbim ltd.">
<meta name="keywords" content="xbim,BIM,C#,CSharp,NET,OpenBIM,IFC,buildingSMART,standard,documentation,examples">
<meta name="google-site-verification" content="0uIEEP0H5QWrL3gUPIdxOhMzGT0ZArO6rdpj9TOeeEQ" />
<link rel="icon" href="img/favicon.ico">
<title>Quick Start</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Google fonts -->
<link target="_blank" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;700&family=Roboto:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Custom styles for this template -->
<link href="css/codestyles.css" rel="stylesheet">
<link href="css/site.css" rel="stylesheet">
<script src="js/jquery.min.js"></script>
<!-- Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-51899259-2', 'auto');
ga('send', 'pageview');
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-VRB7WSDSRJ"></script>
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-VRB7WSDSRJ');
</script>
<!-- JSON-LD markup generated by Google Structured Data Markup Helper. -->
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "SoftwareApplication",
"name" : "xbim toolkit",
"image" : "https://docs.xbim.netimg/xBim_toolkit_logo.png",
"url" : "https://docs.xbim.net/",
"author" : {
"@type" : "Person",
"name" : "prof. Steve Lockley"
},
"applicationCategory" : "BIM",
"downloadUrl" : "https://www.nuget.org/packages?q=xbim",
"softwareVersion" : "4.0"
}
</script>
</head>
<!-- NAVBAR
================================================== -->
<body>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img alt="logo" src="img/xBim_toolkit_logo.png"/></a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">
<a href="quick-start.html">Quick Start</a>
</li>
<li>
<a href="docs.html">Docs</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Examples <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="examples/examples-list.html">Examples list</a>
</li>
<li role="separator" class="group-divider">Basic </li>
<li>
<a href="examples/basic-model-operations.html">Basic Model Operations</a>
</li>
<li>
<a href="examples/watch-the-log.html">Watch the log!</a>
</li>
<li>
<a href="examples/proper-wall-in-3d.html">Proper Wall in 3D</a>
</li>
<li>
<a href="examples/step-to-xml-and-back-again.html">STEP to XML and Back Again</a>
</li>
<li>
<a href="examples/creating-wexbim-file.html">Creating wexBIM file</a>
</li>
<li>
<a href="examples/using-linq-for-optimal-performance.html">Using LINQ for Optimal Performance</a>
</li>
<li>
<a href="examples/excel-space-report-from-ifc.html">Excel Space Report from IFC</a>
</li>
<li>
<a href="examples/spatial-hierarchy.html">Spatial hierarchy</a>
</li>
<li role="separator" class="group-divider">Advanced </li>
<li>
<a href="examples/federating-models.html">Federating Models</a>
</li>
<li>
<a href="examples/insert-copy-function.html">Insert Copy Function</a>
</li>
<li>
<a href="examples/change-log-creation.html">Change Log Creation</a>
</li>
<li role="separator" class="group-divider">Web UI </li>
<li>
<a href="examples/hello-building.html">Hello Building</a>
</li>
<li>
<a href="examples/safe-hello-building.html">Safe Hello Building</a>
</li>
<li>
<a href="examples/eventful-building.html">Eventful Building</a>
</li>
<li>
<a href="examples/building-seen-from-everywhere.html">Building Seen from Everywhere</a>
</li>
<li>
<a href="examples/colourful-building.html">Colourful Building</a>
</li>
<li>
<a href="examples/pinpoint-the-view.html">Pinpoint the View</a>
</li>
<li>
<a href="examples/informational-overlay.html">Informational Overlay</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Release notes <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="release-notes/fast-upgrade-track.html">Fast Upgrade Track</a>
</li>
<li>
<a href="release-notes/xbim-4-release-notes.html">xBIM 4 Release Notes</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Research <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="research/history.html">History</a>
</li>
<li>
<a href="research/how-to-reference.html">How to reference</a>
</li>
<li>
<a href="research/ifc2x3-test-harness.html">Ifc2X3 Test Harness</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Downloads <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="downloads/xbimxplorer.html">XbimXplorer</a>
</li>
</ul>
</li>
<li>
<a href="cloud.html">Cloud</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">License <span class="caret"></span></a>
<ul class="dropdown-menu">
<li>
<a href="license/license.html">License</a>
</li>
<li>
<a href="license/third-party-licenses.html">Third Party Licenses</a>
</li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="flex-add">
Interested to see what we do in the cloud? Join us for one of our <a target="_blank" href="https://xbim.net/webinar/?utm_source=toolkit" target="_blank">webinars</a>!
</div>
<div class="container">
<h1>Quick Start</h1>
<p>To get started the easiest way to get xbim into your project is to use <a target="_blank" href="https://www.nuget.org/packages?q=xbim">NuGet</a>. To do anything you want with the data you only need
<a target="_blank" href="https://www.nuget.org/packages/Xbim.Essentials/">Xbim Essentials</a>. If you need anything to do with geometry (like visualization) you will also need
<a target="_blank" href="https://www.nuget.org/packages/Xbim.Geometry/">Xbim Geometry Engine</a>. There are many years of development behind xbim and both these packages are mature and pretty much stable.</p>
<p>As the very first thing you should create credentials which will be used to keep <a target="_blank" href="http://www.buildingsmart-tech.org/ifc/IFC4/final/html/link/ifcownerhistory.htm">owner history</a>
of all entities right in IFC world. </p>
<div class="csharp"><pre><code><span class="keyword">var</span> editor = <span class="keyword">new</span> <span class="type">XbimEditorCredentials</span>
{
ApplicationDevelopersName = <span class="string">"You"</span>,
ApplicationFullName = <span class="string">"Your app"</span>,
ApplicationIdentifier = <span class="string">"Your app ID"</span>,
ApplicationVersion = <span class="string">"4.0"</span>,
<span class="comment">//your user</span>
EditorsFamilyName = <span class="string">"Santini Aichel"</span>,
EditorsGivenName = <span class="string">"Johann Blasius"</span>,
EditorsOrganisationName = <span class="string">"Independent Architecture"</span>
};
</code></pre></div>
<p>All implementations of <code>IModel</code> in xbim are <code>IDisposable</code> so you should always use them inside of <code>using</code> statement like this:</p>
<div class="csharp"><pre><code><span class="keyword">using</span> (<span class="keyword">var</span> model = <span class="type">IfcStore</span>.Open(fileName, editor))
{
<span class="comment">//...do something with the model</span>
}
</code></pre></div>
<p><code>IfcStore.Open()</code> is smart enough to recognize the file format <em>(</em>.ifc, <em>.ifczip, *.xml)</em> and IFC version <em>(IFC2x3, IFC4)</em>. Using this static function it also decides
if in-memory model or Esent database should be used to store the data. You can use additional parameter to say what you want explicitly. You
can also pass in a delegate which will report a progress. </p>
<p>You can also use following function if you want to create new model from scratch. In this case you have to specify which schema and storage should be used
because we don't know what you need and model needs to know these two things from the very beginning. Also make sure you use the right schema namespaces for the
model you created as you can't mix data from multiple schemas in a single model.</p>
<div class="csharp"><pre><code><span class="keyword">using</span> (<span class="keyword">var</span> model = <span class="type">IfcStore</span>.Create(editor, <span class="type">IfcSchemaVersion</span>.Ifc4, <span class="type">XbimStoreType</span>.InMemoryModel))
{
<span class="comment">//...do something with the model</span>
}
</code></pre></div>
<p>If you are going to create or modify anything in the model you have to use transactions. These should also be used inside of <code>using</code> statement
so they have a proper scope for eventual roll-back operation in case something happens. You have to commit transaction explicitly to keep the changes.
Transactions can't be nested so there has always be just one transaction at the time.</p>
<div class="csharp"><pre><code><span class="keyword">using</span> (<span class="keyword">var</span> txn = model.BeginTransaction(<span class="string">"Hello Wall"</span>))
{
<span class="comment">//....do something in the scope of this transaction</span>
txn.Commit()
}
</code></pre></div>
<p>All operations related to entities are accessible through <code>IModel.Instances</code>. That is your point of access to get, change and create new
entities in the model. To create any new object you use this templated function. You always have to specify a non-abstract type to create. This is
built in xbim in a way where you get a compile time error if you don't.
Every model is schema specific so it is either IFC2x3 or IFC4 or other specific schema. <code>IfcStore</code> makes it easier because it can open both IFC versions
and will tell you what it is but when you want to create data make sure you don't mess up your <code>using</code> statements. If you try to create IFC4 entity
with model initialized to IFC2x3 it will throw a runtime exception. </p>
<div class="csharp"><pre><code><span class="keyword">var</span> newWall = mode.Instances.New<<span class="type">IfcWall</span>>();
</code></pre></div>
<p>It isn't possible to create new entities in any other way than with this function. You will see in the code above that this function takes optional
typed object initializer to set up values of the object. It is not necessary to use them but I personally like it because I can see the structure of
the resulting entity. To find an entity you want you will use following functions:</p>
<div class="csharp"><pre><code><span class="keyword">var</span> firstWall = model.Instances.FirstOrDefault<<span class="type">IfcWall</span>>();
<span class="keyword">var</span> allWalls = model.Instances.OfType<<span class="type">IfcWall</span>>();
<span class="keyword">var</span> specificWall = model.Instances.Where<<span class="type">IfcWall</span>>(w => w.Name == <span class="string">"Brick wall"</span>);
</code></pre></div>
<p>You can see that all these functions are templated so they use type of the object as the first level filter. If you know the type you want you should
always specify it to increase a performance. For all search queries you can also use interfaces to retrieve entities. We have implemented <strong>IFC4 interfaces
on IFC2x3 entities</strong> which means you can query IFC2x3 and IFC4 with a <strong>single codebase</strong>. </p>
<p>Using all these basic bits and pieces your first simple code might look like this. Because it uses <code>Xbim.Ifc4.Interfaces</code> this code will work both for IFC2x3 and IFC4.</p>
<div class="csharp"><pre><code><span class="keyword">using</span> <span class="type">Xbim</span>.Ifc;
<span class="keyword">using</span> <span class="type">Xbim</span>.Ifc4.Interfaces; <span class="comment">//IFC4 interfaces are also implemented in our IFC2x3 schema implementation</span>
<span class="keyword">namespace</span> <span class="type">BasicExamples</span>
{
<span class="keyword">class</span> <span class="type">QuickStart</span>
{
<span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> Start()
{
<span class="keyword">const</span> <span class="keyword">string</span> fileName = <span class="string">"SampleHouse.ifc"</span>; <span class="comment">//this can be either IFC2x3 or IFC4</span>
<span class="keyword">var</span> editor = <span class="keyword">new</span> <span class="type">XbimEditorCredentials</span>
{
ApplicationDevelopersName = <span class="string">"You"</span>,
ApplicationFullName = <span class="string">"Your app"</span>,
ApplicationIdentifier = <span class="string">"Your app ID"</span>,
ApplicationVersion = <span class="string">"4.0"</span>,
<span class="comment">//your user</span>
EditorsFamilyName = <span class="string">"Santini Aichel"</span>,
EditorsGivenName = <span class="string">"Johann Blasius"</span>,
EditorsOrganisationName = <span class="string">"Independent Architecture"</span>
};
<span class="keyword">using</span> (<span class="keyword">var</span> model = <span class="type">IfcStore</span>.Open(fileName, editor))
{
<span class="keyword">using</span> (<span class="keyword">var</span> txn = model.BeginTransaction(<span class="string">"Quick start transaction"</span>))
{
<span class="comment">//get all walls in the model</span>
<span class="keyword">var</span> walls = model.Instances.OfType<<span class="type">IIfcWall</span>>();
<span class="comment">//iterate over all the walls and change them</span>
<span class="keyword">foreach</span> (<span class="keyword">var</span> wall <span class="keyword">in</span> walls)
{
wall.Name = <span class="string">"Iterated wall: "</span> + wall.Name;
}
<span class="comment">//commit your changes</span>
txn.Commit();
}
<span class="comment">//save your changed model. IfcStore will use the extension to save it as *.ifc, *.ifczip or *.ifcxml.</span>
model.SaveAs(<span class="string">"SampleHouse_Modified.ifc"</span>);
}
}
}
}
</code></pre></div>
</div>
<div id="invitation" class="container collapse">
<p>
Want to stay updated on xbim news and developments?
</p>
<a class="btn btn-primary" target="_blank" href="https://share.hsforms.com/1IQizWxh-SGCOQ0CQnikEJw3myli" target="_blank">Sign up for a newsletter</a>
<button class="btn btn-default" id="btn-invitation-dismiss">Dismiss</button>
</div>
<div class="brands-container">
<p><small>Some of the companies using xbim toolkit:</small></p>
<a target="_blank" href="https://www.xbim.net"><img style="height:65px;" src="img/xBim_parent_logo_white.svg" class="brand" alt="xbim ltd."></a>
<img src="img/logos/northumbria_logo_gray.png" class="brand"/>
<img src="img/logos/viewpoint_logo_gray.png" class="brand"/>
<img src="img/logos/welplan_logo_gray.png" class="brand"/>
<img src="img/logos/nbs_logo_gray.png" class="brand"/>
<img src="img/logos/bim_academy_logo_gray.png" class="brand"/>
<img src="img/logos/di5_logo_gray.png" class="brand"/>
<img src="img/logos/SEMA_logo_gray.png" class="brand"/>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
<script src="js/invitation.js"></script>
</body>
</html>