Skip to main content

How to use Accessors section in SOLIDWORKS API Help

Accessibility of certain interface can be found in the Accessors section of specific interface in the SOLIDWORKS API Help documentation.

For example, the snapshot below is an Accessors section of the IAnnotation Interface

Accessors section in API Help documentation{ width=250 }

Which means that the pointer to IAnnotation Interface could be retrieved either via IAnnotation::GetNext3 Method or IAnnotationView::Annotations property or other properties or methods in this list.

Some of the interfaces can be explicitly or implicitly cast from one to another. For example IModelDoc2 represents the parent interface (although there is no direct inheritance) for IPartDoc, IAssemblyDoc, IDrawingDoc interfaces.

Which means that both parent and specific object would be pointing to the same object in memory.

VBA

Dim swModel As SldWorks.ModelDoc2
...
Dim swPart As SldWorks.PartDoc
Set swPart = swModel

VB.NET

Dim swModel As IModelDoc2
...
Dim swPart As IPartDoc = CType(swModel, IPartDoc)

C#

IModelDoc2 model;
...
IPartDoc part = model as IPartDoc;

C++

LPMODELDOC2 pModelDoc;
...
LPPARTDOC pPartDoc = NULL;
hres = pModelDoc->QueryInterface(IID_IPartDoc, (LPVOID*)&pPartDoc);