Wish: Add Grasshopper libraries folder to default module paths read by GHPython · Issue #66 · mcneel

Wish: Add Grasshopper libraries folder to default module paths read by GHPython #66

Comments

Copy link Quote reply

AndersDeleuran commented Mar 27, 2014

We just finished a workshop in which we issued several Python modules. To install these we had the students place the modules in the default Grasshopper library folder:

The main motivation being that they were already asked to install the GHPython and Kangaroo dependencies and thus «knew» this folder and could easily access it from the Grasshopper GUI (File -> Special Folders -> Components Folder). To read the modules we would add the folder path using sys.path.append(ghLibPath) in the respective scripting components.

While this works it would have been great if it was already added to the path. I am aware that one can add a folder using the «EditPythonScript» editor and «Tools -> Options -> Files». However this interface is clunky at best (try adding a folder under C:users on a vanilla Windows machine). I am also aware that RhinoPython/GHPython already reads this path:

However I think it is reasonable to assume that it is not only easier to ask «a user» to only install dependencies in one folder. But moreover I find myself experimenting with several GH assemblies using Python lately (mainly Kangaroo and Plankton).

For these reasons it would be great if the Grasshopper libraries folder would be added to the default module paths read by GHPython.

github.com

Grasshopper library folder

Grasshopper plugin for programming ABB, KUKA and UR robots for custom applications. Special care is taken to have feature parity between all manufacturers and have them behave as similar as possible. The plugin can also be used as a .NET library to create robot programs through scripting inside Rhino (using Python, C# or VB.NET). Advanced functionality is only exposed through scripting.

Navigate this page:

  • Get the robots.gha file from the latest release.
  • Get one or more robot libraries (they work with the Bartlett robot library).
  • Get the example files.
  • Windows 7 or above
  • .NET Framework 4.0
  • Rhinoceros 3D 5 SR13 64 bit
  • Grasshopper 0.9.0076
  1. Download the robots.gha and robots.dll files from the latest release.
  • Open the folder that contains the downloaded files, right click on them individually, select properties and click on Unblock.
  • Place the files on the Grasshopper components folder. You can find this folder through the Grasshopper menu by clicking on File, Special Folders, Components Folder.
  • In your Windows Documents folder, create a subfolder named Robots and place the XML and 3DM files that correspond to one ore more robot libraries.
  • Open Rhino, run the Rhino command GrasshopperDeveloperSettings and disable «Memory load *.GHA assemblies using COFF byte arrays».
  • Restart Rhino and open Grasshopper. There should be a new tab in Grasshopper named Robots.

Adding a custom robot

Visit the robot libraries section for instructions on how to add your own robot cells.

As with Rhino, the plugin uses a right-handed coordinate system. The main coordinate systems are:

  • World coordinate system: It’s the Rhino document’s coordinate system. Cartesian robot targets are defined in this system. They’re transformed to the robot coordinate system during post-processing.
  • Robot coordinate system: Used to position the robot in reference to the world coordinate system. By default robots are place in the world XY plane. The X axis points away from the front of the robot, the Z axis points vertically.
  • Tool coordinate system: Used to define the position and orientation of the TCP relative to the flange. The Z axis points away from the flange (normal to the flange), the X axis points downwards.

The plugin always uses the same units irrespective of the robot type or document settings.

  • Length: Millimeters
  • Angle: Radians
  • Weight: Kilograms
  • Time: Seconds
  • Linear speed: Millimeters per second
  • Angular speed: Radians per second

Uploading the program to a robot

Most robot controllers from ABB, KUKA and UR support uploading a program through a USB port. Use the «Save program» component to create a file of the program and copy it to a USB drive. Use this method if your controller doesn’t have network support.

The fastest way is upload the program through a network connection. If you use a LAN cable to connect directly your PC to a KUKA or UR controller, you’ll need to know the IP of the controller and assign an IP manually to your PC in your network adapter settings. ABB controllers (IRC5) include a DHCP server, so you don’t need to set an IP address. If you use a router with DHCP server to connect to KUKA or UR controllers you can set both the IP of your PC and controller to automatic. The following is the currently preferred upload method for each robot manufacturer (more integration of the upload process within Grasshopper is planned):

  1. KUKA controllers run on top of Windows. Create a shared folder in the controller as you would in a Windows PC. You’ll need to know the a username and password to access the shared folders (the default username and password depend on the controller version).
  2. In Grasshopper, use the «Save program» component and set the folder path to point to the shared folder.
  3. Use the pendant to copy the program from the shared folder to the program folder to be able to select it.
  1. If the program is not very long, use the «Remote UR» component to establish an TCP connection to the controller. You can then stream the program to the controller directly from Grasshopper.
  2. If the program is long, or you want to upload multiple files, you can use an FTP client (that supports a secure connection) to upload the program.
  • In the latest version you can use the Remote component directly from Grasshopper to upload, load and optionally run the program on the controller. You’ll need to install the Robot Communication Runtime if you don’t have RobotStudio installed.

Instructions for uploading with Robot Studio

github.com

Grasshopper library folder

Hi there, welcome to Discover!

Discover is an optimization tool built to work with Rhino Grasshopper. It is being developed by Colidescope as free software with the goal of promoting performance-driven automated design workflows in the architecture, engineering, and construction industries.

A general overview of Discover’s features can be found on the product page: https://colidescope.com/products/, while the video above will take you step by step through the process of installing Discover and connecting it to your Rhino Grasshopper models.

Requirements

  • PC running Windows 10 64-bit
  • Rhino 6 — Discover can probably be made to work with Rhino 5 as well as the OSX version but it is not supported at this time.
  • Python 3.7
  • Web browser (such as Chrome or Firefox)

Installation

Installing Python

Currently Windows does not ship with Python, so if you’ve never used Python or you’re not sure, you will need to install a version of Python on your computer.

Discover is built using Python 3.7.4 but any version of Python 3.7 should work. Due to compatibility issues with some of its libraries, Discover does not currently work with Python 3.8. If you’d like to use Python 2 it can probably be made to work but it is not supported at this time. If you already have Python 3.7 installed you can skip to the next step.

  1. Go to the Python download page and select the latest Python 3.7 release (3.7.4 at time of writing).
  2. On the download page, scroll down and under ‘Files’ select and download the Windows x86-64 executable installer.
  3. Run the .exe installation file to install Python on your computer. IMPORTANT: make sure you select the option to “Add Python 3.7 to PATH”. Discover will not work if this is not checked.

Downloading Discover

  1. Click on the download link on the left to download a zip file with the latest release of Discover
  2. Unzip the file to a new folder on your computer.

Installing dependencies

  1. Double-click the discover.bat script in the folder where you unzipped Discover. This will launch a new Command Prompt window where the Discover server will run. The first time you run the script it will install any dependencies which are needed for Python. This only needs to happen once. After checking the dependencies the script will start the Discover server and launch the app in your default web browser.
  2. Windows may ask for admin privileges the first time you run the server. Make sure to click ‘Allow access’. You should only have to do this once.

You should now see the Discover interface appear in the launched browser window. To make sure everything is working, run a default test optimization by clicking “Run”. You should see the scatter plot populate with test data similar to this:

If you initially get a blank page or a “site not found” error, wait a few moments for the server to boot up and then try to refresh the page. If the interface still does not appear, check the Command Prompt window. If you see any errors, take a screenshot of the Command Prompt window and send it to the email address provided in the support section of this page. If the Command Prompt window is no longer running, follow the instructions in the support section of this page.

Installing the Grasshopper components

Discover includes a Grasshopper library of custom components which allows the Discover server to communicate with your Grasshopper model. To install the components:

  1. Open Grasshopper and go to File -> Special Folders -> Components Folder . This will open the folder where Grasshopper stores its custom plugin files.
  2. Copy all the files in the /Grasshopper Plugin folder of the Discover zip file to Grasshopper’s Components Folder .
  3. Restart Rhino and Grasshopper. You should now see a new tab in the ribbon called ‘Discover’ with the 7 Discover components loaded.

Working with Discover

Starting the server

Double-click the discover.bat script in the folder where you unzipped Discover. This will open a Command Prompt window, start the Discover server, and launch the app in your default web browser. Make sure to keep the Command Prompt window open while you’re using Discover.

Shutting down the server

When you’re done using Discover, close the Command Prompt window to shut down the server.

Known issues

  • During the optimization process, Discover writes certain files to a local directory for each computed design. The location of this directory is based on the location of the Grasshopper (.gh) file. There is a known issue where if your Grasshopper file is in a folder which is hosted on a network or a cloud sharing service like Dropbox, the writing process can take too long, causing the components and server to get out of sync. This can result in the optimization process stopping or many of the same designs being generated at once. If you experience these issues, make sure your Grasshopper file is located in a local folder on your computer and is not being shared over any network.

Support

Disclaimer: This program is distributed for free in the hope that it will be useful, but without any warranty or guarantee that it will work the way it’s described or work at all.

If you have trouble installing Discover or getting it to run, please follow these instructions:

  1. Go to the folder where you unzipped Discover. This is where the ‘discover.bat’ file is.
  2. While holding SHIFT, right click anywhere in the folder (not on a file) and select ‘Open Command Prompt window here’ or ‘Open PowerShell window here’ (12/24/2019: There seem to be issues with running the virtual environment commands from PowerShell. If you don’t see ‘Open Command Prompt window here’ open Command Prompt manually by searching for it in the Windows Start menu. Then navigate to the local Discover folder by typing ‘cd ‘ followed by the path — for example ‘cd C:DownloadsDiscover’
  3. Type this command and hit Enter: python -m venv env
  4. Type this command and hit Enter: .envScriptsactivate.bat
  5. Type this command and hit Enter: pip install -r requirements.txt
  6. Type this command and hit Enter: python server.py
  7. If you see an error in the Command Prompt at any point during this process, take a screenshot of the command prompt and send it to [email protected] with a description of the steps you took during installation.

If you find a bug in Discover, you can submit it to the development team using the link below. If you include an email address we will notify you when we release a fix.

colidescope.github.io

Grasshopper library folders

I am a newbie to grasshopper but did not find this simple topic anywhere

Making a new component

This component links to a lot of dll’s so i would like to keep a clean

folder with all these files

How can i add a new library Folder to grassopper so it loads

my component at runtime ?

Replies to This Discussion

there are some solutions:

  • Implement an Assembly Resolver in your GHA and load the referenced dlls from the appropriate location.
  • Put all your files into a subfolder of the Libraries folder.
  • Change the Assemblies:Folders entry in the grasshopper_kernel.xml file to include your folder (legacy solution, not recommended).
  • Install your files using an RHI installer, Grasshopper will automatically peruse those locations.
  • Put a *.ghlink file into the Libraries folder which contains a line of text with your actual folder location. This is the recommended solution to be used for GHA installers.

If this is just for you personally rather than for your users, you can add an extra search folder via the GrasshopperDeveloperSettings command. This basically amounts to doing option 3, but nicely through the Grasshopper UI rather than dicking about with xml files.

Options 4 and 5 are definitely my recommendation. They are clean solutions that use the SDK the way it has been designed.

A GHLINK file can contain any number (including zero) of lines. When a line starts with «#» or «//» then it will be ignored. Every other line is presumed to indicate a folder from which GHA files ought to be loaded. If the folder doesn’t exist it is simply skipped.

www.grasshopper3d.com

Grasshopper library folders

I am a newbie to grasshopper but did not find this simple topic anywhere

Making a new component

This component links to a lot of dll’s so i would like to keep a clean

folder with all these files

How can i add a new library Folder to grassopper so it loads

my component at runtime ?

Replies to This Discussion

there are some solutions:

  • Implement an Assembly Resolver in your GHA and load the referenced dlls from the appropriate location.
  • Put all your files into a subfolder of the Libraries folder.
  • Change the Assemblies:Folders entry in the grasshopper_kernel.xml file to include your folder (legacy solution, not recommended).
  • Install your files using an RHI installer, Grasshopper will automatically peruse those locations.
  • Put a *.ghlink file into the Libraries folder which contains a line of text with your actual folder location. This is the recommended solution to be used for GHA installers.

If this is just for you personally rather than for your users, you can add an extra search folder via the GrasshopperDeveloperSettings command. This basically amounts to doing option 3, but nicely through the Grasshopper UI rather than dicking about with xml files.

Options 4 and 5 are definitely my recommendation. They are clean solutions that use the SDK the way it has been designed.

A GHLINK file can contain any number (including zero) of lines. When a line starts with «#» or «//» then it will be ignored. Every other line is presumed to indicate a folder from which GHA files ought to be loaded. If the folder doesn’t exist it is simply skipped.

www.grasshopper3d.com

Food4Rhino

FlexHopper offers very fast, particle-based physics simulation within Grasshopper. It let’s you simulate unconstraint particles, fluids, rigid and soft bodies, textile and spring system, inflatables and a combination of all these materials in one scene at unparalleled speed. You can add collision geometry, define custom constraints and emit new particles during runtime.
FlexHopper is based on FlexCLI, an open-source C++/CLI interface to access the physics engine NVidia Flex from within the .Net environment. FlexCLI and FlexHopper were developed by myself. It is built against NVidia Flex release 1.1.0 which is patented property of NVidia.

FlexCLI runs on x64 architectures only. It was built against .Net 4.5.2. It was tested with Rhino 6 64bit and Grasshopper 1.0.0076

Find the code here:

And videos with tutorials here:

Contact info:
[email protected]
[email protected]
https://www.linkedin.com/in/benjamin-felbrich/
https://twitter.com/BFelbrich

HARDWARE REQUIREMENTS NVIDIA FLEX

A dedicated NVidia and AMD graphics card supporting DirectX11 and running one of the following drivers:
Nvidia Geforce Game Ready Driver 372.90 or above
AMD Radeon Driver version 16.9.1 or above
Onboard graphic chips like Intel HD Graphics 4000 are not supported and might crash your system

Please follow the instructions under one of these options:

Make sure your machine fulfills the hardware requirements (see above).

Make sure you have the latest version of Rhino 6 64bit along with the latest version of Grasshopper installed (in Rhino click «Help» > «Check for Updates»)

Download latest version

Unzip the package and go to the Libraries folder. It should contain:

FlexHopper.gha
FlexCLI.dll
NvFlexExtReleaseD3D_x64.dll
NvFlexReleaseD3D_x64.dll
amd_ags_x64.dll

unpack all files into your Grasshopper Components Folder (usually in ‘C:UsersYOUR-USER-NAMEAppDataRoamingGrasshopperLibraries’)
. if you can’t find that folder, open Grasshopper, click «File > Special Folders > Components Folder»
(Alternatively to food4rhino you can download the necessary files from the «/bin/Release» folder on this very website)

Unlock all .dll and .gha files (Right click each of them individually -> Properties -> Tick Unlock)

Start up Rhino 6 in 64bit Mode and start using FlexHopper

Check out the example files in Example files/Flexhopper. But don’t rely too much on them, they may be outdated (sorry)

FlexHopper only works with Rhino 6 64bit.
If you receive an error message saying that FlexCLI or one of its dependecies could not be loaded, make sure to:
A. Unlock all FlexHopper related files in the Library folder (Right click -> properties)
B. Update your Rhino 6 to the latest version.
C. Start up Rhino 6 in 64bit mode
If your machine crashes upon resetting the FlexHopper engine:
A. Make sure your computer fulfills the hardware requirements (see above)
B. Consider reducing the memory your FlexHopper requires by adjusting the memQ input in the Flex Solver Options accordingly

www.food4rhino.com

shifted lines between circles

Creates shifted lines between circles.

For: grasshopper 8

Curvature Analysis

Analyzes a curve in terms of its curvature and puts out absolute curvature values as well as relative colors.

For: Grasshopper 9

MinBoundingBox2d

returns the minimal bounding box acc. to one or more planes without using galapagos — returns a box and new system plane (derived from an idea by anrew heumann)

HexaGridOnSurface component

Draws Hexagonal Cells on input surfaces

For: Grasshopper 9.X

separatrix (polyhedra)

returns the separatrix — the line that differentiates lit and dark faces of a polyhedra (works only for solids with planar faces) it is useful because the separatrix can be used with a Project onto brep component in order to find out the cast shadow of

Surface from Image

Sample the brightness of an image to set the height of undulation of a surface.

For: Grasshopper .08

Triangluate surface for physical building

Take any surface and break it up into triangles to get that http://www.archdaily.com/243128/myzeil-shopping-mall-studio-fuksas/ look. Text tags are enabled so you can laser cut the triangles and easily build them. Based on the videos from http://digitalto

For: Grasshopper .08

Contour and move

Great for making laser cut files for topographies. Also a great tool for looking at floor plates of a tall building, and to calculate total square footage.

For: Grasshopper .08

Lego bricks from rectangles

Draw a rectangle in Rhino and it will turn it into a lego brick which you can 3D print or use for computer modeling.

For: Grasshopper .08

Planting Plan Generator

Generates a time-based representation of a planting plan.

For: Grasshopper 0.9 + GhPython

Voxelator

Voxelates any given Brep and puts out a number of boxes according to the specified U, V & W integers and a base plane.

For: Grasshopper 9.0

pixelator

pixelates a shape defined by a closed polyline, given desired pixel sizes in U & V directions.

www.parametricmodel.com

Share:
No comments

Добавить комментарий

Your e-mail will not be published. All fields are required.

×
Recommend