sketchucation logo sketchucation
    • Login
    1. Home
    2. CEIT81729
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 11
    • Posts 19
    • Groups 1

    Topics

    • C

      How to see the results of this method?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      8
      0 Votes
      8 Posts
      769 Views
      TIGT
      @Jim Thanks, I knew there was something somewhere - but it was six and a half years ago ! To précis a version of AdamB's [much cleverer] code: def self.face_area(mat, context, tr) area = 0.0 context.entities.grep(Sketchup;;Group).each{|e| area += self.face_area(mat, e, e.transformation) } context.entities.grep(Sketchup;;Component_Instance).each{|i| area += self.face_area(mat, i.definition, i.transformation) } context.entities.grep(Sketchup;;Face).select{|f| f.material == mat }.each{|f| normal = f.normal binormal = Geom;;Vector3d.new(normal.y, normal.z, normal.x) tangent = (normal * binormal).normalize areascale = (tr * binormal).length * (tr * tangent).length area += ( f.area * areascale ) } return area end The 'mat' must be a reference to a model.material [or nil]... The 'context' must be either the model or a group or a definition [i.e. something that will have 'entities'] The transformation 'tr' must be a 'Geom::Transformation' - even it's 'blank', so the arguments are: (material, model, Geom::Transformation.new()) (material, group, group.transformation) (material, instance.definition, instance.transformation) The method returns the area of all faces within the context, included nested containers, and adjusts them to allow for any scaling of those containers... To apply transformations of nested containers which themselves are within transformed containers etc, you need to iterate the method within itself, passing/reapplying transformations [similar to the earlier example 'sum_area' method] which I have botched in here... Note how its 'self.' assumes it's called as a method within a module.
    • C

      How do I change this code?(deduct the overlapping area)

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      387 Views
      No one has replied
    • C

      How do I change the code?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      3
      0 Votes
      3 Posts
      561 Views
      C
      TO TIG: Thank you for your reply! If I want to get the component's dynamic attributes(lenx, leny...) by multiple components collision detection? and I will deduction of the overlapping area(multiple components) after... (1)multiple components collision detection (2)get the component's dynamic attributes(lenx, leny...) Thank you for your help!
    • C

      Collision Detection

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      568 Views
      No one has replied
    • C

      How to detect collisions between ComponentInstance?

      Watching Ignoring Scheduled Pinned Locked Moved Dynamic Components sketchup
      1
      0 Votes
      1 Posts
      2k Views
      No one has replied
    • C

      How to detect collisions between ComponentInstance?

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      418 Views
      No one has replied
    • C

      Automatically Calculate the Component's Area and Volume

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      427 Views
      No one has replied
    • C

      Detect object intersect

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      396 Views
      No one has replied
    • C

      Detect object intersect

      Watching Ignoring Scheduled Pinned Locked Moved Dynamic Components sketchup
      1
      0 Votes
      1 Posts
      2k Views
      No one has replied
    • C

      How to make toolbar in method(def..end) has parameters

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      9
      0 Votes
      9 Posts
      2k Views
      C
      Thanks for everybody help and advice The problem has been resolved
    • C

      Detect whether all elements of the model intersect

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      747 Views
      C
      Hello everyone I reference everyone's suggestion The successful implementation of the following code: mod = Sketchup.active_model ent = mod.entities grp = ent.grep(Sketchup::ComponentInstance) for i in 0...grp.length - 1 grp.each{ |g| next if g == grp[i] bb = Geom::BoundingBox.new.add(g.bounds.intersect(grp[i].bounds)) if bb.valid? puts "#{g.name.to_s} and #{grp[i].name.to_s} intersect" else puts "#{g.name.to_s} and #{grp[i].name.to_s} do not intersect" end bb.clear } end Next, I want to know how to calculate the model of dynamic properties of all objects (such as "Lenx", "Leny" ,"Lenz"...etc) after the object intersected the other object. The case description like this: First, detect all objects intersect situations like the above code Second, if name = "column" objects intersect name = "beam" objects(just a simple example) then, "column" objects dynamic properties("Lenx") deduction "beam" objects dynamic properties("Leny") Thank you for your advice and help [image: NS2n_01.JPG] [image: ZMDk_02.JPG]
    • 1 / 1