Rhino 5, .net, customize lineTypes at startup

Hello forum,

the following C# code (specific for the Italian version of Rhino) deletes all linetypes but the continuous:
RhUtil.RhinoApp().RunScript("-_DocumentProperties t e “Bordo” e “Centro” e “Nascosto” e “Punti di annotazione” e “Tratteggiato” e “TrattinoPunto” INVIO INVIO");

By itself it works, but when I run this plug-in from at startup (through a single line rhinoscript code which is run at startup) it fails: the resulting lineType list is still the default one.

If then I wait one second and run the plug-in code again (without the startup rhinoscript call) it works. It looks like if Rhino is restoring the line database in parallel. Is it possible?

Thanks. L

Here are several linetypes that are hard-coded into Rhino. These are: Continuous, Border, Center, DashDot, Dashed, Dots, and Hidden. So while it is possible to delete them, with the exception of Continuous, you need to do it after they have been added to the linetype table. Otherwise, Rhino will create them and add them to the linetype table when the user first needs them.

1 Like

Dale,

thanks. The problem is to understand when Rhino recreates the linetype table after a document is loaded. In fact if I write a script that:

  1. loads a document
  2. delete certain linetypes (or define new ones)
    it fails. The resulting linetype table is still the default one.

If I instead:

  1. load a document from the user interface
  2. run the same script as before, point 2 only
    the resulting linetype table is what I expected.

It looks like I should not manipulate the linetype table too early after loading a document.

Thanks. L

Dale,

I’m still on this problem, this time under RhinoCommon. I tested the following:

  1. Load a document from the command line
  2. Get the number of linetypes with the command RhinoDoc.ActiveDoc.Linetypes.Count. In my case I got 2
  3. From the user interface open tools/options/annotations/linetypes and do nothing but watch it appear and close immediately. Linetypes are 8 + continuous
  4. Now RhinoDoc.ActiveDoc.Linetypes.Count returns 8!

It looks like that by opening the linetype table window the linetype table is triggered. I would like to do it from my plug-in. Any hope?

Thanks. L

Hi Livio,

I’ve added an SDK request to the pile.

http://mcneel.myjetbrains.com/youtrack/issue/RH-32316

I’ll make sure this makes it into V6.

– Dale