Table of Contents

Method TrySubtractAll

Namespace
GeometryHelper.Core
Assembly
GeometryHelper.dll

TrySubtractAll(GeoSolid3, IEnumerable<GeoSolid3>, out GeoSolid3, SolidBooleanOptions, out SubtractReport)

Takes bodies out of a solid one after another as the options say, each result checked, and says what it did.

public static bool TrySubtractAll(GeoSolid3 subject, IEnumerable<GeoSolid3> tools, out GeoSolid3 result, SolidBooleanOptions options, out SubtractReport report)

Parameters

subject GeoSolid3

The body to cut material from.

tools IEnumerable<GeoSolid3>

The bodies to take away, in the order they are taken.

result GeoSolid3

What is left of the subject; null when a tool took all of it.

options SolidBooleanOptions

How each difference is worked out.

report SubtractReport

Which tools were taken away, which within the fallback, and which could not be.

Returns

bool

false when a tool took all that was left; true otherwise, whatever was skipped.

Remarks

Each cut is the one TrySubtract(GeoSolid3, GeoSolid3, out GeoSolid3, SolidBooleanOptions, out BooleanOutcome) works out, and its result is checked by Validate(Tolerance) within the options' tolerance whether or not there is a fallback. A cut whose result is not valid, within the tolerance or the fallback, or which could not be worked out, is skipped: the body is kept as it was before it, and what the tool would have taken stays in the result, which is better than a body with the wrong volume. The report says which. A cut that leaves no more than a slab the tolerance thick, as Validate reads it, leaves nothing, as Empty says, and ends the run as a tool that takes all does.

This is the net body of a part of a model, cut by every part it meets: of the 79 864 parts of a Tekla model so cut within a thousandth, 180 had a cut skipped, 323 cuts in all; with a contact of a hundredth, 109 and 196; with a fallback of a hundredth as well, 19 and 38, and 136 cuts were taken within the fallback.

Exceptions

ArgumentNullException

Thrown when the subject, the tools or the options are null.

ArgumentException

Thrown when one of the tools is null.

TrySubtractAll(GeoSolid3, IEnumerable<GeoSolid3>, out GeoSolid3, SolidBooleanOptions, SolidClosingOptions, out SubtractReport)

Takes bodies out of a solid one after another as the options say, each result checked, as TrySubtractAll(GeoSolid3, IEnumerable<GeoSolid3>, out GeoSolid3, SolidBooleanOptions, out SubtractReport) does; and closes a cut that one would skip, by TryClose(out GeoSolid3, SolidClosingOptions, out SolidClosing3), where that closes it and the body closed holds what the cut can leave.

public static bool TrySubtractAll(GeoSolid3 subject, IEnumerable<GeoSolid3> tools, out GeoSolid3 result, SolidBooleanOptions options, SolidClosingOptions closing, out SubtractReport report)

Parameters

subject GeoSolid3

The body to cut material from.

tools IEnumerable<GeoSolid3>

The bodies to take away, in the order they are taken.

result GeoSolid3

What is left of the subject; null when a tool took all of it.

options SolidBooleanOptions

How each difference is worked out.

closing SolidClosingOptions

How a cut that would be skipped is closed.

report SubtractReport

Which tools were taken away, which within the fallback, which closed, and which could not be.

Returns

bool

false when a tool took all that was left; true otherwise, whatever was skipped.

Remarks

Every cut the other overload takes is taken here the same, bit for bit. Only a cut it would skip, whose result is valid neither within the options' tolerance nor within the fallback, is closed: the result worked out within the tolerance first, the tool put onto the body as the contact says; where that does not close, the result worked out within the fallback, where there is a fallback and it gave a body. A cut that could not be worked out at all, giving no body, is skipped as before, and so is one neither result of which closes.

No cut is closed where the body before it, or the tool as put onto it, carries openings: such a cut is skipped as without closing. Cut out of a body not closed, an opening takes material before any closing can: a box cracked open, with an opening, holds 5 400 of material where the whole box with it holds 5 640, and its cut by a post closed to 5 160 where 5 400 is right.

A body closed is taken only where it is valid within the options' tolerance as well as within the closing's, both checks passing whichever tolerance is the finer; and where it holds what a difference can leave: no more than the body before the cut, and no less than that less the whole of the tool, each within the options' point tolerance times the area of the two, and a hair more for the rounding. A closed body holding more or less is refused, and the next tried or the cut skipped; RefusedByVolume says which cuts were skipped so. The volumes are read by the faces, as the check of a boolean reads them, so a body before the cut that is not valid, as one with a face given twice, can refuse a closing that is right: the bound errs on the side of skipping.

A subject not valid as given leaves its first cut that would be skipped not valid either, whether or not the tool reaches it, and that cut is closed: a tool clear of the body takes nothing, and the closing closes the subject itself there.

Of the 35 cuts that 17 parts of a Tekla model left skipped, cut within a thousandth with a contact and a fallback of a hundredth, closing the result within the thousandth with a gap of 0.005, holes up to 100 and 0.01 out of flat closed 23, each within 2.1E-6 of what the cut within the hundredth holds.

Exceptions

ArgumentNullException

Thrown when the subject, the tools, the options or the closing options are null.

ArgumentException

Thrown when one of the tools is null.