Draw on face
-
I'm not trying to make a tattoo on my face ,just want to detect ,if the line (edge) that I draw,is on the face.
Example:model.active_entities.add_line( start, end )
Now I want an information if this entire line is on some face.
-
http://code.google.com/apis/sketchup/docs/ourdoc/face.html#classify_point
If you have a reference to the face use:
face.classify_point(point)
for start and end points
What's returned depends on where the point is, thus:0: Sketchup::Face::PointUnknown (indicates an error),
1: Sketchup::Face::PointInside (point is on the face, not in a hole),
2: Sketchup::Face::PointOnVertex (point touches a vertex),
4: Sketchup::Face::PointOnEdge (point is on an edge),
16: Sketchup::Face::PointOutside (point outside the face or in a hole),
32: Sketchup::Face::PointNotOnPlane (point off the face's plane).It is important that return value comparisons be made against the symbolic constants (i.e. Sketchup::Face::PointUnknown, Sketchup::Face::PointInside, Sketchup::Face::PointOnVertex, etc.) rather than the absolute integer values as these values may change from one release to the next. You can't combine integer values so a point that is 'on an edge' might be true while 'on the face might be false'; and vice versa... of course you can take 'on face', 'on edge' and 'on vertex' all as good results - but the rest as bad if that's what you want...
-
Uff,I missed this one,thanks.
The only problem that I see is that I need a reference to the face.So ,if I don't have it,I have to loop all faces.That is not very nice
I have another solution in my mind,but didn't test jet: edge.faces.length should be more than 0.
But I'm not shure if the line that I draw on the face will be somehow connected with the face.
I remember the old versions of sketchup,where the line was floating on the face (bold). -
A line added in code will NOT split a face/edges unless you call some sort of
entities.intersect_with()
method...
If the line is being added in in code you can check the picked points with apick_helper
to see if a face is picked under the point. Then you know the face is under a point, what the face is and then check that both points are on the same face ?
http://code.google.com/apis/sketchup/docs/ourdoc/pickhelper.html#picked_face
Advertisement