<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Forum Bauen und Umwelt - BIMPython</title>
<link>https://bauforum.wirklichewelt.de/</link>
<description>Das Bauforum</description>
<language>de</language>
<item>
<title>BIMPython</title>
<content:encoded><![CDATA[<p>Seit Version V21 wird das CAD-Programm BricsCAD mit einem integrierten Pythoninterpreter ausgeliefert und ermöglicht über den Befehl BIMPYTHON die Ausführung von Pythonprogrammen direkt im CAD-System.<br />
Pythonprogramme, die in BricsCAD ausgeführt werden, müssen lediglich das Modul „bricscad.bim“ importieren, um Zugriff auf die Programmierschnittstelle (API) und damit auf die Objekte in der Zeichnungsdatei zu erhalten.<br />
</p>
<pre class="python" style="font-family:monospace;"><ol><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> bricscad.<span style="color: black;">bim</span> <span style="color: #ff7700;">import</span> current_model</div></li></ol></pre><p><br />
Eine Übersicht über die vorhandenen Funktionen liefert die <a href="https://help.bricsys.com/document?title=_guides/BIM_building_data/GD_usingpythonscripts.html" target="_blank" rel=\"noopener\">Webseite der BricsCAD-Hilfe</a>. <br />
Derzeit (April 2023) enthält die API nur lesende Funktionen für BIM-Objekte und schreibende Funktionen für einige ausgewählte Eigenschaften von diesen, sodass Pythonscripte innerhalb von BricsCAD nicht in der Lage sind, Zeichnungsobjekte ohne den Umweg über Scriptdateien zu erzeugen oder deren geometrische Eigenschaften zu bearbeiten. Ein Zugriff auf geometrische Grundelemente ohne BIM-Eigenschaften ist gar nicht möglich.<br />
Das folgende Pythonprogramm gibt aus, welche BIM-Eigenschaften der Zeichnung, aus der heraus es mittels BIMPYTHON gestartet wird, von ihm geändert werden können:<br />
</p>
<pre class="python" style="font-family:monospace;"><ol><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">from</span> bricscad.<span style="color: black;">bim</span> <span style="color: #ff7700;">import</span> current_model<span style="color: #000;">,</span> list_properties</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808;">print</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;Folgende BIM-Objekte sind in dieser &quot;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #080;">&quot;Zeichnung vorhanden:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Eigenschaften <span style="color: #000;">=</span> <span style="color: #808;">set</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">for</span> Objekt <span style="color: #ff7700;">in</span> current_model<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #808;">print</span><span style="color: black;">&#40;</span>Objekt<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #ff7700;">for</span> Eigenschaft <span style="color: #ff7700;">in</span> list_properties<span style="color: black;">&#40;</span>Objekt<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Wert <span style="color: #000;">=</span> Objekt.<span style="color: black;">get_property</span><span style="color: black;">&#40;</span>Eigenschaft<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #ff7700;">for</span> x <span style="color: #ff7700;">in</span> <span style="color: black;">&#40;</span><span style="color: #008;">0</span><span style="color: #000;">,</span> <span style="color: #008;">1</span><span style="color: #000;">,</span> <span style="color: #080;">&quot;x&quot;</span><span style="color: #000;">,</span> <span style="color: #080;">&quot;u&quot;</span><span style="color: #000;">,</span> <span style="color: #008;">0.1</span><span style="color: #000;">,</span> <span style="color: #008;">1.0</span><span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            Objekt.<span style="color: black;">set_property</span><span style="color: black;">&#40;</span>Eigenschaft<span style="color: #000;">,</span> x<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            w <span style="color: #000;">=</span> Objekt.<span style="color: black;">get_property</span><span style="color: black;">&#40;</span>Eigenschaft<span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #ff7700;">if</span> Wert <span style="color: #000;">!=</span> x <span style="color: #ff7700;">and</span> w <span style="color: #000;">==</span> x:</div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">                Eigenschaften.<span style="color: black;">add</span><span style="color: black;">&#40;</span>f<span style="color: #080;">&quot;{Eigenschaft} {type(w)}&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        Objekt.<span style="color: black;">set_property</span><span style="color: black;">&#40;</span>Eigenschaft<span style="color: #000;">,</span> Wert<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808;">print</span><span style="color: black;">&#40;</span><span style="color: #080;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>Folgende Eigenschaften dieser Objekte können &quot;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #080;">&quot;verändert werden:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7700;">for</span> e <span style="color: #ff7700;">in</span> <span style="color: #808;">sorted</span><span style="color: black;">&#40;</span>Eigenschaften<span style="color: black;">&#41;</span>:</div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #808;">print</span><span style="color: black;">&#40;</span>e<span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808;">print</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808;">print</span><span style="color: black;">&#40;</span><span style="color: #808;">len</span><span style="color: black;">&#40;</span>current_model<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #000;">,</span> <span style="color: #080;">&quot;Objekte gefunden.&quot;</span><span style="color: black;">&#41;</span></div></li><li style="background:#f5f5f5;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808;">print</span><span style="color: black;">&#40;</span><span style="color: #808;">len</span><span style="color: black;">&#40;</span>Eigenschaften<span style="color: black;">&#41;</span><span style="color: #000;">,</span></div></li><li style="background:#f9f9f9;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #080;">&quot;veränderbare Eigenschaften entdeckt.&quot;</span><span style="color: black;">&#41;</span></div></li></ol></pre>]]></content:encoded>
<link>https://bauforum.wirklichewelt.de/index.php?id=11756</link>
<guid>https://bauforum.wirklichewelt.de/index.php?id=11756</guid>
<pubDate>Wed, 26 Apr 2023 09:53:34 +0000</pubDate>
<category>Software</category><dc:creator>Martin Vogel</dc:creator>
</item>
</channel>
</rss>
