PostableCommand SplitFace and SplitSurface

PostableCommand SplitFace and SplitSurface

neillee
Participant Participant
831 Views
6 Replies
Message 1 of 7

PostableCommand SplitFace and SplitSurface

neillee
Participant
Participant

Is there any reason that the command SplitFace and SplitSurface to not seem to run ? All other commands I try work fine. This is the code I am using:

 

class Update : IExternalCommand
{

public virtual Result Execute(ExternalCommandData commandData
, ref string message, ElementSet elements)
{
var cmdId = RevitCommandId.LookupPostableCommandId(PostableCommand.SplitFace);
new UIApplication(Rvt.Doc.Application).PostCommand(cmdId);
return Result.Succeeded;
}
}

0 Likes
832 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk

Dear Neil,

 

Thank you for your query.

 

The code snippet you share above is incomplete.

 

`Rvt` is not defined.

 

Maybe the way you create that `UIApplication` instance produces a weird result.

 

However, I simplified and converted it into a real executable external command like this:

 

  public Result Execute(
    ExternalCommandData commandData,
    ref string message,
    ElementSet elements )
  {
    UIApplication uiapp = commandData.Application;

    var cmdId = RevitCommandId.LookupPostableCommandId( 
      PostableCommand.SplitFace );

    uiapp.PostCommand( cmdId );

    return Result.Succeeded;
  }

 

That does not seem to launch the Split Face command either.

 

I have asked the development team for you whether there is a reason for this, and what the expected behaviour might be.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 7

Sean_Page
Collaborator
Collaborator

Are you running it when in a view that allows splitface commands?

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 4 of 7

jeremytammik
Autodesk
Autodesk

I tested and confirmed. Manually, it works, and the PostCommand in the same view does nothing.

 

The development team confirmed something weird in past releases Revit 2019 and 2020, and confirmed that it works in a future major release of Revit, the current development release. 

 

So the problem is presumably real.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 7

jeremytammik
Autodesk
Autodesk

The development team confirm our findings:

 

As said, a macro running SplitFace via `PostCommand` does work in the current development build.

 

The list of PostableCommands was cleaned up to match the current UI. 

 

The split face command id was wrong before the cleanup.

 

The SplitFace id in the PostableCommand list changed from 35732 to 33689 in May 2020, which is a correct change.

 

This means that it never worked in Revit 2021 and before (I confirmed) and now it works in the next major release of Revit.

 

Question: So, perhaps in earlier versions it could be faked with a cast?

 

Answer: Unfortunately, the faked with a cast won't work as we validate the input with the `Enum.IsDefined` method.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 6 of 7

neillee
Participant
Participant

How would I know when that is ?

 

Would that be a hotfix, Revit 2021 R2 or Revit 2022 ?

0 Likes
Message 7 of 7

jeremy_tammik
Alumni
Alumni

The next major release after Revit 2021 was Revit 2022.

  

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