Rhino 6 Plug-ins - Construction Plane error


#1

Rhino 6 Plug-ins

I use function “doc.Objects.AddText (sText, Plane, Height, Font, False, False)”
when I import and assign Plane a value

“Dim Plane As Rhino.Geometry.Plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane ()”

I get the result {Origin = 0.0.0 XAxis = 1.0.0, YAxis = 0.1.0, ZAxis = 0.0,1}

everything works well

but if I open, I get this result ‘doc.Views.ActiveView.ActiveViewport.ConstructionPlane ()’ threw an exception of type ‘System.NullReferenceException’

and the program stops

//Michael


(Dale Fugier) #2

Hi @UtsMicke,

Can you post some code code that runs, so we can run it here, that does not work for you?

– Dale


#3

Hello sends with my vb.net project

VBProjectXx.zip (251.6 KB)

It works if you import but not if you choose to open

/Michael


(Dale Fugier) #4

Hi @UtsMicke,

When you are opening a new file, the Rhino document you are populating is empty. Thus, you cannot do this:

Dim plane As Plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane()

because no views yet exist. You’ll need to get a plane in some other manner.

Does this help?

– Dale


#5

Little is there any example code ?
/Michael


(Dale Fugier) #6

HI @dale,

Instead of this:

Dim plane As Plane = doc.Views.ActiveView.ActiveViewport.ConstructionPlane()

maybe you can do this:

Dim plane As Plane = Plane.WorldXY

– Dale


#7

Thanks for the code

/Michael