Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Cadkunde.nl
in reply to: Neuzzo

Dim oDoc As PartDocument = ThisDoc.Document
If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSheetMetalComponentDef As Inventor.SheetMetalComponentDefinition = oDoc.ComponentDefinition
oSheetMetalComponentDef.SheetMetalStyles.Item("Default").Activate
End If

First, oDoc as Document won't work, there is no componentdefinition within it. use PartDocument

Then check if it is a sheetmetal doc with subtype to prevent errors.

 

I can't see 'Sheetmetal' declared in your script and with object model i couldnt find 'setactivestyle' anywhere.