Default instance properties for "non-family types"

Default instance properties for "non-family types"

schnierer.gabor
Advocate Advocate
673 Views
2 Replies
Message 1 of 3

Default instance properties for "non-family types"

schnierer.gabor
Advocate
Advocate

Hello everyone,

 

One of the great features of the Revit UI is when you create an element using the built-in commands (wall, detail line, component, etc), the properties palette can be used to specify the type and the instance parameters of the object to be created. Can this feature be used in a way with ExternalCommands?

 

My goal is to avoid recreating the same UI in my ExternalCommands what is already available in the Revit UI. I realize the default types are exposed to the Revit API, which is a great start. What I am missing is the default instance parameters for “Non-family types” - as the Developer’s guide defines them. Part of my focus is Rebar, which have quite many instance parameters for which I have to create dropdowns and textboxes in my addin. Not to mention project parameters and rebar specific features like rounding and custom hooks.

 

What gives me hope is that for certain element categories like Detail Lines when you initiate the built-in command in the UI and change an instance parameter like Line Style, you get a “Modify element attributes” item in the undo history, and also flags the document as unsaved - prompts to save when closing. I tried to hook into the DocumentChanged event using the ChangesMonitor SDK sample, but it gave me no result. 

 

A slighly distressing addition, the same process done with Rebar leaves no undo history. When I start the rebar tool, change an instance parameter like Partition, no undo item gets generated. Then I place the rebar, quit the command, start the rebar command again, and the Partition parameter is preserved. Something must have changed, though in this case there is even less trace of it.

 

Any recommendations? Even if this is not exposed to the API, what is your preferred solution to handling large numbers of instance parameters when placing elements? Do you build a UI similar to the properties palette?

0 Likes
674 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Interesting question. As usual, I have no idea, really, but a couple of thoughts that we could discuss, if you like.

  

My first thought is this: could you place one single sample rebar in your model, or maybe a handful of prototype placeholder dummy rebars, just floating around in space? Then, you could use the standard Revit UI and API functionality on those, populate their properties completely according to your and the users wishes, and simply copy each of them when needed, or just copy their properties onto newly created 'real' model rebars with a single click.

  

Does that come anywhere near to addressing your task?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

schnierer.gabor
Advocate
Advocate

Thanks for the input Jeremy! Especially because it reassures me that this was not a recent hot topic I missed during my research.

 

Advancing your first thought, any already existing element of the same category could be used for such purposes by implementing a mechanism similar to a "color picker" in graphical applications. The command dialog could offer the user the option to just pick a source rebar to copy parameters from. I've been implementing such shortcut features in my apps previously, like if there are elements preselected before starting the command, skip asking for input that can be read from the selection.

 

I wish for more, because none of the methods above allow such deep insight and customization as the properties palette does during the standard placement methods. 

 

A long shot idea maybe is to use the PromptForFamilyInstancePlacement method, let the user place an element, store the properties and roll back the transaction. Maybe something I'll experiment with, though from the end user perspective I fear it might raise eyebrows.