I’m sure others have run into this as well so I want to put the question out there to see if anyone has found a solution to the issue.
I’m trying to use the follow me tool within the API to draw a quarter turn with the face being either round or rectangular however the arc does not terminate with orthogonal ends so the resulting solid or revolution is never 90 degrees as one would expect:
There is a little hack you can do when drawing this manually by rotating the circle by half a segment but that doesn’t help much when drawing this via the API.
For the rectangular case I can simply draw the two arcs and lines and push push pull in the Z direction but for the oval or round case I am forced to used the follow me tool, or attempt some sort of edge algorithm that draws the entire thing manually.
Here is my method how to create the path, used long time ago one of my old plugin, I copy pasted here with my original comments, without modification, hope you will understand…
segment: the number of segments in the arc (Integer) angle: the angle of the arc (radians) radius: the radius of the arc (Length)
# Get the vertices of curve of bend. If we are using 'arc', the start and end edge is not perpendicular to radius...
# so the "extruded" bend looks ugly... Here we will modify the 'arc' start and end edges
# I like this more than other method... :-)
# The bend will be created in the origin of model (0,0,0),
# then later on will be transformed to desired place.
c = []
0.upto(segment) do |i| # according to bend segments we are doing something on each vertex
# Normally the vertices coordinates calculated by simple sin/cos rule
c[i] = Geom::Point3d.new 0,radius-radius*Math.cos((i*angle/segment)),radius*Math.sin((i*angle/segment))
# the second point y-cord will be same as first point y-cord,
# so the first edge will be perpendicular to base circle (parallel to z axis)
if i == 1
c[i] = Geom::Point3d.new 0,radius-radius*Math.cos(((i-1)*angle/segment)),radius*Math.sin((i*angle/segment))
end #if
# The vertex before last must be moved too:
if i == (segment-1)
c[i+1] = Geom::Point3d.new 0,radius-radius*Math.cos(((i+1)*angle/segment)),radius*Math.sin(((i+1)*angle/segment)) # we need the last point
# get a vector what is perpendicular to last radius edge:
v2 = Geom::Vector3d.new 0,Math.sin(((i+1)*angle/segment)),Math.cos(((i+1)*angle/segment))
# this vector is perpendicular to v2
v1 = Geom::Vector3d.new 0,-Math.cos(((i+1)*angle/segment)),Math.sin(((i+1)*angle/segment))
# if only two segments this vector is perpendicular to first radius edge
v1 = Geom::Vector3d.new 0,Math.sin(((i-1)*angle/segment)),Math.cos(((i-1)*angle/segment)) if segment == 2
# line from before last vertex
line1 = [c[i],v1]
# line from first vertex if only two segments
line1 = [c[i-1],v1] if segment == 2
# line from end vertex
line2 = [c[i+1],v2]
# intersect the two line will give the right vertex
c[i] = Geom.intersect_line_line(line1, line2)
end #if
end #upto
path = Sketchup.active_model.entities.add_curve(c)
#or
#path = Sketchup.active_model.entities.add_edges(c)
That is what I was afraid of. I do like the idea of creating the face then rotating/copying it multiple times and then connecting the appropriate edges to create the face, however this seems like so much more effort than to just use the built-in follow me method/tool.
There are many, many posts by Dave and others that tell the forum that the followme face must be perpendicular to the path. So, yes adjusting your path so that it starts and ends perpendicular to the face’s plane is the right way.
That start face needed to be reversed, I’ll fix that when I implement my solution. I’m just trying to figure out the easiest and most practical way to address this topological problem caused by the Follow Me tool.
P.S.
I’ve posted a new post but it says waiting approval. I’ve never seen this before in the forum. Is it because I posted code?
did you use a word starting with cra and ending with ck in it ? like “I craked it” or something ?
they are trying an antispam that would send messages with specific words to moderation.
Okay, let’s try this again. I did not know that certain commonly used words were banned. Here is my first attempt at this, maybe a little clunky and not 100% robust yet but it does seem to work: