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

    JonD

    @JonD

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

    JonD Unfollow Follow
    registered-users

    Latest posts made by JonD

    • RE: Plane from current view

      OK, that got me close. Does anyone know how to convert the viewport coordinates from pixels to actual coordinates? Ideally I would be able to create a rectangle the same size as the viewport corners, write the current view image, manipulate the image (outside of SU), apply back to this rectangle and project to the model. I can generate a correctly oriented rectangle using the eye, target, and up camera methods, but now I am struggling with sizing it correctly.

      I do not believe the model bounds will not work because I need to be able to work in any orientation and any zoom level to affect specific locations of the model.

      Jon

      posted in Developers' Forum
      J
      JonD
    • RE: Plane from current view

      Thanks TIG

      posted in Developers' Forum
      J
      JonD
    • Plane from current view

      I am trying to figure out where to start on this:

      I would like to create a rectangular plane from the current camera position to essentially create a work plane from the current view. The end-game will allow me to place an image on this plane for projection onto a terrain model. My thought is that I could export a 2D image of the current view of a terrain model (imported through the geolocation in Earth), edit it in an image editor to 'dress it up', then place the edited image on the work plane and project the edited image as a texture on the model...maybe someone has tackled this already...

      My guess is that I can get a 3D vector of the camera point to target and the 'up' vector. I would need the normal vector to both of these to create the plane's vectors. I am not sure how to make the corner points (projected from the model bounds) to make the rectangle on this plane.

      Thanks in advance,
      Jon

      posted in Developers' Forum
      J
      JonD
    • RE: SKM files

      Thanks for the good information. Has anyone submitted an enhancement request to Google for some SKM read/write api?

      Jon

      posted in Developers' Forum
      J
      JonD
    • SKM files

      OK, I know there are some older posts out there, so this is a long shot...Is there a way to load SKM files and add them to the Sketchup.active_model.materials collection? I have tried some of the obvious methods, but have not had luck. I am trying to save some attributes in an attribute library attached to the material. I can see that the attribute library is saved in the skm file (changed it to zip and looked at the xml). It also reloads the attributes correctly when I use it from the material window - so it basically works. I would like to apply the materials to some of the object using ruby...

      Jon

      posted in Developers' Forum
      J
      JonD
    • RE: 'Check for Updates' Script

      @unknownuser said:

      Jon,

      It is relatively easy to perform the check of whether the version on the web (and then comare with the one currently installed locally).

      The real difficulty is to download the file and install it when it is in binary format (for instance a Zip file). It is possible for a .rb file which is plain text however.

      Fredo

      PS: I would use Whaat's method, which is to check periodically, even letting the user set the next date. If all scripts do their check at each SU statup, then it would take too long.

      You are right on with the downloading difficulty. I originally wanted to have each 'dependent' represented in the version string so I could only download the file that needed updating. Unfortunately, I could not find a clean way to initiate a download of a .rb or .rbs file into the plugins directory. I have resorted to having the link point directly to a download of an installer (.exe) and the installer is handling the file moves to the plugins folder. It is an acceptable solution for me.

      I have changed my script so that the update is user initiated through the plugin commands. Again, thanks to all for the help.

      Jon

      posted in Developers' Forum
      J
      JonD
    • RE: 'Check for Updates' Script

      Thanks for the direction. Here is how I ended up doing it - very close to Whaat's method. The main difference is I am loading a very small page in the web dialog, not getting the contents of the text file. I had trouble getting the $.get method to work...javascript newbie, I am...

      This is the code in the ruby script. I basically open the webdialog during the startup of Sketchup. The web page loaded in the dialog (from my server) just returns the current build code. I had to add the UI.start_timer to pause a second to let the javascript happen, then close the web dialog

      
      	current = $current.to_s
      	if Sketchup.is_online
      		ssupdate = UI;;WebDialog.new("Check for Updates", false, "Check for Updates", 200, 200, 200, 200, true)
      		ssupdate.add_action_callback("check_current_version") {|d,p|
      			version=p.to_s
      			
      			if version>current
      				text="A newer version of Lakefront Layout is available. Would you like to update?"
      				result=UI.messagebox(text,MB_YESNO)
      				if result==6 #yes
      					UI.openURL("http://www.shorestation.com/")
      				end
      			end
      		}
      		ssupdate.set_url("http://www.shorestation.com/IPADock/Sketchup/checkupdate.html")
      		ssupdate.show
      		
      		id = UI.start_timer(1, false){ssupdate.close}
      	end#if
      
      
      

      Here is the html file I have on y website:

      the 20111112 is the date code of the latest build. This is what I edit when I want to push a new update.

      
      <html>
      <script>
      function check_current_version() {
      	
      	window.location='skp;check_current_version@'+20101112;
         
      }
      window.onload = check_current_version()
      </script>
      <body>
      </body>
      </html>
      
      
      

      I am sure this is not the greatest approach, but it is working. Again, thanks for the help -great forum!

      Jon

      posted in Developers' Forum
      J
      JonD
    • RE: 'Check for Updates' Script

      That is perfect! Thanks for the post.

      posted in Developers' Forum
      J
      JonD
    • RE: 'Check for Updates' Script

      Thanks all, I have check these out and post what I come up with.

      Jon

      posted in Developers' Forum
      J
      JonD
    • 'Check for Updates' Script

      Has anyone had any luck making a script that automatically updates. I would like to somehow check the script version against my website and offer to download an update if one exists. My initial thought was to have a text file on the website that contains a version number. The script would check the version number in the text file when it loads (if online) and then prompt the user to download the updated files directly into the plugins folder. I am sure it is not as easy I am making it sound...

      Has anyone tried this? If so, please share!

      Thanks,
      Jon

      posted in Developers' Forum
      J
      JonD