10-27-2021
06:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-27-2021
06:28 AM
Can you post an images of what the other tab of that error message says? Most often the "More Info" tab of those error messages contains more useful information, so I usually advise folks to post an image of the contents of both tabs of any error messages they get, when trying to diagnose the error.
Also, just a tip, but if you just want to work with one specifically named component, you can get it directly by its name (using ItemByName()), without needing to loop through all components, unless that component is at a lower level (below some sub-assemblies). Here is an alternative to the last code you posted that shows how to use this technique.
Dim doc As AssemblyDocument = ThisDoc.Document
oName = "COURSE 1 STEEL TANK SHEET:8"
occ = doc.ComponentDefinition.Occurrences.ItemByName(oName)
Dim facDoc As PartDocument = occ.Definition.Document
oPCD = facDoc.ComponentDefinition
If oPCD.IsModelStateMember Then
facDoc = oPCD.FactoryDocument
End If
oMStates = oPCD.ModelStates
newModelStateName = "N1"
oMState = oMStates.Add(newModelStateName)
oMState.Activate()
occ.ActiveModelState = newModelStateName
iLogicVb.RunRule(oName, "ManwayCutOut")
Wesley Crihfield
(Not an Autodesk Employee)