Table of Contents

Class Component2Extensions

Namespace
Hymma.Solidworks.Extensions
Assembly
Hymma.Solidworks.Extensions.dll

Extension methods for SolidWorks.Interop.sldworks.Component2

public static class Component2Extensions
Inheritance
Component2Extensions
Inherited Members

Methods

GetToolboxType(Component2)

Returns the SolidWorks.Interop.swconst.swToolBoxPartType_e of a component. Uses ModelDoc2.Extension.ToolboxPartType (SW 2014+) as the primary detection method, with a file-path fallback for lightweight or suppressed components.

public static swToolBoxPartType_e GetToolboxType(this Component2 component)

Parameters

component Component2

The component to inspect.

Returns

swToolBoxPartType_e

The toolbox part type; SolidWorks.Interop.swconst.swToolBoxPartType_e.swNotAToolboxPart if the component is not a toolbox part or the type cannot be determined.

IsLibraryPart(Component2)

Determines whether a component is a SolidWorks library part. Detection is based on the file extension: library feature parts are saved with the .sldlfp extension. Parts that were derived from a library feature but saved as ordinary .sldprt files will not be detected.

public static bool IsLibraryPart(this Component2 component)

Parameters

component Component2

The component to check.

Returns

bool

true if the component file has the .sldlfp extension; otherwise false.

IsToolbox(Component2)

Determines whether a component is a SolidWorks Toolbox part. Uses ModelDoc2.Extension.ToolboxPartType (SW 2014+) as the primary detection method, with a file-path fallback for lightweight or suppressed components.

public static bool IsToolbox(this Component2 component)

Parameters

component Component2

The component to check.

Returns

bool

true if the component is a Toolbox part; otherwise false.