A Bug using Sketchup::Entities#intersect_with()

intersect
bug

#1

I use " Entities.intersect_with" to do something recently,but I find there is a bug about the function,when I execute the code in model which existing “c_line”,my Sketchup crashes . After testing many times , I find this bug exist in Sketchup 2016 and above,in Sketchup 2015,it can work well.
Below is my code:

grpss = ents.grep(Sketchup::Group)
grps = grp.entities
Sketchup.active_model.start_operation(“干挂石材”)
grpss.each{|gr|
if gr != grp
grps.intersect_with(false, grp.transformation, grps, grp.transformation, true, gr)#模型交错
end
p gr
}
Sketchup.active_model.commit_operation

000-测试模型.zip (74.4 KB)


#2

I agree this is a bug, the group containing only construction lines returns true for gr.valid? and should not crash SU, as it does…

the workaround is to make sure you have geometry in any group…

next unless gr.entities.grep(Sketchup::Edge).length > 0

john


#3

yea,you are right,thanks for your help.