Force selecting first point of ModelLine Command

Force selecting first point of ModelLine Command

rtg.dev015A9H9
Participant Participant
385 Views
2 Replies
Message 1 of 3

Force selecting first point of ModelLine Command

rtg.dev015A9H9
Participant
Participant

Hello,
I am posting the ModelLine command using the code below:

            Autodesk.Revit.UI.RevitCommandId cmd_id
                = RevitCommandId.LookupPostableCommandId(
                    PostableCommand.ModelLine);

            uiapp.PostCommand(cmd_id);

Is there any way to force select the first pick point of the command?
Maybe using user32.dll to simulate a click event on the screen but I couldn't get it done..
Any ideas?

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

jeremy_tammik
Alumni
Alumni

When you say 'force select', I assume you mean 'pass it in programmatically instead of letting the user pick it'. Is that assumption correct? Sorry to say, I am not aware of any support from the Revit API to pass in arguments to the built-in commands launched by PostCommand. So, you are on your own here. Yes, you can try to simulate the user input using other Windows APIs. However, it may prove challenging to synchronise the Revit model line command with a separate thread or external application simulating this user input. Looking forward to hearing how you end up solving this.

  

On second thoughts, depending on your other requirements, it may be simpler for you to use the standard PickPoint method to prompt for all the model line input data except the first point, and then create the model lines programmatically based on that without calling the built-in command at all.

  

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

rtg.dev015A9H9
Participant
Participant

Hi @jeremy_tammik , thanks for replying.

Let me explain my workflow a bit better:

 

I use the Selection.PickObject to get a reference of the pipe and then proceed to create a vertical sketch plane aligned with the pipe center line. And after that, I post a ModelLine command to the UI.

 

The whole point of using the line command is to provide visual feedback of the connection between the two points, like angles and even better, snapping to Z axis(holding shift).

rtgdev015A9H9_0-1671805077910.png

 

0 Likes