Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
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