Circle orientation other than Z_axis?
-
I'm in need for some code to orient a circle forming a stair railing, which needs to be normal to the riser/tread triangular relationship
see attachment.edges = entities.add_edges(@pt1, @pt2) circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16) base = entities.add_face(circle) base.back_material = Sketchup;;Color.new (255,200,100) base.followme(edges)
-
An edge has a 'line'.
That's a two element array of the start point and its vector.
Sopoint=edge.line[0]
andvector=edge.line[1]
Use 'vector' instead of an 'axis' and also the 'center' can be 'point'... -
@tig said:
An edge has a 'line'.
point=edge.line[0]
andvector=edge.line[1]
circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16)
do I replace the Z_AXIS code with your code?
-
circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16)
Your '
@pt1
' can be replaced with any point you specify - likeedge.line[0]
and the circle's 'normal' is any vector you specify - it doesn't have to be the z-axis [Z_AXIS
] so any vector, likeedge.line[1]
, will do as well...
The radius ['i.inch
'] in your code can also be whatever you want it to be...
And the '16
' that sets the umber of segments, can also be what you like... -
It took a while for your medication to be absorbed
vector = $pt2a - $pt1a edges1 = entities.add_edges($pt1a, $pt2a) circle = entities.add_circle($pt1a, vector, 1.inch, 16) base = entities.add_face(circle) base.back_material = Sketchup;;Color.new (255,200,100) #use RGB Color numbers base.followme(edges1)
using my coded example: subtracting the 2 points creates a 3d vector which is normal to any circle.
Advertisement