<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to extrude along a line with a triangle cross-section]]></title><description><![CDATA[<p dir="auto">While this may not be directly useful for most, it still might be interesting to show the capabilities of the Sim4Life modeler, and how to use the Python API for complex modeling.</p>
<p dir="auto">I wanted to create a triangle mesh representing the ribs but with a very low number of triangles. The Remesh tool has difficulty making the surface <strong>very</strong> coarse: typically volume loss occurs and triangles start self-intersecting. So instead I opted to draw a single triangle and extrude it along the center lines of the ribs.</p>
<p dir="auto">To draw the triangle I used the "Sketch -&gt; Lines" tool and drew three lines in a closed loop. Then I used the "Wire Tools -&gt; Cover Loops" to cover the loop and create a sheet. Finally, I converted it to a triangle mesh ("Mesh Tools -&gt; To Mesh").</p>
<p dir="auto">Then using a simple python script I extruded the triangle along each center line:</p>
<pre><code class="language-py">import XCoreMath
import XCoreModeling

Vec3 = XCoreMath.Vec3

sel = XCoreModeling.GetActiveModel().SelectedEntities
sel = XCoreModeling.CollectEntities(sel)

trimesh = [e for e in sel if isinstance(e, XCoreModeling.TriangleMesh)][0]
wires = [e for e in sel if isinstance(e, XCoreModeling.Body)]

prisms = []
for w in wires:
    len = XCoreModeling.MeasureLength([w])
    num_layers = int(len / 10.0)
    
    wire = XCoreModeling.GetWires(w)[0]
    c = wire.GetGeometry(True)
    trimesh.Transform = XCoreModeling.Transform()
    T = XCoreMath.Translation(c.Eval(0.0))
    R = XCoreMath.Rotation(Vec3(0.0, 0.0, 1.0), c.EvalTangent(0.0))
    trimesh.ApplyTransform(T * R)
    meshes = XCoreModeling.ExtrudeMesh([trimesh], w, npoints=num_layers)
    for p in meshes:
        s = XCoreModeling.ExtractUnstructuredMeshSurface(p)
        prisms.append(s)
        p.Delete()
</code></pre>
<p dir="auto"><a href="https://youtube.com/shorts/SeS0a5tCHmU" rel="nofollow ugc"><i class="fa fa-youtube" aria-hidden="true"></i> Youtube Video</a></p><div class="js-lazyYT lazyYT-container" data-youtube-id="SeS0a5tCHmU" data-width="640" data-height="360" data-parameters style="width:640px;padding-bottom:360px">
 <div class="ytp-thumbnail lazyYT-image-loaded" style="background-image:url(&quot;https://i.ytimg.com/vi/SeS0a5tCHmU/hqdefault.jpg&quot;)">
  <button class="ytp-large-play-button ytp-button" tabindex="23" aria-live="assertive" style="transform:scale(0.85)" onclick="$(this).lazyYT(this);return false;">
   <svg height="100%" version="1.1" viewbox="0 0 68 48" width="100%">
    <path class="ytp-large-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9">
    </path>
    <path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff">
    </path>
    <path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc">
    </path>
   </svg>
  </button>
 </div>
</div><p></p>
]]></description><link>https://forum.zmt.swiss/topic/579/how-to-extrude-along-a-line-with-a-triangle-cross-section</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 11:17:40 GMT</lastBuildDate><atom:link href="https://forum.zmt.swiss/topic/579.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 24 Jan 2024 15:40:35 GMT</pubDate><ttl>60</ttl></channel></rss>