PrintToPDF Returns Null/Empty without Errors

Ok - so we have the right Python version. That’s the first step. Next up which Crumple version are you on?

Sorry you’re struggling here. I feel bad but it’s important for everyone to try and understand ‘why’. It’s not a Gavin thing, or a Revit thing, or a Dynamo thing, or a Python thing, but the nature of technology. The issues stem from referring to old workflows/code in new tools. Basically you need to revise the workflow for the .NET upgrade (4.8 to 8), Python upgrade (2.7 to 3.9), and Revit upgrade (2025 vs 2022). If that sounds like a lot of changes… well it is a TON. It’s like trying to play a song where part of the track is on an 8 track, part on a cassette, and part on a CD and the only speakers you have are attached to a modern car stereo.

1 Like

Crumple Version 2024.4.3 its noted that it is only built for Revit 2022 and Dynamo 2.12. It would make sense if this was the issue.

1 Like

That node uses winforms which are not supported in 2025/net core to my understanding, at least in the way that node is set up.

I build in 2022, and have tested most nodes in 23/24 but not many in 2025. Havent had time at this point unfortunately, my focus is currently on C# and addin development.

Here is a fixed version of UI.DropdownForm node that is compatible with :

  • CPython3
  • IronPython3
  • PythonNet3

code

# Made by Gavin Crump
# Free for use
# BIM Guru, www.bimguru.com.au

# Thanks for the tips and example Cyril!
# https://github.com/Cyril-Pop/IronPython-Samples/blob/master/WinForms/combobox%2BDataBinding%20with%20DataTable.py

import clr
import System
from System import Array
from System.Collections.Generic import List, IList, Dictionary
clr.AddReference('System.Data')
from System.Data import *

clr.AddReference("System.Drawing")
clr.AddReference("System.Windows.Forms")

import System
import System.Drawing

from System.Drawing import *
from System.Windows.Forms import *

# Define list/unwrap list functions
def tolist(input):
    result = input if isinstance(input, list) else [input]
    return result

# Imports from Dynamo
form_title  = IN[0]
keys        = tolist(IN[1])
values      = tolist(IN[2])
form_width  = IN[3]
form_height = IN[4]


# Class for main winform
class MainForm(Form):
    
    # Initialize form object
    def __init__(self, keys, values, title, formWidth, formHeight):
        super().__init__()
        self.title  = title
        self.formWidth = formWidth
        self.formHeight = formHeight

        self._table = DataTable("DataTable")
        self._table.Rows.Add() # to add a empty row
        self._table.AcceptChanges() # to add a empty row
        self._table.Columns.Add("Key", System.String)
        self._table.Columns.Add("Value", System.Object)
        for k_, v_ in zip(keys, values):
            self._table.Rows.Add(k_, v_)
        #
        self.choice = None
        self.Font  = System.Drawing.SystemFonts.DefaultFont
        self.InitializeComponent()
    
    # Make form components
    def InitializeComponent(self):
        
        # Add buttons
        self._comboBox = System.Windows.Forms.ComboBox()
        self._buttonCancel = System.Windows.Forms.Button()
        self._buttonOK = System.Windows.Forms.Button()
        self.SuspendLayout()
        
        # Combo box
        self._comboBox.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right
        self._comboBox.Location = System.Drawing.Point(20, 20)
        self._comboBox.Size = System.Drawing.Size(self.formWidth - 40, 21)
        self._comboBox.DataSource = self._table
        self._comboBox.DisplayMember = "Key"
        self._comboBox.ValueMember = "Value"
        self._comboBox.SelectedIndexChanged += self.ComboBox1SelectedIndexChanged
        
        # OK button
        self._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right
        self._buttonOK.Location = System.Drawing.Point(self.formWidth-180, self.formHeight-50)
        self._buttonOK.Name = "buttonOK"
        self._buttonOK.Size = System.Drawing.Size(80, 25)
        self._buttonOK.TabIndex = 1
        self._buttonOK.Text = "OK"
        self._buttonOK.UseVisualStyleBackColor = True
        self._buttonOK.Click += self.ButtonOKClick

        # Cancel button
        self._buttonCancel.Anchor =  System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right
        self._buttonCancel.Location = System.Drawing.Point(self.formWidth-100, self.formHeight-50)
        self._buttonCancel.Name = "buttonCancel"
        self._buttonCancel.Size = System.Drawing.Size(80, 25)
        self._buttonCancel.TabIndex = 1
        self._buttonCancel.Text = "Cancel"
        self._buttonCancel.UseVisualStyleBackColor = True
        self._buttonCancel.Click += self.ButtonCancelClick
        
        # Draw main form
        self.ClientSize = System.Drawing.Size(self.formWidth, self.formHeight)
        self.MinimumSize = System.Drawing.Size.Add(self.ClientSize, System.Drawing.Size(20, 20))
        self.Controls.Add(self._comboBox)
        self.Controls.Add(self._buttonOK)
        self.Controls.Add(self._buttonCancel)
        self.ControlBox = False
        self.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show
        self.Name = "MainForm"
        self.Text = self.title
        self.BringToFront()
        self.CenterToScreen()
        # self.FormBorderStyle = FormBorderStyle.FixedSingle
        self.ResumeLayout(False)

    # Event if dropdown changes
    def ComboBox1SelectedIndexChanged(self, sender, e):
        if isinstance(sender.SelectedItem['Value'], System.DBNull):
            self.choice = None
        else:
            self.choice = sender.SelectedItem['Value']

    # Event if OK button pressed
    def ButtonOKClick(self, sender, e):
        self.Close()
        self.runNextOutput = True 

    # Event if OK button pressed
    def ButtonCancelClick(self, sender, e):
        self.choice = None
        self.Close()
        self.runNextOutput = False

# Show form to the user
objForm = MainForm(keys, values,
                   title = form_title,
                   formWidth = form_width,
                   formHeight = form_height)

objForm.ShowDialog()

# Return the selected object and if it was cancelled
chosenItem = objForm.choice

if not chosenItem:
    OUT = None, True
else:
    OUT = chosenItem, False
4 Likes