![]() |
COLNEO Pro 1.2
|
Tools API interface.
This API object provides access to miscellaneous tools as well as object/domain specific tools.
It is accessed via the API object cnToolsAPI.
Functions | |
GEOMETRY | |
| ApiJsonResponse | checkOverlapObjects (QString &objId1, QString &objId2, QVariantMap &options=QVariantMap()) |
| ApiJsonResponse | checkOverlapOBB (QVariantMap &obb1, QVariantMap &obb2) |
| ApiJsonResponse | splitObjectsByPlane (QStringList &id, QVariantMap &options) |
| ApiJsonResponse | checkToplogy (QString &id, QVariantMap &options) |
| ApiJsonResponse | checkGeometry (QString &id, QVariantMap &options) |
| ApiJsonResponse | calcContactAreas (QStringList &left_objects, QStringList &right_objects, QVariantMap &options) |
| ApiJsonResponse | checkInclusions (QStringList &selectionA, QStringList &selectionB, QVariantMap &options) |
| ApiJsonResponse | checkCoincidences (QStringList &left_objects, QStringList &right_objects, QVariantMap &options) |
| ApiJsonResponse | addObjectGeometry (QString &object_a, QString &object_b, QVariantMap &options) |
| ApiJsonResponse | subtractObjectGeometry (QString &object_a, QString &object_b, QVariantMap &options) |
JSON Web Token | |
| ApiJsonResponse | createJwt (QString secret, QJsonObject payload) |
| ApiJsonResponse | getJwtPayload (QString token) |
| ApiJsonResponse | verifyJwt (QString &token, QString &secret) |
FILES JSON/CSV/TXT | |
| ApiJsonResponse | readTextFile (QString fn) |
| ApiJsonResponse | writeTextFile (QString fn, QString content) |
| ApiJsonResponse | appendToTextFile (QString handle, QString content) |
| ApiJsonResponse | closeTextFile (QString handle) |
| ApiJsonResponse | getOpenFiles () |
| ApiJsonResponse | readJsonFile (QString fn) |
| ApiJsonResponse | writeJsonFile (QString &fn, QJsonValue &jsonValue) |
| ApiJsonResponse | readCsvFile (QString fn, QVariantMap &options) |
| ApiJsonResponse | writeCsvFile (QString fn, QJsonArray jsonObj, QVariantMap &options) |
| ApiJsonResponse | readXmlFile (QString fn) |
| ApiJsonResponse | createDirectory (QString dirname) |
Dimensions | |
| ApiJsonResponse | getDimensionIds () |
| ApiJsonResponse | getDimensions () |
| ApiJsonResponse | getDimension (QString &id) |
| ApiJsonResponse | createDimension (QString &groupId, QVariantMap &data) |
| ApiJsonResponse | createDimensionGroup (QVariantMap &data) |
| ApiJsonResponse | deleteDimensions (QStringList &ids) |
| ApiJsonResponse | updateDimension (QString &id, QVariantMap &data) |
| ApiJsonResponse | deleteDimensionGroups (QStringList &ids, bool deleteContents) |
| ApiJsonResponse | setDimensionsVisible (QStringList &ids, bool visible) |
| ApiJsonResponse | createObjectFromDimension (QString &dimensionId, QVariantMap &options={}) |
|
slot |
Add object A to object Bm return new object with merged geometry.
|
slot |
|
slot |
Calculates contact areas between two selections of faceted triangle mesh objects.
IDs identify the meshes themselves; children and smart-set contents are not expanded. Meshes use common world coordinates in metres and may be open surfaces without consistent winding or enclosed volume. Self-pairs are skipped and symmetric pairs are evaluated once. Source geometry is not modified.
Contact requires surface separation no greater than distance_tolerance (metres). For pairs of closed, consistently oriented solids, intersection volume must also not exceed maximum_intersection_volume (cubic metres); such solids must not self-intersect. Both limits must be finite and non-negative. Area measures projected overlap of parallel faces within tolerance, counting overlapping projections once per surface. Faces must oppose each other only when both meshes are closed solids; otherwise surfaces are two-sided and either winding is accepted. Point/edge contacts and nonparallel faces contribute zero area.
The treatment option accepts:
ignore: return no contact results.clash: report contacts with is_clash set to true.separate_result (default): report contacts with is_clash set to false.The degenerate_triangle_handling option accepts ignore (default), which skips zero-area triangles, or prevent_calculation, which reports an error for an affected object and excludes its pairs. The remaining valid triangles are used even if they form an open surface. Invalid indices, non-finite triangle geometry and meshes with no remaining valid triangles still produce errors. Source meshes are not modified.
Set include_contact_geometry to true (default false) to also return contact_geometry_a and contact_geometry_b in each contact result. These mesh objects lie on the respective source surfaces and use flat vertices [x, y, z, ...] in world metres and triangles [i0, i1, i2, ...] with zero-based indices. Geometry covers the measured areas; zero-area contacts return empty arrays. The option consumes additional work and response memory. Generated triangles collapsing at world-coordinate precision are discarded from both area measurements and geometry, independently of the input degenerate_triangle_handling policy. With contact_geometry_output set to json (default), the object structure is unchanged. With object_structure and include_contact_geometry true, non-empty patches become Object3d surfaces in a new "Contact areas" Design model, using the configured contact style. Source objects remain in their original models. data.contact_model_id identifies the new model. Results contain contact_object_a_id/contact_object_b_id instead of contact_geometry_a/contact_geometry_b. New objects have fresh IDs and class-defined properties. Source properties, type assignments, links and relations are not copied; the objects belong to the new contact model and use the configured contact style. Equivalent patches within a pair share one object; both IDs then match and contact_geometry_shared is true. Opposite winding or different triangulations do not prevent deduplication; numerical plane tolerance and relative area tolerance 1e-9 apply. Empty patches create no object and have no object IDs; if all patches are empty, no model is created. Only complete calculations are published; preparation failures return 422 and leave the structure unchanged. Repeated calls create separate models. Disabled geometry creates no model or objects.
style accepts id, name and color strings and defaults to { "id": "contact", "name": "ContactStyle", "color": "#3aa5ff" }. Colors use #rrggbb or #rrggbbaa with alpha last. Missing style fields retain defaults. New objects use this persistent facet style. Matching repository styles are reused; a conflicting style ID returns 409 without changing existing styles. Invalid style fields return 400 in object-structure mode. JSON mode does not create or modify styles.
Example options (the defaults allow 2 mm separation and 1 mm3 intersection):
Example call with repository object IDs:
Calculation data contains results, errors, complete, checked_pairs and failed_pairs. data.used_options contains the effective options, including defaults, on success and errors; before calculation starts it describes the settings prepared for the request. Each result identifies selection_a_index/selection_b_index and object_a_id/object_b_id, and includes surface_distance, is_clash and contact_area_a/contact_area_b in square metres. contact_area is the mean of the two surface areas, counting an ordinary shared interface once. Contacts may have zero area. Inspect complete and errors before treating an empty result list as absence of contact. volume_a/volume_b are reported only for the respective closed solid; intersection_volume and intersection_ratio are omitted when either mesh is an open surface, and its volume limit does not apply.
| left_objects | IDs of the first mesh selection. |
| right_objects | IDs of the second mesh selection. |
| options | Settings accepted by gom::ContactOptions; omitted fields retain their defaults. |
|
slot |
Detects geometrically coincident objects between two selections using Project::checkCoincidences(). Selections resolve to triangle meshes with finite coordinates and valid indices. Open surfaces and either winding are supported; closed topology and volume are unnecessary. Zero-area triangles are ignored; meshes with no remaining valid triangles produce errors. Source objects are unchanged. Self-pairs are skipped and symmetric pairs are reported once. Geometry failures are reported by object ID while other pairs continue, subject to the shared geometry work and candidate limits.
| left_objects | Object IDs for selection A; smart sets are not expanded. |
| right_objects | Object IDs for selection B; smart sets are not expanded. |
| options | gom::CoincidenceOptions map. Omitted keys retain these defaults:
|
|
slot |
Checks the geometric validity of one faceted triangle mesh object.
The identified object itself must be a faceted triangle mesh; child objects are not included. Checks are cumulative according to the selected level.
Example options:
A successful request returns status 200 and data.valid. Invalid geometry is described in message and as individual strings in data.issues. Invalid options return status 400.
| id | ID of the faceted triangle mesh object to check. |
| options | Geometry options in the format accepted by geometry::GeometryCheckOptions. |
|
slot |
Checks containment between objects in selectionA and selectionB, in both directions by default. Selections contain object IDs resolving to triangle meshes. Only the potential container needs valid closed solid geometry; all vertices of the inner object are tested, regardless of its triangle topology. Invalid containers produce errors by ID while other checks continue. Returns each matching pair; an object contained in several objects produces several results. Source objects are unchanged. Options use gom::InclusionOptions keys. direction defaults to "either", checking A inside B and B inside A; explicit "a_inside_b" or "b_inside_a" values restrict the check. boundary_tolerance defaults to 0.002 metres. containment_threshold is validated and echoed but unused here: every vertex must pass the containment test. Edges/faces extending outside concave containers are not tested. Empty/non-finite inner vertex sets do not match.
|
slot |
Tests whether two oriented bounding boxes (OBBs) overlap.
This function checks if two oriented bounding boxes intersect in 3D space using the Separating Axis Theorem (SAT). Each bounding box is expected to be provided in JSON containing the box parameters:
Example input:
| obb1 | The first oriented bounding box (JSON). |
| obb2 | The second oriented bounding box (JSON). |
Example JSON response:
|
slot |
Checks if two objects overlap and gives the overlap amounts.
This function determines whether the minimal oriented bounding boxes in 3D space of two objects intersect and provides a simple measure of how much they overlap.
| objId1 | ID of the first object |
| objId2 | ID of the second object |
| options | Optional options {
"precheck": true, // If true (default), an axis-aligned bounding box check is performed before the OOBB check.
"tolerance": 0.1 // Allowed overlap [m]
}
\return Coverages: fraction of each OBB that is overlapped by the other.
- 0.0 means no overlap
- 1.0 means fully covered
Example JSON response:
\code
{
"overlap": true,
"min_overlap": 0.178277, // smallest overlap distance
"coverage_obb1": 0.057161, // fraction of OBB1 volume overlapped by OBB2
"coverage_obb2": 0.114563 // fraction of OBB2 volume overlapped by OBB1
}
|
|
slot |
Checks the topology of one faceted triangle mesh object.
The identified object itself must be a faceted triangle mesh. Child objects are not included. The selected validation level is cumulative.
Example options:
Supported levels are triangle_validity, topological_manifold, geometric_validity, and solid_validity. For this topology check, levels from topological_manifold onward enable the manifold checks.
Example response:
If validation fails, message describes every detected issue and data.issues contains the individual explanations. For example:
| id | ID of the faceted triangle mesh object to check. |
| options | Topology options in the format accepted by geometry::TopologyCheckOptions. |
|
slot |
Close an currently opend file.
|
slot |
Creates a dimension from an API-specific geometry description.
Required members are type and geometry. Optional members are name, comment, and style. Supported types are point, linear, angle, polygon, clearance, area, and volume.
Example creation data:
An empty parentId creates the dimension at the root level. The parent is a structural argument and must not be included as parent_id in data.
| groupId | ID of the parent dimension group, or an empty string for the root. |
| data | Dimension creation data. |
|
slot |
Creates a dimension group.
Example creation data:
An empty or omitted parent_id creates a top-level group.
| data | Object containing name and optional comment and parent_id. |
Example response data:
|
slot |
Create directory relative to project directory
| dirname | Directory name, relative to project directory. |
|
slot |
Create JSON web token using secret for encoding.
| payload | Any JSON object to be encoded using 'secret' |
|
slot |
Creates independent design geometry from a permanent dimension.
Point dimensions create an ObjectPoint, linear, clearance, angular and polygon dimensions create an ObjectLines, and area dimensions create an Object3d. Volume dimensions are not supported yet.
Without a parent, an existing DesignModel named "Dimensions" is used or created when none exists. A supplied parent must be a model or container in the design domain. Source colors are copied into independent styles and do not link the new object to source styles.
| dimensionId | ID of the permanent dimension. |
| options | Optional object creation settings: {
"parent_id": "optional-design-model-or-container-id",
"color": "dimension"
}
|
|
slot |
Deletes or dissolves dimension groups.
If deleteContents is false, the contained entries are moved to the respective parent group before the groups are removed.
| ids | IDs of the groups. |
| deleteContents | true to delete contained entries; false to move them to the parent. |
|
slot |
Deletes dimensions from the current project.
| ids | IDs of the dimensions to delete. |
|
slot |
Returns a dimension by ID.
The following example shows the relevant members of the QVariantMap in data. The item member contains the runtime serialization of the DimensionItem and is shown only in part.
| id | ID of the dimension. |
|
slot |
Returns the IDs of all dimensions in the current project.
|
slot |
Returns all dimensions in the current project.
This batch operation avoids a separate API call for every dimension ID.
|
slot |
Decode JWT and return payload.
|
slot |
Get list of currently opened files.
|
slot |
Read CSV text file.
| fn | Filename, absolute path or relative to project directory |
| options | Definition gom.options.h:1723 |
|
slot |
Read file whicj contains data in JSON format and return JSON objects
|
slot |
|
slot |
Read XML file and convert it to JSON
|
slot |
Shows or hides dimensions.
| ids | IDs of the dimensions whose visibility is changed. |
| visible | true to show the dimensions; false to hide them. |
Example response data:
|
slot |
Split object by a given clipping plane into two or more pieces.
| id | Object ID |
| options | Options such as clipping plane {
geometry::CuttingObjectsOptions
}
|
|
slot |
Subtract object B from object A
|
slot |
Updates the editable metadata of a dimension.
Only the members name, comment, and style are accepted. All members are optional, but at least one must be supplied. Geometry, type, ID, and visibility cannot be changed by this method. Visibility is controlled by its dedicated method.
Example update data:
| id | ID of the dimension to update. |
| data | Object containing one or more of name, comment, and style. |
|
slot |
Check if JWT is valid using 'secret'
|
slot |
Write a CSV file from a list of JSON objects
| options | {
"columns" : [ // default object members/keys
{ "A" : "abc" },
{ "B" : "xyz" },
{ "C" : "ghj" }
],
"separator" : "," // default : ','
}
|
|
slot |
Write JSON object to file
| fn | Filename, either relative (to project directory) or absolute filepath |
| jsonValue | Object or Array in JSON format |
|
slot |
Write text to file
| fn | Filename, either relative (to project directory) or absolute filepath |
| content | UTF-8 encoded text |