import adsk.core, adsk.fusion
def run(context):
try:
app = adsk.core.Application.get()
# Specify if a hybrid, part, or assembly document should be created. If
# both are False, it defaults to creating a hybrid document.
createPart = False
createAssembly = False
# Create a new document. The Documents.add method always creates a hybrid document.
new_HybridDoc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
design: adsk.fusion.Design = new_HybridDoc.products.itemByProductType('DesignProductType')
# If a part or assembly document is wanted, modify the hybrid document to be the correct type.
if createPart:
# Sets the intent to be a part design.
design.designIntent = adsk.fusion.DesignIntentTypes.PartDesignIntentType
elif createAssembly:
# Sets the intent to be an assembly design.
design.designIntent = adsk.fusion.DesignIntentTypes.AssemblyDesignIntentType
except:
pass