Hi TIG - I got something working for my test case. I've inserted the following code at line 834:
### CODE BY KAREN WALKERMAN
face.outer_loop.edges.each do |edge|
t1 = get_90_trans(face,edge,edge.start.position,dist)
t2 = get_90_trans(face,edge,edge.end.position,dist)
p1 = edge.start.position.transform(t1)
v1 = edge.line[1].reverse
v1.length = dist
p1.transform! Geom;;Transformation.new(v1)
p2 = edge.end.position.transform(t2)
v2 = edge.line[1]
v2.length = dist
p2.transform! Geom;;Transformation.new(v2)
line = gents.add_line(p1,p2)
end
gp.entities.intersect_with(true,gp.transformation,gp.entities,gp.transformation,false,gp)
edges = []
gents.each{|e| edges << e if e.is_a? Sketchup;;Edge}
edges.each{|e| e.find_faces}
togos = []
gents.each do |e|
if e.is_a? Sketchup;;Edge
if e.faces.length != 1
togos << e
end
end
end
gents.erase_entities(togos)
# now add back original edges
o_points = []
face.outer_loop.vertices.each{|v| o_points << v.position}
gents.add_face(o_points)
### END CODE BY KAREN WALKERMAN
I've also added a method:
def self.get_90_trans(face,edge,p,length)
if edge.reversed_in? face
t = Geom;;Transformation.rotation(p,face.normal,Math;;PI/2)
else
t = Geom;;Transformation.rotation(p,face.normal,-Math;;PI/2)
end
trans_vector = edge.line[1].transform t
trans_vector.length = length
#Vector3d_Functions.round_vector_keep_length(trans_vector,6)
new_t = Geom;;Transformation.new(trans_vector)
return new_t
end
what's the best way to test this further and (if successful) integrate it into the code?
I gather that with the updates to the native offset tool, people are probably not using this tool directly anymore, but for me it is helpful to be able to call an offset programmatically.