Revision Cell & Derived Parameter

Revision Cell & Derived Parameter

Anonymous
Not applicable
377 Views
2 Replies
Message 1 of 3

Revision Cell & Derived Parameter

Anonymous
Not applicable

I am having some issues trying to set a parameter to Included from a derived part.   The following runs without error, and I can put a watch on oDerivedPartDef.Definition.Parameters.Item("Plate_6_Thk").IncludeEntity, and it never changes from False to True.  What am I missing?

 

Also Is there no way to change a Revision Cell to or from Static?

 

Public Sub Derived()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDerivedPartDef As DerivedPartComponent
Set oDerivedPartDef = oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1)

oDerivedPartDef.Definition.Parameters.Item("Plate_6_Thk").IncludeEntity = True
If Err Then Stop

End Sub
0 Likes
Accepted solutions (1)
378 Views
2 Replies
Replies (2)
Message 2 of 3

Jef_E
Collaborator
Collaborator
Accepted solution

It's somthing really stupid.. you must set back the definition.. struggled with this also for a while 😄

 

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDerivedPartDef As DerivedPartComponent
Set oDerivedPartDef = oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1)

oDerivedPartDef.Definition.Parameters.Item("Plate_6_Thk").IncludeEntity = True

oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1).Definition = oDerivedPartDef


Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 3 of 3

Anonymous
Not applicable

Thanks Jef,

 

I did have to change it a bit to get it to work, and I probably still don't have it quite right since it throws an error.  I will look into it more next time I need to do a bunch of files.   This is what I ended up with though.

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDerivedPartDef As DerivedPartUniformScaleDef

Set oDerivedPartDef = oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1).Definition

oDerivedPartDef.Parameters.Item("Plate_6_Thk").IncludeEntity = True
oDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1).Definition = oDerivedPartDef
If Err Then Stop
0 Likes