Change the Derive Style of a derived assembly in VBA

Change the Derive Style of a derived assembly in VBA

shastu
Advisor Advisor
605 Views
2 Replies
Message 1 of 3

Change the Derive Style of a derived assembly in VBA

shastu
Advisor
Advisor

I have code to create a derived assembly based off of the active file.  All I need is a way to change the Derive Style but can't seem to figure it out.  I have included a screenshot of what I am trying to accomplish only I need to be able to do it through the API.

0 Likes
Accepted solutions (1)
606 Views
2 Replies
Replies (2)
Message 2 of 3

HideoYamada
Advisor
Advisor
Accepted solution

Hello shastu,

 

Set DerivedAssemblyDefinition.DeriveStyle Property.

 

Function CreateDerivedAssy(FullFileName As String) As DerivedAssemblyComponent
    Dim oPartDoc As PartDocument: Set oPartDoc = ThisApplication.ActiveDocument
    Dim oPartDef As PartComponentDefinition: Set oPartDef = oPartDoc.ComponentDefinition
    Dim oDerivedAssys As DerivedAssemblyComponents: Set oDerivedAssys = oPartDef.ReferenceComponents.DerivedAssemblyComponents
    Dim oDerivedDef As DerivedAssemblyDefinition: Set oDerivedDef = oDerivedAssys.CreateDefinition(FullFileName)
    
    ' This changes Derive Style!
    oDerivedDef.DeriveStyle = kDeriveAsSingleBodyWithSeams
    
    Set CreateDerivedAssy = oDerivedAssys.Add(oDerivedDef)
End Function

 

=====

Freeradical

 Hideo Yamada

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 3 of 3

shastu
Advisor
Advisor

Thank you so much!!!  I didn't realize that I had to do it within a function.  I was trying to get it accomplished within my sub.

0 Likes