Grasshopper

algorithmic modeling for Rhino

Hi all,


I was wondering if it is possible to tweak some settings in ghPython so it is possible to define imports automatically. In this way, each time a new ghPython component gets created, multiple imports previously defined are automatically written.
For example, I noticed that the WIP version of ghPython always contains those lines:

"""Provides a scripting component.

Inputs:
x: The x script variable
y: The y script variable
Output:
a: The a output variable"""

__author__ = "Paul.Poinet"

import rhinoscriptsyntax as rs


I think it would be great if we were able to customize this part.

This question is probably more for Giulio but if anyone out there knows the answer I would be very interested.

Best,

Paul

Views: 622

Replies to This Discussion

Hey Paul,

This is already the case in Rhino 6 WIP, but if you're working in Rhino 5 the fastest way I can think of is to create a "template" user object. See attached.

Please note that it takes longer to instantiate this component because it's loading the libraries simultaneously.

Best,
/SPM

Attachments:

Hi Stephen!

Indeed creating a user object is doing the trick. I was imagining something more generic and native to ghpython itself but I will use this method, thanks!
I checked out Rhino 6 WIP but I will stick to v5 due to some unexplained crashes...

Best

Paul

You might add this request here as well :)

Actually, now that we're at it. I wonder if the GitHub repo issue tracker is still being used for development. There are quite a few old feature requests in there that would terrific (code-folding, minimize editor window comes to mind).

Done!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service