New session

Hi.

i would like to open a view in my Form1.But i would like to have the possibility to use only some commands and to work only with this view.i mean ,this view should work like a new rhinosession not linked to the other views of the document.i don’t know if there is the possibility.i tried to call the class Form_1 from my command like the following lines,but it is not absolutely what i want and if i close Form1 it crashes and i don’t know the reason.i thinks it would be better to open a new rhino session in Form1 but i don’t know if it is possible,if it would be very slow and so on …now i will try to do somethink but i am working without any control (in english probably i have to say “working blindly”).thank you in advance
code:
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
var form = new Form1();
form.Show();
return Result.Success;
}

public partial class Form1 : Form
{
[DllImport(“user32.dll”, CharSet = CharSet.Auto)]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
public Form1()
{
InitializeComponent();

        var rect = new System.Drawing.Rectangle(15, 15, 300, 300);

        var vista = RhinoDoc.ActiveDoc.Views.Add("pippo", Rhino.Display.DefinedViewportProjection.Perspective, rect, true);
       
        var handle = vista.Handle;
        SetParent(handle,this.Handle);
     
    }

}

Embedding views in controls is not something that rhino currently supports. This is a long time wishlist item and something that we hope will be easier in V6.

You can however make bitmap captures of views and place them on a form. This is pretty much what the print dialog does.

1 Like