Hi,
I am trying ot modify a LocalLinearPattern in a subassembly. I can do it fine when I open the subassembly and write code to modify it there, and the only real difference is what goes in to the Part.Extension.SelectByID2() portion, so I assume that is where I am having the issue. I don't think I am properly selecting the local pattern within the subassembly. Any help would be greatly appreciated.
My tree looks like this:
TopAssembly
-NextAssembly<1>
-LocalLinearPattern1
Code looks like this:
Sub AlterPart()
Dim swApp As Object
Dim pPart As Object
Dim longstatus As Long, longwarnings As Long
Set swApp = CreateObject("SldWorks.Application")
Set pPart = swApp.ActiveDoc
Part.ResolveAllLightWeightComponents (True)
Dim Skip2(0 To 50) As Long
Dim boolstatus As Boolean
Dim lFeatureData As ILocalLinearPatternFeatureData
Dim pFeature As IFeature
Dim pSelMan As SelectionMgr
Erase Skip2()
Skip2(0) = 42
Skip2(1) = 43
boolstatus = Part.Extension.SelectByID2("LocalLPattern1@NextAssembly-1@TopAssembly", "COMPPATTERN", 0, 0, 0, False, 0, Nothing, 0)
Set pSelMan = pPart.SelectionManager
Set pFeature = pSelMan.GetSelectedObject5(1)
Set lFeatureData = pFeature.GetDefinition
lFeatureData.SkippedItemArray = (Skip2)
pFeature.ModifyDefinition (lFeatureData, pPart, Nothing)
lFeatureData.ReleaseSelectionAccess
Part.EditRebuild
Part.ClearSelection
End Sub
SolidworksApi macros