💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
How do I change this code?(deduct the overlapping area)
-
I want to deduct the overlapping area between componentinstance and componentinstance in model.
How do I change this code?
Thank you for your help!mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selectionas = mod.definitions["column"].instances
bs = mod.definitions["beam"].instanceshits = {} ### empty hash
as.each{|a|
es = a.parent.entities
hits[a]=[]
bs.each{|b|
next unless es = b.parent.entities ### same context
bb = a.bounds.intersect(b.bounds)
hits[a] << b if bb && bb.valid?
}
}
hits.each{|hit| puts "column #{hit[0]} intersects beam #{hit[1]}" }
Advertisement