Hi, in near future I am going to create 3d model of cladding based on flat divided surfaces. Currently I am creating them manually with such technique:
Offset with double clicks on each face (multiple offset does not work properly, some faces are offsetting outside some inside, despite all faces are oriented properly)
Select all and deselect with double clicks on each face
Delete selection (faces between panels)
Maybe someone have done similar and have faster technique?
mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
SKETCHUP_CONSOLE.clear
faces = sel.grep(Sketchup::Face)
for f in faces
lines = []; ctr = f.bounds.center; pts = []
for e in f.edges
if e.faces.length==1
lines << [e.start.position,e.end.position]
else
poe = ctr.project_to_line(e.line)
vec = poe.vector_to(ctr).normalize
spt = e.start.position.offset(vec)
ept = e.end.position.offset(vec)
lines << [spt,ept]
end
end
for i in 0...lines.length
ipt = Geom.intersect_line_line(lines[i-1],lines[i])
pts << ipt if ipt
end
fac = ent.add_face(pts)
fac.pushpull 1,true
end
@sdmitch your code looks short and understandable, but I had a problem with its modifications. I’m going to start learning ruby, because it looks like it will solve many difficulties.