sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Dynamic non-component

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 244 Views 2 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.
    • B Offline
      Builder Boy
      last edited by

      I wanted to use this with my pipe tool, but wasn't sure how. I guess that this is as good of a start as any:


      Try to scale the face along the red axis

      All my plugins

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        I'm not sure what you're trying to achieve...
        This might help [a bit] - it traps errors ..........

             class MyEntitiesObserver < Sketchup;;EntityObserver
               def onChangeEntity(entity)
                   width = entity.bounds.width.to_f
                   model = Sketchup.active_model
                   entities = model.active_entities
                   pts = []
                   pts[0] = [0, 0, 0]
                   pts[1] = [width, 0, 0]
                   pts[2] = [width, width*2.0, 0]
                   pts[3] = [0, width*2.0, 0]
                  begin
                   face = entities.add_face pts
                   face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
                   entity.edges.each{|i| i.erase! if not e.edges[1]}
                  rescue
                   puts 'error'
                   face.remove_observer($mmmmmmmmmmmmmmmmmmmmm)
                   face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
                  end
               end
             end
        
         model = Sketchup.active_model
         entities = model.active_entities
         pts = []
         pts[0] = [0, 0, 0]
         pts[1] = [1, 0, 0]
         pts[2] = [1, 2, 0]
         pts[3] = [0, 2, 0]
         face = entities.add_face pts
        $mmmmmmmmmmmmmmmmmmmmm=MyEntitiesObserver.new()
         face.add_observer($mmmmmmmmmmmmmmmmmmmmm)
        

        I suggest you rename your observer as something less obvious... i.e. others might have used it !

        TIG

        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