Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Issues setting a Brep's Trim's domains using CreatePlanarBreps

$
0
0

I’m having an issue using CreatePlanarBreps, specifically regarding the Trims’ domains, as they appear to be not customizable/not able to be set.

Formally: Given an inputBrep with its list of Trims where each Trim has a Domain D[i], I’d like to create another (planar) brep using the Rhino Common method CreatePlanarBreps where in the resulting brep’s list of trims- each trim’s domain is D[i], the same D[i] as is in the input brep.

This one liner does not transfer the Trims’ domains. The resulting Brep’s Trims contain different domains from the input Brep’s Trims. (Note: I’m using a unit sphere as my inputBrep)

var result = Brep.CreatePlanarBreps(inputBrep.Trims, 1e-3)[0];

So I tried to explicitly set the domains using this code. This also does not work. The two breps’ Trims’ domains are different.

var trims = inputBrep.Trims.Select(trim => trim.DuplicateCurve()).ToList();
for (int i = 0; i < trims.Count; i++) trims[i].Domain = inputBrep.Trims[i].Domain;
// by this point the code has worked, all curves have the correct domain,
// but CreatePlanarBreps appears to ignore the domains of the input curves
// and appears to generate new domains for the Trims.
var result = Brep.CreatePlanarBreps(trims, epsilon)[0];

Once a Brep is created it also appears to be impossible to set its Trims’ domains. This also does not work:

for (int i = 0; i < result.Trims.Count; i++) result.Trims[i].Domain = inputBrep.Trims[i].Domain;

I was hoping it was possible to end up with two breps whose Trims’ domains matched, for example, being able to use this method Trim.GetTrimParameter to precisely transfer points between matching Breps’ boundaries. Is it possible to set a Brep’s Trims’ domains?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles