• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Webdialog and active_model

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 1.3k Views
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.
  • K Offline
    Koos Brandt
    last edited by 5 Feb 2008, 08:38

    I've searched but don't seem to get the right info.
    I have a webdialog where i set parameters and press a button to update
    the active_model. Currently I just draw a box.
    The Webdialog stays active, so you can change the settings again.
    The problem is that unless I select the active model window(using the
    mouse) the drawing does not appear. It seems becuase I am drawing to
    active-model, but active-model is "inactive" while I am on the
    webdialog, the drawing happens in the background.
    I call the following

     component = Sketchup.active_model.definitions.add("MyLeftSide") 
     trans = Geom;;Transformation.new 
     instance = 
    Sketchup.active_model.active_entities.add_instance(component, trans) 
     newface = component.entities.add_face(@p) ;   # returns a Face 
     newface.reverse! if newface.normal.z < 0 ;  # flip face to up if 
    facing down 
     newface.pushpull(@height) ; # extrude it up to make a cube 
    

    where @p is an array of points. The code basically works and draws the
    correct block, but just not while the WebDialog is the active window!
    So little help on using the webdialog stuff. Anybody?

    1 Reply Last reply Reply Quote 0
    • T Offline
      tbd
      last edited by 5 Feb 2008, 09:52

      try adding this after pushpull command :

      Sketchup.active_model.active_view.invalidate
      

      SketchUp Ruby Consultant | Podium 1.x developer
      http://plugins.ro

      1 Reply Last reply Reply Quote 0
      • K Offline
        Koos Brandt
        last edited by 5 Feb 2008, 10:00

        Thanks

        It works like a charm!

        1 Reply Last reply Reply Quote 0
        • C Offline
          confitex architure
          last edited by 18 Feb 2008, 23:06

          Hi,

          I would be glad to get an overview of your code because I think it could help me with my last post.

          Would you be ready to your rb file here?

          Thanks!

          1 Reply Last reply Reply Quote 0
          • K Offline
            Koos Brandt
            last edited by 19 Feb 2008, 07:26

            Confitex

            Sorry, But I cannot post the ruby code here. It is done for a customer and at this stage it is aimed and giving them something not really available. Cannot give away their business edge

            I am willing to answer questions about specifics, like in your post about webdialog and SU parameters. To obfuscate the whole ruby script, and still keep it as working will be a "big" task.

            What are you having problems with, or what specifically do need help with?

            1 Reply Last reply Reply Quote 0
            • C Offline
              confitex architure
              last edited by 19 Feb 2008, 09:22

              Hello Koos,

              I understand your concern about publishing your code.
              I'm sure you can help me in my other post.
              http://www.sketchucation.com/forums/scf/viewtopic.php?f=57&t=6543&p=41849#p41849
              Maybe you could have a look there and put me on the rails?

              I'v solved some of my problems nut still have no idea how to put more text boxes in my form and retrieve each single variable into sketchup.

              I feel this :

                  dlg.add_action_callback("ValueChanged") {|d,p|
                     $avariable = p }
              

              is to short to do so because i can retrieve just one varaiable. Isn't it?
              Do not hesitate to reply in the other post so that I can end this one.

              Thank you Koos.

              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