Grasshopper

algorithmic modeling for Rhino

Looking for General Advice on Creaitng Icons and Passing Data to Command Line

I have a few basic queries that I am sure a GH/Rhino wizz will be able to answer or have a quick psedocode answer for that may allow me to enjoy my week end outside for once..........

 

1. How do I write/read a series of strings representing say "mycurveline 1 5 6 " , where 1 is current index and 5 and 6 are the end vertices of the line, from the command line after initializing a custom Rhino command from my plug in? Say my plug in command "is getMyCurveLine", after initializing it, it reads 10 text strings represeting each curve line from a .txt file called "myLines.txt". As I understand it we have to first open a file stream and write the contents to teh command line within the rhno plug in command sub, and then read the strings from the command line.

 

(BTW, this whole apporach is a little alien to me after having worked with sending data to and from applicaitons directly through an API where no file stream is needed).

 

2. Are there any good tools out there for creating icons? How does one go about drawing an icon in the first place!!!

 

Cheers

 

Steve

Views: 490

Replies to This Discussion

1. Move this to the VB.NET and C# discussion group...

2. Seems like there's a lot of online software and plug-ins out there...

http://websitetips.com/graphics/icons/
Doh, I thought I had posted it there! Thanks for the head sup!
1. I'm not 100% clear on how your plugin works, but I am fairly certain your command line approach is wrong. The Rhino command history (the multiline bit above the command line) was never meant to be an accurate record of things past. It merely records whatever was written in the command line. If you need to read data from a textfile, I highly recommend reading it directly from a textfile rather than passing it through the command line.
Are you trying to communicate from a Grasshopper VB/C# component with a command in a custom Rhino plugin?

2. I use XaraX to create all my icons (with a little help from Rhino if the icon features complex 3D shapes, but I found its usually best to keep icons as 2D as possible). I suppose it would make sense to upload the Vector source files for all Grasshopper icons somewhere so people can harvest whatever they want from it.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
1. Thanks for the reply. Ive gone the txt file route - creating a temporary file stream for sending data to read in to Rhino. Im currently trying to connect to rhino using a rhino plug in. I hope to may be use this plug in with GH once I am confident it is working with rhino. Im still trying to get used ot the Rhino cimmand line based method of interatction!!!
2. Yes, some examples would be nice but hey, theres a lot of things I can think of that are nice..............
I sent you a private message, but happy to help here also.

Looks very similar to the work I've done with reading Structural Models from text files.

I haven't enabled a Grasshopper for reading an input file into a Grasshopper definition, but I have all the code there, so could enable it easily and quickly enough.

Which program are you linking Grasshopper to?

Cheers,

Jon
Im looking at linking to some old DR code I wrote, and then may be to excel.

Ive decided to go the route of creatign a temporary file stream to send data to Rhino. Im still getting used to the command like interface of Rhino. Its very differentto what I am used to with programming using API's. Its not bad, just different!!!

Cheers

Steve
You can control Rhino via command line (that's how I started programming it, from spreadsheets), but it has the best and most open API/SDK I've seen.

Let me check, you have seen this page: http://wiki.mcneel.com/developer/dotnetplugins
(and there is a c++ version).

The way I've set up all my software structure is it's primarily driven by the C# rhino plug-in dll, including calling this library from my grasshopper components. No interaction with the command line. If you're trying to control Rhino externally (from say excel environment) then I believe COM is the only way to do so.

If the above doesn't make sense, I think we need to see a small example of your command line programming to point you in the right direction.

Cheers,

Jon
Yep, I did see the rhino sdk and thats how im going to go. This is simply the dontnet.dll right?

Assuming psedo code right now; if you access an object form say Excel, you would write the following

dim xlApp as Excel.Application
dim xlRange as Excel.Range
xlRange = xlapp.Range(Cells(1,10))

Whereas it seems in Rhino, and with using the SDK, you would have to first create your plug in and create a custom call within a class in your plug-in which inherits the MRhinoCommand class and give a unique GUID to this call - "get points" for instance. This class also becomes a command line in Rhino which can be accsessed by typing "get points".

In other API's/SDKs ive used you dont have to do this. You access the program directly based on the object for each application using COM. This may be because these programs dont use command lines.

Am I missing something? WHen you call your commands you still have to run the command using rhino script I presume form within you external dll to get the data form Rhino?
That's basically the case yes. All things that happen to a Rhino document must happen from within commands. This bottlenecking is the only way we can keep close tabs on chances in the document which is vital for undo/redo purposes and eventhandlers. It's also much easier for us to handle exceptions that occur inside commands and not leave the entire program in an undefined state.

Steve is looking into providing some external access methodologies in RhinoCommon via Remoting and WCF, but I don't know the details of these investigations.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
2. Icons aren't that hard to create, but they are best done in a vector program like Adobe Illustrator, Xara, or InkScape (which is open source). There are 3 useful tips that I have for icons...Contrast, Clarity, and effective pixel usage.

Contrast is important because there just isn't that much space. The sharper the contrast, the more "readable" the icon will wind up being. Sometimes I do this by colors. Other times having a stroke along the edge of the shape can help as well. This is especially needed if you've got a foreground element on top of a background one.

Clarity is important because its very easy for icons to get muddled up, since they're so small. They need to be almost overly simplified because a lot of the details will get lost at that size. It also helps if the icon is easily identifiable with either the name of the command or what the command does. Sometimes this is quite hard, but it can help with the association btwn the command and the icon if you can make that connection.

Making good use of pixels, just comes down to understanding where strokes and things will lie and how the vector program will render the icon. For instance, if you have a vertical line its really going to be the most effective (visually) if it lies completely on a column of pixels (or two if its wider). If you just arbitrarily place that line, it might be a third on one column and two thirds on the other. Then when the vector program tries to write out the image, it will have to antialiaze that line, and it won't be nearly as clear. Most programs have the option to turn on a grid, which will allow you to see where each and every pixel will be. This can be helpful in aligning things effectively

HTH
Thanks Damian. A lot of useful tips, thank you for taking the time to reply. Im sure Ill be "picking you brain" in due course!!!

cheers

Steve
I use this to edit the Rhino Icons available on the wiki and also make my own ugly icons. It's not the program that makes them ugly, it's me.

http://www.qualibyte.com/pixelformer/

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service