hi all,
how can i check out the coordinates of an input point. ?
thy !
hi all,
how can i check out the coordinates of an input point. ?
thy !
Hi pyrit
coord=Rs.PointCoordinates(idpoint)
Ciao Vittorio
ciao vittorio,
thx for the answer.
i do not really understand why in python its that kind of complicated for my understanding.
what would be the equivalent to the c#
A = pt.X;
because with the python
coord=Rs.PointCoordinates(idpoint)
which gives an array of the xyz values.
im thinking about learning c#or/and python, python is somehow nice and easy with all the datatypoe stuff, but the above described makes me wonder ...
could anyone tell me why these concepts seem to differ so ?
thx !
Vittorio has given you the rhinoscriptsyntax method, which is an adapatation of a simplified scripting language for Rhino into Python. You may also use RhinoCommon in Python which is lower level. If your input point "pt" is a Rhino point3D object, it will have properties .X, .Y, and .Z as in pt.X (like your C# example) and you can use those.
In general RhinoCommon, being lower level, is more complicated than the Rhinoscriptsyntax, but also more powerful. You can decide which is best for you, you can also mix the two.
http://www.rhino3d.com/5/rhinocommon/
http://www.rhino3d.com/5/ironpython/index.html
--Mitch
thanks for pointing that out !
What would you recommend to start with ?
i assume that methods in rhinocommon also apply to c# ?
why is the rc more complicated to use ?
thanks for helpin
Hi pyrit
The following example shows the difference between id_point and Point3D:
Python Code:
import rhinoscriptsyntax as rsidp=rs.GetObject("select point",1)#the point is an object pointprint "idp=",idpif idp!=None:coord_idp=rs.PointCoordinates(idp)print "coord0 ",coord_idpprint coord_idp[0]p=rs.GetPoint("get point")print "point coordinates=",pprint p.X
Ciao Vittorio
Last edited by vittorio; 07-17-2012 at 02:12 PM.
If you are asking which programming language to start with, everyone is going to recommend something different. If you have done some scripting in the past with RhinoScript, the python should be a nice next step. All of the languages are just as powerful as each other, it just takes getting used to the syntax.
That is true. Python, C#, and VB.NET all have full access to the RhinoCommon SDK when running inside of Rhino
RhinoCommon is a bit more complicated to use than the rhinoscriptsyntax library since you need to learn more low-level details to get anything done. The nice thing about rhinoscriptsyntax is that it is built on top of RhinoCommon so you can look at functions in the library to figure out how to make things work in RhinoCommon. The library is simply a higher level set of functions that make a bunch of calls into RhinoCommon to get something done.
Hope that helps,
-Steve
hi guys,
i think python is a good choice, especially because also some nice opensource programms are written with it...
that goes well with python script editorCode:p=rs.GetPoint("get point") print "point coordinates=",p print p.X
how can i do this with an input point from gh.
with my example c# i can do it.
if i try with python
it givesCode:import math import rhinoscriptsyntax as rs a = pt.X
0. Runtime error (MissingMemberException): 'Guid' object has no attribute 'X'
1. Traceback: ine 5, in script
Hi,
I think this is because GH treats points as if they are all point objects with a GUID - all the components which output a point, are actually outputting a GUID (despite the fact that you see the point coordinates in a panel if you connect one)... at least that's my theory.
So, the following works (assume you have a point being input to an input called "pt"):
python Code:
import rhinoscriptsyntax as rs#pt.X <-- will error out, but:ptc=rs.coerce3dpoint(pt)print ptc.X#works
So I actually had to coerce the point object ID input to a point3D object by using rs.coerce3dpoint
--Mitch