Help With Rhinoscript To Python For Mac

Автор:
Help With Rhinoscript To Python For Mac Average ratng: 6,4/10 3655 votes

Aroving,

For Python scripting engine that runs on both the Windows and OSX Rhino as. Discussions for help on using these scripts can be found at: Rhino Scripting.

There are two ways to access the methods available to you in python. RhinoCommon is a library of methods that are very powerful but can be quite technical and more difficult for a first time user to understand. RhinoScript is a generally more straightforward and easy to use. You can think of it as a translation of RhinoCommon so that you don't have to write all the technical stuff.

In your first line you've said 'import rhinoscriptsyntax as rs'. To see the methods you can call from this library you can go to the help menu and choose 'Help for Rhinoscript'. It will show you a searchable window of all the the options you have. This is much easier for new users to learn than looking at the RhinoCommon SDK.

If you search the help file for 'BoundingBox' you'll get the screen capture below:

At the bottom you can see an example of how to use it. In your case you would replace the following lines:

2/ boxA=brepA.GetBoundingBox((0,0,0,)) --> boxA = rs.BoundingBox(brepA)

3/ boxB=brepB.GetBoundingBox((0,0,0,)) --> boxB = rs.BoundingBox(brepB)

The script you have written uses elements of both RhinoScript and RhinoCommonSDK. I would suggest you might start just using RhinoScript. See below, I have re-written the first 8 lines of your script using just RhinoScript:

import rhinoscriptsyntax as rs

#Get BoundingBox from breps.
BoundingBoxA = rs.BoundingBox(brepA) #Returns list of eight corner points.
BoundingBoxB = rs.BoundingBox(brepB)

#Get centre point of RhinoScript BoundingBox (which is a list of eight points).
boxA = rs.AddBox(BoundingBoxA) #Generate box from corner points
ptA = rs.SurfaceVolumeCentroid(boxA) #Get Volumetric Centroid of box
boxB = rs.AddBox(BoundingBoxB)
ptB = rs.SurfaceVolumeCentroid(boxB)

For reference the following will achieve the same thing using RhinoCommon, fewer lines, but more technical. There are a few other quirks as well, for example you have to explictly tell the python component what kind of object 'brepA' is. See below for example of same script in RhinoCommon:

import Rhino as rh

centerPtA = brepA.GetBoundingBox(rh.Geometry.Plane.WorldXY).Center
centerPtB = brepB.GetBoundingBox(rh.Geometry.Plane.WorldXY).Center

I'm not sure what you are trying to achieve overall and your loop doesn't make a lot of sense to me but I hope that clarifies some of the differences between the two libraries you can use.

August 6, 2015 1 Comment on Chromecast App for Mac Here are steps to download and install google Chromecast for Mac OS X: If you already configure Chromecast App to TV setup we can go to the next step to download and install google chromecast app for mac configuration. Lyft is a ride-sharing app on your Mac for fast, reliable rides in minutes – day or night. Chromecast browser extension. Step Four: How to use the Chromecast for Mac. Using the Chromecast on Mac is very simple. Chromecast for Mac is created for convenience and quickly lets you broadcast or cast media onto your TV. When you are using your Chrome Browser on Mac, you can press the cast extension on the toolbar. This will begin casting the entire browser on your TV!

Regards,

M