Anark Core SDK
Loading...
Searching...
No Matches
Anark.CoreSdkApi.ISdkApi Interface Reference

The SDK API. More...

Inheritance diagram for Anark.CoreSdkApi.ISdkApi:
Anark.CoreSdkApi.SdkApi

Public Member Functions

SdkAnnotationInfo AddAnnotation (ISdkAnnotation annotation, ISdkVertex3D location, ISdkVector3D orientation, ISdkVector3D planeNormal, float scale, float layerDepthFactor=0.0001f)
 Add an annotation.
void RemoveMyAnnotations (ISdkEntityHandle[] annotationHandles)
 Removes annotations that have been created by your plug-in. This will not remove annotations from the imported 3D data and this will not remove annotations created by other plug-ins. This will remove the annotations from all user-defined views.
void AddVisibleOccurrencesToView (ISdkView view, IEnumerable< ISdkEntityHandle > handles)
 Show specified 3D entities in a view that has been authored in Anark Core Workstation. This replaces any prior set of 3D entities for the specified view that were previously made visible in a call to AddVisibleOccurrencesToView with the current set of 3D entity handles (i.e. this method cannot be used to incrementally add an additional visibility state). Visibility states that were specified by Anark Core Workstation users will be retained (not overwritten). The modifications will be retained in the Anark Core Recipe. Limitations: the view cannot be an imported view, and the entities to make visible must be entities that have been created via this SDK API.
ISdkView[] GetViews ()
 Get all views.
int GetViewUpdateCount (ISdkView view)
 Gets the view update count, which is a counter that is incremented whenever there is any update to a view. It can be used for an incremental update mechanism where you only update views that have changed, by comparing this number against the value at your last plug-in execution.
void AddUserEditableView (ISdkView view)
 Adds a new view to the list of user-authored views. Will throw an exception if you target entities under collapsed assemblies or add a view with a duplicate name.
string[] GetAttributeNames (SdkEntityType entityType)
 Get the available attribute names for a specified entity type.
ISdkEntityHandle[] Search (ISdkQueryExpression query, SdkEntityType resultEntityType=SdkEntityType.Invalid)
 Search for entities with a query expression. This returns the same results as the Query functionality in Anark Core Workstation.
object GetEntityAttribute (ISdkEntityHandle entityHandle, string attributeName)
 Get an attribute value from an entity.
void SetEntityAttribute (ISdkEntityHandle entityHandle, string attributeName, object attributeValue)
 Set an entity attribute value. Creates a new attribute if the attribute does not already exist.
object GetWorkspaceAttribute (string attributeName)
 Get a workspace attribute value.
void SetWorkspaceAttribute (string attributeName, object attributeValue)
 Add or overwrite a workspace attribute value.
void RemoveMyAttributes ()
 Removes all attributes that were created by the caller. Includes workspace attributes and attributes in other entities. Does not revert any attribute values that have been set for attributes that were not created by the caller.
ISdk3DBoundingBox GetBoundingBox (ISdkEntityHandle entityHandle)
 Gets the 3D bounding box of a part or annotation, in the local coordinate system of the part or annotation.
ISdkVertex3D[] GetPartVertices (ISdkEntityHandle entityHandle)
 Gets the 3D mesh points for a part. Note that this can be a relatively expensive operation - see GetBoundingBox if you only need the part bounding box. The points are returned in the part's local coordinate system.
Dictionary< ISdkEntityHandle, float > FindObjectsByLocation (IEnumerable< ISdkEntityHandle > visibleEntities, ISdkVertex3D objectLocation, float maxDistance=float.MaxValue, SdkEntityType resultEntityType=SdkEntityType.Component)
 Provides a point-to-solid interference clash test to identify parts or part occurrences in which a specific point is located. Identifies all objects that are nearer than maxDistance from objectLocation and their associated observed distances.
ISdkMatrix4X4 GetTransform (ISdkEntityHandle entityHandle)
 Gets the current 3D transform for a part or assembly instance.
void SetTransform (ISdkEntityHandle entityHandle, ISdkMatrix4X4 transformMatrix)
 Updates the 3D transform on a part or assembly instance.
ISdk3DGeometry GetGeometry (ISdkEntityHandle entityHandle)
 Gets the geometric representation of a Supplemental Geometry Definition or Occurrence Given a Supplemental Definition Entity, Local coordinates will be returned. Given a Supplemental Geometry Occurrence, Global coordinates for that particular occurrence will be returned.
ISdkEntityHandle[] ConvertEntityHandles (ISdkEntityHandle[] sourceHandles, SdkEntityType targetEntityType)
 Follows the object references to "convert" entity handles to the desired target entity type. For example, you can convert a component occurrence handle to a component instance and/or a component. The reverse is not true because it is often ambiguous. This can be useful if you have search results for component instances and you need to reference the actual component (part/assembly) for one or more of those instances. Also applies to PMI, etc.

Detailed Description

The SDK API.

