this was more dificult then i thought. it seems that 'LinearGeneralDimension' chain set members are always attached acc. to. the property 'Attached'.... So that is not a greate help but if a member is detached then properties 'IntentOne', 'IntentTwo' or 'IntentThree' will throw an exception. (The intent that belogs to the detached line will throw that exception). deleting the meber with an intent that is throwing exceptions is not a problem but when i tested that depending of deleting mebers you can end up with un expected (wrong) results becuase inventor try's to merge remaining members when you delete one.
the solution was to find all intents that where not throwing exceptions and recreate a new chain set. see the code below:
Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet
Dim chianSet As ChainDimensionSet = sheet.DrawingDimensions.ChainDimensionSets.Item(1)
Dim intentColletcion As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
For Each member As LinearGeneralDimension In chianSet.Members
Try
intentColletcion.Add(member.IntentOne)
Catch ex As Exception
End Try
Try
intentColletcion.Add(member.IntentTwo)
Catch ex As Exception
End Try
Try
intentColletcion.Add(member.IntentThree)
Catch ex As Exception
End Try
Next
sheet.DrawingDimensions.ChainDimensionSets.Add(
intentColletcion, chianSet.Members.Item(1).Text.Origin, chianSet.DimensionType)
chianSet.Delete()
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog: hjalte.nl - github.com