AnsweredAssumed Answered

macro using the power select addin

Question asked by Joe Pickens on Mar 28, 2016

I am trying to run this macro but i cant figure out why i keep getting the 10018 error.


Option Explicit


Dim SWApp       As SldWorks.SldWorks

Dim Model       As SldWorks.ModelDoc2

Dim ModelView   As SldWorks.ModelView

Dim FrameState  As Variant


Dim longstatus  As Long

Dim Errors      As Long

Dim Warnings    As Long

Dim count(3)    As Integer

Dim varEntCount As Variant

Dim swUtil      As gtcocswUtilities

Dim swUtilPsl   As gtcocswPowerSelect


Sub main()


Set SWApp = Application.SldWorks

Set Model = SWApp.ActiveDoc


'Set Utilities Add In

Set swUtil = SWApp.GetAddInObject("Utilities.UtilitiesApp")


'Get the powerSelect object

Set swUtilPsl = swUtil.PowerSelect

longstatus = swUtilPsl.Init()


'Select only faces

longstatus = swUtilPsl.SetSelectEntitiesTypes(gtPslSelectionType_Face)


'Select all Features

longstatus = swUtilPsl.SetFeatureTypeFilter(gtpslFeatureType_e.gtPslFeat_All)

'longstatus becomes 10018 (gtErrPslIncorrectFeatureTypeArray) no matter whats entered


'Run the selection and get the number of edges, loops, faces, and features selected

varEntCount = swUtilPsl.RunPowerSelect(gtResultNoUI, longstatus)


longstatus = swUtilPsl.Close()


End Sub