Hello to all,
I have a hard to master the vertices of the curves and the arc of circle in order to obtain the "pushable" of complex figures faces. Could someone explain to me why the first program works and not the second?
# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
vector = Geom::Vector3d.new 0,0,1
xaxis = Geom::Vector3d.new 1,0,0
center = Geom::Point3d.new 0, 0, -1
normal = vector.normalize!
pi = Math::PI
start_a = 0.0
end_a = pi/2
x1 = 10
y1 = 10
z1 = 0.0
x2 = 10
y2 = 20
x3 = 20
y3 = 10
pt1 = Geom::Point3d.new x2, y2, 0
pt2 = Geom::Point3d.new x1, y1, 0
pt3 = Geom::Point3d.new x3, y3, 0
pts = []
pts << pt1
pts << pt2
pts << pt3
r = 10
c = Geom::Point3d.new x1, y1, z1
edgearray = ent.add_arc c, xaxis, normal, r , start_a, end_a, 5
edge = edgearray[0]
curve = edge.curve
vertices = curve.vertices
for i in (1..vertices.length-1)
pts << vertices[i].position
puts vertices[i].position
end
#pts << pts[0]
face = ent.add_face (pts)
# Default code, use or delete...
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
vector = Geom::Vector3d.new 0,0,1
xaxis = Geom::Vector3d.new 1,0,0
center = Geom::Point3d.new 0, 0, -1
normal = vector.normalize!
pi = Math::PI
start_a = 3*pi/2
end_a = pi
x1 = 10
y1 = 10
z1 = 0.0
x2 = 10
y2 = 20
x3 = 20
y3 = 10
pt1 = Geom::Point3d.new x2, y2, 0
pt2 = Geom::Point3d.new x1, y1, 0
pt3 = Geom::Point3d.new x3, y3, 0
pts = []
ptsarc = []
pts << pt1
pts << pt2
pts << pt3
r = 10
c = Geom::Point3d.new x3, y2, z1
edgearray = ent.add_arc c, xaxis, normal, r , start_a,end_a, 5
edge = edgearray[0]
curve = edge.curve
vertices = curve.vertices
for i in (0...vertices.length)
pts << vertices[i].position
ptsarc << vertices[i].position
puts vertices[i].position
end
#pts << pts[0]
fig = ent.add_curve (pts)
#face = ent.add_face (fig)
Yet, they are built on the same principles.
Thanks in advance