Member Function Documentation

◆ AddAnnotation()

SdkAnnotationInfo Anark.CoreSdkApi.ISdkApi.AddAnnotation ( ISdkAnnotation annotation,
ISdkVertex3D location,
ISdkVector3D orientation,
ISdkVector3D planeNormal,
float scale,
float layerDepthFactor = 0.0001f )

Add an annotation.

Parameters
annotationThe annotation to add - the origin of the 2D coordinate system of the annotation will be placed relative to the specified location.
locationThe annotation's location in 3D space.
orientationThe orientation vector of the annotation - this is relative to the specified location.
planeNormalThe normal of the plane in which the annotation exists.
scaleThe scale to apply to the annotation geometry. 1.0f is 100% (no change), 2.0f will scale the annotation twice as large, etc.
layerDepthFactorThe difference in depth between layers of geometry, as a proportion of the geometry's total height. 0.0001 by default
Returns
Information about the newly created annotation.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ AddUserEditableView()

void Anark.CoreSdkApi.ISdkApi.AddUserEditableView ( ISdkView view)

Adds a new view to the list of user-authored views. Will throw an exception if you target entities under collapsed assemblies or add a view with a duplicate name.

Parameters
viewThe fully specified view definition.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ AddVisibleOccurrencesToView()

void Anark.CoreSdkApi.ISdkApi.AddVisibleOccurrencesToView ( ISdkView view,
IEnumerable< ISdkEntityHandle > handles )

Show specified 3D entities in a view that has been authored in Anark Core Workstation. This replaces any prior set of 3D entities for the specified view that were previously made visible in a call to AddVisibleOccurrencesToView with the current set of 3D entity handles (i.e. this method cannot be used to incrementally add an additional visibility state). Visibility states that were specified by Anark Core Workstation users will be retained (not overwritten). The modifications will be retained in the Anark Core Recipe. Limitations: the view cannot be an imported view, and the entities to make visible must be entities that have been created via this SDK API.

Parameters
viewThe view to modify.
handlesThe occurrence handles of the 3D entities to show in the view.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ ConvertEntityHandles()

ISdkEntityHandle[] Anark.CoreSdkApi.ISdkApi.ConvertEntityHandles ( ISdkEntityHandle[] sourceHandles,
SdkEntityType targetEntityType )

Follows the object references to "convert" entity handles to the desired target entity type. For example, you can convert a component occurrence handle to a component instance and/or a component. The reverse is not true because it is often ambiguous. This can be useful if you have search results for component instances and you need to reference the actual component (part/assembly) for one or more of those instances. Also applies to PMI, etc.

Parameters
sourceHandlesThe source entity handles.
targetEntityTypeThe desired type of entity handle to return.
Returns
Distinct set of entity handles. Returns an empty array when the conversion is not possible (cannot convert PMI occurrence to component for example).

Implemented in Anark.CoreSdkApi.SdkApi.

◆ FindObjectsByLocation()

Dictionary< ISdkEntityHandle, float > Anark.CoreSdkApi.ISdkApi.FindObjectsByLocation ( IEnumerable< ISdkEntityHandle > visibleEntities,
ISdkVertex3D objectLocation,
float maxDistance = float.MaxValue,
SdkEntityType resultEntityType = SdkEntityType.Component )

Provides a point-to-solid interference clash test to identify parts or part occurrences in which a specific point is located. Identifies all objects that are nearer than maxDistance from objectLocation and their associated observed distances.

Parameters
visibleEntitiesEntities to be considered "visible" - i.e. those entities which should take part in the interference clash test.
objectLocationThe start point of all rays used to intersect parts in the model.
maxDistanceThe maximum distance to consider when finding close objects.
resultEntityTypeThe resulting entity type to return. Valid types are SdkEntityType.Component (returns matching part definitions) and SdkEntityType.ComponentOccurrence (returns matching part occurrences). Omit this parameter to return part definitions.
Returns
A Dictionary of part or occurrence handles and associated observed closest intersection distances from objectLocation. The Dictionary will be empty if nothing is found.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetAttributeNames()

string[] Anark.CoreSdkApi.ISdkApi.GetAttributeNames ( SdkEntityType entityType)

Get the available attribute names for a specified entity type.

Parameters
entityTypeThe entity type
Returns
Array of attribute names.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetBoundingBox()

ISdk3DBoundingBox Anark.CoreSdkApi.ISdkApi.GetBoundingBox ( ISdkEntityHandle entityHandle)

Gets the 3D bounding box of a part or annotation, in the local coordinate system of the part or annotation.

Parameters
entityHandleThe handle to the part or annotation.
Returns
A 3D bounding box

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetEntityAttribute()

object Anark.CoreSdkApi.ISdkApi.GetEntityAttribute ( ISdkEntityHandle entityHandle,
string attributeName )

Get an attribute value from an entity.

Parameters
entityHandleThe entity containing the attribute to retrieve
attributeNameThe name of the attribute to retrieve
Returns
The attribute value

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetGeometry()

