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

    thatClintGuy

    @thatClintGuy

    10
    Reputation
    1
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    thatClintGuy Unfollow Follow
    registered-users

    Latest posts made by thatClintGuy

    • RE: Template loaded programmatically doesn't use style

      @dan rathbun said:

      OK. Wait. I just re-read what you wrote in the OP.

      It seems that you believed that Sketchup.template=() would load a template (dynamically) into the currently loaded model.
      It should not. It only should set up subsequent calls to open a NEW model, to use the specified template.
      Sketchup.send_action("newDocument:")
      or
      Sketchup.file_new()

      To load a style dynamically, load a .style file into the styles collection, and set it active by name or index.

      Good catch, but I didn't believe that, actually. I was calling file_new after setting the new template, but the template style background still wasn't being used when it was outside the default templates directory for some reason.

      posted in Developers' Forum
      T
      thatClintGuy
    • RE: Template loaded programmatically doesn't use style

      Discovered the easy solution to changing the background color to black. One line of code:

      Sketchup.active_model.rendering_options["BackgroundColor"] = Sketchup::Color.new(0,0,0)

      posted in Developers' Forum
      T
      thatClintGuy
    • RE: Template loaded programmatically doesn't use style

      So if I understand correctly, the style information in a .skp is just a pointer to a .style file that needs to exist on the client machine?

      This is getting trickier for just changing the background color.

      It worked fine in 2013 to just load a template, but maybe something changed.

      posted in Developers' Forum
      T
      thatClintGuy
    • Template loaded programmatically doesn't use style

      Hello sketchUcation!

      I've been cutting my Ruby-teeth updating my company's extension to work in 2014. This forum has been a great resource so far. When I get into the thick, I tend to have a bunch of tabs filled with the SketchUp Ruby API and sketchUcation threads. So thanks!

      Now onto my question:

      Having a helluva time getting a style to load when my extension is on. I've created and saved a template with the style I want in the SketchUp UI that works perfectly when I create a new file.

      However, if I copy that .skp file from the Templates directory and set the template in Ruby, the styles don't work.

      I'm setting the template in an AppObserver using the following code:

      Sketchup.template=Sketchup.find_support_file("Plugins")+"/MyPluginDir/template.skp"

      When I call Sketchup.template it happily reports the correct path to the file.

      Have been wondering if styles aren't embedded in .skp files, but point to a style file/setting already in SketchUp, which wouldn't exist on an end-user's setup.

      Am I missing something?

      posted in Developers' Forum
      T
      thatClintGuy