How to add an object to display it differently in different viewports? and another question

Please refer to the code.

First question: How to get focus by program:

  1. Install the plugin MMArc.

  2. Please run command ‘mma’ first, it will popup a dockbar, which has a Wall tab and a Door tab.
    each tab has a button, let me call them wall-button and door-button.
    You can find code "RunScript(“mmaWall”, true); " in UcBuilding.cs.

  3. Click on the wall-button to draw a wall, then I must click on rhino view to get the focus, and then click second time
    to start draw wall. My problem is how to omit the first click?
    Code in WallCommands.cs.

  4. Run command ‘mmaDoorType’ to create a door instance definition “M-1”.
    Code in DoorTypeCommand.cs.

  5. Click on the door-button to insert a door, same thing happened, first click to get focus, second click to insert the door,
    How to omit the first click?
    I know that this problem will not happen if type in the command manually or using .rui, but I must solve the problem because
    I have many controls on the dockbar.
    You can find code "RunScript(“mmaDoor”, true); " in UcBuilding.cs, command code in DoorCommands.cs.

Second question: How to add an object to display it differently in different viewports?
6. Observe the inserted door. A Brep and two Curves made up the door. How can I make the curves display on TopView only,
and breps display on other viewports except TopView?
When the document save as .dwg file with TopView selected, I hope the .dwg file only contains curves without the breps.
Would you please help me add some code to get the effect?
Code in DoorTypeCommand.cs.

Thank you!
Manhong Chen

MMArc-Simplified.rar (4.5 MB)

Hi @chen_manhong,

Rhino is built to show drawing elements in all the standard drawing viewports. To produce views which omit some items, it employs the Layouts feature. In Layouts viewports you can control which layers appear on a per viewport basis. You draw in the standard viewports and selectively display (and annotate) in the layouts.

I suggest you check this out before trying to code a solution that Rhino is not designed to handle.