sketchucation logo sketchucation
    • Login
    1. Home
    2. jlai
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Output 3d model by small tiles

      I still couldn't solve the problem. Could some guru here please help?
      Thanks a lot.

      posted in Developers' Forum
      J
      jlai
    • RE: Output 3d model by small tiles

      Thanks, I was already doing paraline projection in the camera constructor.

      I was only using quads as an example. In the plugin I'm writing, it could be as many as 1024x1024 tiles (each 256x256 pixels), over the single file size/memory limit.

      Could someone please let me know what I did wrong in the code, or point me to a right direction?

      Much appreciated.

      posted in Developers' Forum
      J
      jlai
    • Output 3d model by small tiles

      Hi all,

      I'd like to output my model into 4 quad images(each a 256x256 png) , and then combine them into a big one (512x512). I wrote a plugin that sort of worked, but the 4 quads don't EXACTLY align (please see the attachment, esp. the bottom 2 pngs). Could someone please help?

      • jay

      Here are my steps:

      1. I resize the SU window so make sure the view's client area is 512x512 pixels (used Spy++ to verify it).
      2. In SU, I set the camera to be paraline.
      3. In my plug in, I have a fucntion restore_camera, used to reset the camera each time before I output the quad image:

      def restore_camera(vx,vy,vz,tx,ty,tz,ux,uy,uz)
      new_eye = [vx,vy,vz]
      new_target = [tx,ty,tz]
      new_up = [ux,uy,uz]
      new_camera = Sketchup::Camera.new(new_eye,new_target,new_up,false)

      model = Sketchup.active_model
      view = model.active_view
      view.camera = new_camera

      view.zoom_extents
      view.zoom 1.0525
      view.refresh
      end

      1. For each quad, the outputting image part looks like the following. I'm adding each quad with 4 lines, selecting them, and zoom to selection. These quads are visible in the attached png.

      x, y below is the column/row index of the 4 quads, the 4 quads will be (0,0),(1,0),(0,1),(1,1) respectively

      z = 1
      tileWH = 256
      ip0 = view.inputpoint (xtileWH, ytileWH)
      ip1 = view.inputpoint ((x+1)tileWH, ytileWH)
      ip2 = view.inputpoint ((x+1)*tileWH, (y+1)tileWH)
      ip3 = view.inputpoint (x
      tileWH, (y+1)*tileWH)
      pt3d_0 = ip0.position
      pt3d_1 = ip1.position
      pt3d_2 = ip2.position
      pt3d_3 = ip3.position

      theEdges= []
      theEdges[0] = Sketchup.active_model.entities.add_line pt3d_0, pt3d_1
      theEdges[1] = Sketchup.active_model.entities.add_line pt3d_1, pt3d_2
      theEdges[2] = Sketchup.active_model.entities.add_line pt3d_2, pt3d_3
      theEdges[3] = Sketchup.active_model.entities.add_line pt3d_3, pt3d_0

      Sketchup.active_model.selection.add theEdges
      view.zoom theEdges
      view.zoom 1.0525
      view.refresh

      write_current_view("c:/temp/su_output/" + z.to_s() + "" + x.to_s() + "" + y.to_s() + ".png")


      the combined 4 quads png

      posted in Developers' Forum
      J
      jlai
    • 1 / 1