ISdk3DGeometry Anark.CoreSdkApi.ISdkApi.GetGeometry ( ISdkEntityHandle entityHandle)

Gets the geometric representation of a Supplemental Geometry Definition or Occurrence Given a Supplemental Definition Entity, Local coordinates will be returned. Given a Supplemental Geometry Occurrence, Global coordinates for that particular occurrence will be returned.

Parameters
entityHandleThe Supplemental Geometry Definition or Occurrence
Returns
The geometric representation of the Supplemental Geometry

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetPartVertices()

ISdkVertex3D[] Anark.CoreSdkApi.ISdkApi.GetPartVertices ( ISdkEntityHandle entityHandle)

Gets the 3D mesh points for a part. Note that this can be a relatively expensive operation - see GetBoundingBox if you only need the part bounding box. The points are returned in the part's local coordinate system.

Parameters
entityHandleThe handle to a part.
Returns
An array of 3D vertices.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetTransform()

ISdkMatrix4X4 Anark.CoreSdkApi.ISdkApi.GetTransform ( ISdkEntityHandle entityHandle)

Gets the current 3D transform for a part or assembly instance.

Parameters
entityHandleA part instance or an assembly instance.
Returns
The 3D transformation matrix.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetViews()

ISdkView[] Anark.CoreSdkApi.ISdkApi.GetViews ( )

Get all views.

Returns
An array of view objects.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetViewUpdateCount()

int Anark.CoreSdkApi.ISdkApi.GetViewUpdateCount ( ISdkView view)

Gets the view update count, which is a counter that is incremented whenever there is any update to a view. It can be used for an incremental update mechanism where you only update views that have changed, by comparing this number against the value at your last plug-in execution.

Parameters
viewThe view.
Returns
Returns the update count or -1 if the view does not exist.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ GetWorkspaceAttribute()

object Anark.CoreSdkApi.ISdkApi.GetWorkspaceAttribute ( string attributeName)

Get a workspace attribute value.

Parameters
attributeNameThe name of the attribute.
Returns
The attribute value.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ RemoveMyAnnotations()

void Anark.CoreSdkApi.ISdkApi.RemoveMyAnnotations ( ISdkEntityHandle[] annotationHandles)

Removes annotations that have been created by your plug-in. This will not remove annotations from the imported 3D data and this will not remove annotations created by other plug-ins. This will remove the annotations from all user-defined views.

Parameters
annotationHandlesAn array of annotation handles. The handles must be handles to the annotation definition rather than the annotation occurrence. This would typically be the results of a query searching for SdkEntityType.Pmi.

SdkAnnotationInfo.DefinitionHandle SdkEntityType.Pmi

Implemented in Anark.CoreSdkApi.SdkApi.

◆ RemoveMyAttributes()

void Anark.CoreSdkApi.ISdkApi.RemoveMyAttributes ( )

Removes all attributes that were created by the caller. Includes workspace attributes and attributes in other entities. Does not revert any attribute values that have been set for attributes that were not created by the caller.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ Search()

ISdkEntityHandle[] Anark.CoreSdkApi.ISdkApi.Search ( ISdkQueryExpression query,
SdkEntityType resultEntityType = SdkEntityType.Invalid )

Search for entities with a query expression. This returns the same results as the Query functionality in Anark Core Workstation.

Parameters
queryThe query expression.
resultEntityTypeThe resulting entity type to return. Omit this argument to directly return the entities from the query. Pass a different entity type to perform a conversion, where applicable. For example, when searching for CAD entities, the default entity return type will be occurrences, but this could be converted to a distinct collection of components.
Returns
An array of entities. The array will be empty if nothing is found.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ SetEntityAttribute()

void Anark.CoreSdkApi.ISdkApi.SetEntityAttribute ( ISdkEntityHandle entityHandle,
string attributeName,
object attributeValue )

Set an entity attribute value. Creates a new attribute if the attribute does not already exist.

Parameters
entityHandleThe entity to modify
attributeNameThe name of the attribute to set
attributeValueThe value of the attribute

Implemented in Anark.CoreSdkApi.SdkApi.

◆ SetTransform()

void Anark.CoreSdkApi.ISdkApi.SetTransform ( ISdkEntityHandle entityHandle,
ISdkMatrix4X4 transformMatrix )

Updates the 3D transform on a part or assembly instance.

Parameters
entityHandleA part instance or an assembly instance.
transformMatrixThe 3D transform to apply.

Implemented in Anark.CoreSdkApi.SdkApi.

◆ SetWorkspaceAttribute()

void Anark.CoreSdkApi.ISdkApi.SetWorkspaceAttribute ( string attributeName,
object attributeValue )

Add or overwrite a workspace attribute value.

Parameters
attributeNameThe name of the attribute (will be published, used in the UI, etc.).
attributeValueThe value of the attribute.

Implemented in Anark.CoreSdkApi.SdkApi.