Place Model Group Postable Command

Place Model Group Postable Command

mastjaso
Advocate Advocate
1,145 Views
3 Replies
Message 1 of 4

Place Model Group Postable Command

mastjaso
Advocate
Advocate

Is there a postable command for Placing a Model Group? I can see the one for creating a new model group, and for placing a detail group, and I can set the default ModelGroupType using document.SetDefaultElementTypeId(ElementTypeGroup.ModelGroupType, id) , but I can't seem to find the postable command for actually placing a model group into a project, am I missing something obvious or is this another item for the api wishlist?

0 Likes
Accepted solutions (1)
1,146 Views
3 Replies
Replies (3)
Message 2 of 4

aignatovich
Advisor
Advisor
Accepted solution

Hi!

 

When you are interested in postable commands and if you don't know command name, the best way is to explore Revit journal file. In this case it will be something like this:

 

...
'H 01-Aug-2018 10:42:38.717;   0:< 
Jrn.Data "Restricted Propagation"  _
        , 2, 71
' 0:< <<Begin build CT>>
'
'Edit mode: IDR_COMMON
'Command: ID_OBJECTS_PLACE_GROUP
'Category: 0
'Bar list: 
'	Dialog_Revit_DynamicLabelDBar
'	Dialog_Revit_FamilyBar
'	Dialog_Essentials_MoveProps
...

So command id will be ID_OBJECTS_PLACE_GROUP

 

Let's get RevitCommandId:

var cmId = RevitCommandId.LookupCommandId("ID_OBJECTS_PLACE_GROUP");

Then we should explore, if the command can be posted (some of them can be posted, some can not)

var canPostCommand = uiApplication.CanPostCommand(cmId);

Unfortunately, in such case canPostCommand is false, and if you try to call:

uiApplication.PostCommand(cmId)

this will fail with ArgumentException. So the answer to your question is no.

 

Hope, this clarifies.

 

Message 3 of 4

JimJia
Alumni
Alumni

Great answerHeart, thanks a lot for your sharing and help!Heart

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 4 of 4

mastjaso
Advocate
Advocate

Can you please not mark this as solved? While @aignatovich did provide a great and very helpful answer (which I thank you for!), the conclusion was that this is unsolvable given the current state of the API. Thus this post should remain marked as "unsolved" so that others coming across it don't get the mistaken impression that there's been a solution to the issue.

0 Likes