Original Message:
Sent: 06-30-2026 17:53
From: Ronny Schneider
Subject: quick way to shrink-wrap a bunch of PolySegs?
Thanks Bryce,
that worked and is faster, I had always wondered how to triangulate without creating a Model3D in worldview.
Creating the Gem with a dedicated ModelType seems key here.
I wonder what ModelType.Solid does, is it for triangulating IFC mesh objects?
I'm able to add vertices and breaklines to a Gem(Gem.ModelType.Solid)
But that one fails upon calling gem.ConstructSurface() with "Vertex could not be located during construction"
If that's not the way to do it, how do you triangulate a 3D IFC Meshes from just breaklines and vertices?
------------------------------
Ronny Schneider
------------------------------
Original Message:
Sent: 06-30-2026 11:04
From: Bryce Haire
Subject: quick way to shrink-wrap a bunch of PolySegs?
Here's the bulk majority of shrink wrap.
var entities = m_SourceSelection.SelectedMembers(proj); var entityGroups = entities.OfType<ISnapIn>().GroupBy(x => ISnapInHelpers.GetViewSite(x, out ISnapIn _)).ToList(); var settings = Trimble.Vce.Gem.Model3DCompSettings.ProvideSettingsObject(proj); proj.TransactionManager.AddBeginMark(CommandGranularity.Command, Caption); foreach (var entiryGrpup in entityGroups) { IMemberManagement mm = null; var gem = new Gem(Gem.ModelType.Dtm); gem.MaxOuterLength = d; foreach (var entity in entiryGrpup) { if (mm == null) ISnapInHelpers.GetMemberManagement(entity, out mm); if (entity is IPolyseg ip) { int iVertexLast = -1; var poly = ip.ComputePolySeg(); if (poly == null || poly.NumberOfNodes < 2) continue; poly = poly.Linearize(settings.HorzProximityTolerance, double.MaxValue, double.MaxValue, null, false); var points = poly.Point3Ds(); foreach (Point3D point in points) { var z = double.IsNaN(point.Z) ? 0 : point.Z; var p = new Point3D(point.X, point.Y, z); var iVertex = gem.AddVertex(false, GemVertexType.Control, 0, ref p); if (iVertexLast >= 0) gem.AddBreakline(false, 0, iVertexLast, iVertex); iVertexLast = iVertex; } } else if (entity is Vce.Interfaces.Point.IPointLocation pl) { var p = pl.Position; if (double.IsNaN(p.Z)) p.Z = 0; gem.AddVertex(false, GemVertexType.Control, 0, ref p); } } gem.ConstructSurface(); var pts = gem.ExtractOutlines(); if (pts.Count < 3) return; using (var tr = new TransactMethodCall(proj.TransactionCollector)) { try { Linestring lineString = mm.Add(typeof(Linestring)) as Linestring; lineString.Layer = m_layer.SelectedSerialNumber; var poly = new PolySeg(); var array = pts.ToArray(); for (int i = 0; i < array.Length; i++) { var p = array[i]; if (p.Z == 0) { p.Z = double.NaN; array[i] = p; } } poly.Add(pts.ToArray()); lineString.Append(poly, null, false, false); tr.Commit(); } catch (Exception) { clientSupport.MessageBoxService.ShowError(StringTable.CreateRectangle_Error_Adding_Rectangle_To_Container); return; } } }
Hopefully this helps.
------------------------------
Bryce Haire
------------------------------