Table of Contents

Class AptProfile

Namespace
Hi.Milling.Cutters
Assembly
HiMech.dll

Represents an APT (Automatically Programmed Tool) based profile for a milling cutter. This profile uses APT definitions to describe the cutter geometry.

public class AptProfile : IShaperProfile, IMakeXmlSource, IAbstractNote, IGetZrList, IGenStl, IDuplicate, IGetSelectionName, IGetInitStickConvex, IVolumeRemover, IDisposable, IUpdateByContent, IClearCache
Inheritance
AptProfile
Implements
Inherited Members
Extension Methods

Constructors

AptProfile()

Initializes a new instance of the AptProfile class.

public AptProfile()

AptProfile(IAptBased)

Initializes a new instance of the AptProfile class.

public AptProfile(IAptBased apt)

Parameters

apt IAptBased

The APT-based object.

AptProfile(XElement, string, IProgress<IMessage>)

Initializes a new instance of the AptProfile class.

public AptProfile(XElement src, string baseDirectory, IProgress<IMessage> progress)

Parameters

src XElement

XML element containing the profile configuration.

baseDirectory string

The base directory for resolving relative paths.

progress IProgress<IMessage>

Progress reporter for diagnostic messages emitted during construction.

Properties

AbstractNote

Gets the abstract note from the APT definition.

public string AbstractNote { get; }

Property Value

string

Apt

Gets or sets the APT-based definition for the profile.

public IAptBased Apt { get; set; }

Property Value

IAptBased

DefaultAngleResolution_rad

Gets or sets the default angle resolution in radians.

public static double DefaultAngleResolution_rad { get; set; }

Property Value

double

DefaultLinearResolution_mm

Gets or sets the default linear resolution in millimeters.

public static double DefaultLinearResolution_mm { get; set; }

Property Value

double

RefusesGeometry

Whether the APT refuses its flute geometry (see RefusesGeometry): GenStl(IPolarResolution2d), GetZrList() and GetInitStickConvex() are then all null, so the cutter has no flute envelope. false without an APT.

public bool RefusesGeometry { get; }

Property Value

bool

SelfAgreementNote

Why the APT does not agree with itself, or null when it does (or there is no APT); see SelfAgreementNote. ReportShaperProfileIssues(IProgress<IMessage>, object) turns it into the engine message.

public string SelfAgreementNote { get; }

Property Value

string

XName

Name for XML IO.

public static string XName { get; }

Property Value

string

Methods

ClearCache()

Clears all cached data: gives the profile's share of its stick convex back. The native convex is freed with it unless a subtraction holds a share, in which case that step's give-back frees it; the next GetInitStickConvex() builds a new one. The field is taken with an exchange, so two concurrent clears give one share back once.

public void ClearCache()

Dispose()

Disposes of all resources.

public void Dispose()

Dispose(bool)

Disposes of unmanaged resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

True if disposing, false if finalizing

Duplicate(params object[])

Creates a deep copy of the object, excluding any source file references.

public object Duplicate(params object[] res)

Parameters

res object[]

Optional parameters that may be needed during the duplication process

Returns

object

A new instance that is a deep copy of the original object

GenStl(IPolarResolution2d)

Generates a new STL.

public Stl GenStl(IPolarResolution2d resolution)

Parameters

resolution IPolarResolution2d

Polar resolution

Returns

Stl

A newly created STL.

GetInitStickConvex()

A share of the profile's stick convex, which the caller owns and gives back with Dispose() (a using; the subtraction keeps it on its GeomBoolCache, which gives it back when the step is done): the native object is built on the first call after a ClearCache(), held by the profile as its cache and shared by every call until the next one, and freed by the last share given back – so a ClearCache() while a step is subtracting with the convex frees nothing until that step is done. Lock-free: a caller that read a share the concurrent ClearCache() has just taken back reads again and gets the next one. null when there is no APT or the APT RefusesGeometry. A refused APT never reaches the native side: an apt_t built from a sharp-cornered profile whose corner is off the bottom line carries an infinite bottom-cone radius into the stick convex, which the step-by-step subtraction path then removes from the stock far from the cutter (the BCAM blade Showcase case). On null the consumer (MachiningVolumeRemovalProc.StepGetGeomBoolCache) subtracts the cutter's triangle mesh instead, as it does for every non-APT cutter; a refused APT, or a profile with no APT at all, has no sweptable either and removes no material. In cloud mode (CloudTokenProvider set) the native object is imported from the cloud licence server's signed token (TryCreate(IGetGeneralApt, out string)), and null is also the shape the server has not provided (offline, no valid lease); such a null is not remembered here – every call asks again, the cloud client's negative cache bounding the cost to a lookup – and the consumer then removes no material rather than sweeping triangles (GetInitStickConvex(out string) says why).

public InitStickConvex GetInitStickConvex()

Returns

InitStickConvex

A share of the stick convex the caller owns, or null

GetInitStickConvex(out string)

GetInitStickConvex() with the reason there is no share: the cloud token provider's (offline, no valid lease, the server refused the shape) or core's refusal of the token in words, as TryCreate(IGetGeneralApt, out string) gives it; null when a share is returned, and when there is no APT or the APT RefusesGeometry (nothing was asked for). The warn point at a tool change (MachiningActRunner.WarnIfCurrentToolStickConvexUnavailable) reads it.

public InitStickConvex GetInitStickConvex(out string problem)

Parameters

problem string

Why there is no share, or null.

Returns

InitStickConvex

A share of the stick convex the caller owns, or null

GetSelectionName()

Gets the display name for selection.

public string GetSelectionName()

Returns

string

The display name

GetZrList()

Gets the ZR contour list for the profile.

public List<PairZr> GetZrList()

Returns

List<PairZr>

The list of ZR pairs

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

Reg(XFactory)

Registers this type's deserializer with the given XFactory and chains Reg(factory) on dependents. Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory

UpdateByContent()

Updates the profile based on content changes.

public void UpdateByContent()