hello,
could I get line start/end points without casting it into curve?
I see a file in the link below but that file has broken link
Thank you in advance, Dmitrey
hello,
could I get line start/end points without casting it into curve?
I see a file in the link below but that file has broken link
Thank you in advance, Dmitrey
The properties you are looking for are called âFromâ and âToââŚ
I tried it in my Python code, it yields message: âguidâ object has no attribute âFromâ
Then you deal with the wrong object. If you like to find the endpoints of a line, you obviously need to feed in a line and not a global unique identification number.
If itâs the GUID of an existing line (or curve) in Rhino, you can get the start/end points with rs.CurveStartPoint(obj_id) and rs.CurveEndPoint(obj_id)
âŚ
or
line=rs.coerceline(obj_id)
start=line.From
end=line.To
The function coerceline is absent in the Rhino.Python Dash Docset Rhino.Python Dash Docset , that seems to be quite outdated.
The link above I got from the Rhinoceros doc page https://developer.rhino3d.com/guides/rhinopython/ . Will the docset be updated in nearest time?
Regards, D.
Yep, the âcoerceâ functions seem to be âhidden secretsâ⌠They donât show up here either:
Isnât calling it âcoerceâŚâ kind of unlucky? âgetObjectFromIDâ or something similar would be much more obvious. Or is there a reason for this naming?
Why? You force, pressure a GUID object to be a geometry object.
Yes, there is a reason - the âcoerceâŚâ functions actually try to return the desired object geometry from diverse input types, not just one. For example, coerceline will return a RC line object if you input a GUID, a linear curve, or a list of pointsâŚ
Edit: this does seem to have some roots in computer terminology as wellâŚ
Iâd like to see that in Grasshopper
The list with a single element I mean.
A few years ago, we tried to improve this situation and make things easier and more understandable by adding CreateX functions to Rhinoscriptsyntax. The problem was especially considerable in GhPython, where often users need points, vectors ect, rather than tuples, guid, etc. @scottd brought this up originally while writing the dev docs.
In general, CreateX functions do what coerceX* function do, but have the goal of being usable with good syntax, have a more coherent naming, and do not have to have the restrictions of being service functions used under the hood.
I worked on implementing a few of them: RH-37985. Most of them are available since Rhino 6 SR0.
The term âcoerceâ is just quite odd, at least if you type it in a english to german translatorâŚ
This is because they were originally only meant to be service functions. They are also counterintuitively cased. This was discussed a couple of years ago, and the decision was to add âgood, more consistentâ functions to the library. I worked on adding a few that were the most requested.
Hey @dmitrey15
Youâre absolutely right: the docsets are out-dated. Iâve had this TODO item on my list for far too long:
WWW-359 Autogenerate Dash docsets as part of CI process from the same docs found on developer.rhino3d.com
A post was split to a new topic: Is there an rs.createbrep function now?