- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
On user-side, when you activate a model state, corresponding properties are automatically updated.
I'm trying to do the same thing in VB. I can activate a modelstate, but properties are not updated. What is missing in the code ?
Sub test()
Dim odoc As PartDocument
Dim oPropSets As PropertySets
Dim oPropSet As PropertySet
Dim oProp As Property
Dim oModelStates As ModelStates
Dim oModelState As ModelState
Dim sPartNumber As String
Dim oActiveModelState As ModelState
Set odoc = ThisApplication.ActiveDocument
Set oPropSets = odoc.PropertySets
Set oModelStates = odoc.ComponentDefinition.ModelStates
Set oActiveModelState = oModelStates("Principal(e)")
sPartNumber = oPropSets("Design Tracking Properties").Item("Part Number").Value
Debug.Print ("Model state : " & oActiveModelState.Name & vbCrLf & "Part Number : " & sPartNumber)
Set oActiveModelState = oModelStates("Etat 1")
sPartNumber = oPropSets("Design Tracking Properties").Item("Part Number").Value
Debug.Print ("Model state : " & oActiveModelState.Name & vbCrLf & "Part Number : " & sPartNumber)
'Problem : Part Number is not modified"
End Sub
Thanks for your help !
Alain
Solved! Go to Solution.