sketchucation logo sketchucation
    • Login
    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)

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 394 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C Offline
      CEIT81729
      last edited by

      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 selection

      as = mod.definitions["column"].instances
      bs = mod.definitions["beam"].instances

      hits = {} ### 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]}" }


      00.skp

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement