iLogic Delete of detached Chain Set Member

iLogic Delete of detached Chain Set Member

AskEnevoldsen
Explorer Explorer
355 Views
1 Reply
Message 1 of 2

iLogic Delete of detached Chain Set Member

AskEnevoldsen
Explorer
Explorer

Does anyone have an ilogic code for deleting detached Chain set Members in the idw?

I have figured out how to Arrange the chain sets, and remove broken general dimensions, but not the broken Chain set members.. I'm running a configurator 360 model, so it has to be ilogic driven. 

 

 

0 Likes
356 Views
1 Reply
Reply (1)
Message 2 of 2

JelteDeJong
Mentor
Mentor

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.

EESignature


Blog: hjalte.nl - github.com

0 Likes