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

View.write_image shows dotted line border

Scheduled Pinned Locked Moved Developers' Forum
13 Posts 5 Posters 2.3k Views 5 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.
  • R Offline
    rami_lpm
    last edited by rami_lpm 25 Nov 2016, 12:52

    Hello everyone.
    I've just noticed that when you export a square view with FOV 90, a dotted line border appears in the lower and bottom sides.
    This breaks my Cubic panorama plugin.
    Any ideas on how to fix it?

    I've tried changing image size, aspect ratio, format, and setting view.line_width to 0, but the glitch appears anyway.

    Here is my test code.

    
    model=Sketchup.active_model
    view=model.active_view
    cam=view.camera				
    pos=cam.eye
    
    newFov=90
    newAR=1.0
    newIW=24
    
    shadowinfo = Sketchup.active_model.shadow_info
    shadowinfo["UseSunForAllShading"]=true
    
    #face front
    newTarget=[pos.x+1,pos.y,pos.z]
    newUp=[0,0,1]
    #set camera
    cam.set pos, newTarget, newUp
    cam.fov=newFov
    cam.aspect_ratio=newAR
    cam.image_width=newIW	
    
    keys = {
     ;filename => "test2017a.jpg",
     ;width=>2048,
     ;height=>2048,
     ;antialias=>true,
     ;compression => 0.6,
    }
    model.active_view.camera=cam
    #model.active_view.line_width = 0 #I don't think this does anything.
    model.active_view.write_image keys 
    
    

    I've attached the resulting image.
    awful dotted borders

    Thanks in advance for any tips.

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 25 Nov 2016, 17:34

      your width and height aren't square...

      @rami_lpm said:

      ...I've tried changing image size, aspect ratio, format, and setting view.line_width to 0...

      Error: #<NoMethodError: undefined methodline_width' for #Sketchup::View:0x007f91557a6190>`

      but changing the aspect ratio has an even worse effect on a mac in SU v17...

      the black bars it creates completely corrupt the export...

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • R Offline
        rami_lpm
        last edited by 25 Nov 2016, 19:36

        Oh, that was a typo, I've corrected it.
        Yes, this only happens in sketchup 2017.

        Edit:
        All right, there are 'magic' numbers at work here.
        If you write the image with resolution up to 1020x1020, it comes out fine.
        Above that the border starts showing, and as the resolution grows, it becomes thicker, and the gaps bigger.
        At about 2000x2000, a square appears, as the lines are so thick and the gaps so wide that the lines meet in the center of the image.
        At 2036x2036 the glitch is gone.
        Aaaand its back at 2041x2041.

        This is strange.

        For the moment, I will advise the users of my plugin to use one of the 'safe' resolutions on their panoramas.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 21 Dec 2016, 13:03

          In what versions of SU do you observe this?

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • R Offline
            rami_lpm
            last edited by 21 Dec 2016, 13:17

            I've only encountered this in sketchup make 2017 on windows 10, Driven tested it on a mac, same issue.

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 23 Dec 2016, 22:39

              Have you tested on older versions? Do you think this is a regression?
              I wonder if it's related to a regression where the aspect ratio overlay bars are drawn as solid black in SU2017.

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • R Offline
                rami_lpm
                last edited by 23 Dec 2016, 23:08

                I wrote the panorama plugin in 2014, and never had this problem.

                Ok, I've just tested this.

                
                model=Sketchup.active_model
                view=model.active_view
                cam=view.camera            
                cam.aspect_ratio=1
                
                

                Yes, in SU2016 the bars were transparent. in SU2017, the bars are black. That's a regression? I don't remember the bars ever being black.
                I fail to see why this change would interfere with view.write_image
                Has anyone else reported this problem when exporting images? maybe with other aspect ratio?

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 25 Dec 2016, 13:52

                  The bars were by default a transparent black. The color can actually be adjusted. But in SU2017 the transparency is ignored. (I haven't actually tried to see if it picks up custom colors...)

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    rami_lpm
                    last edited by 27 Dec 2016, 11:54

                    the color can be adjusted? is there a command to do that? I can try and see.

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by 27 Dec 2016, 12:06

                      @rami_lpm said:

                      the color can be adjusted? is there a command to do that? I can try and see.

                      I think it is one of the RenderingOptions.

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        thomthom
                        last edited by 27 Dec 2016, 12:09

                        Jim is correct, I don't recall exactly what it is, but you find it if you inspect the available keys.

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • D Offline
                          driven
                          last edited by 27 Dec 2016, 13:40

                          Sketchup.active_model.rendering_options["BandColor"] = (Sketchup;;Color.new(185,138,0,127))
                          
                          

                          this works in v16 but has no effect in v17 on my mac...

                          john

                          learn from the mistakes of others, you may not live long enough to make them all yourself...

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            caper8
                            last edited by 24 Mar 2017, 15:40

                            This is a cross post from our SketchUp Forum post

                            tl;dr - In addition to trying the work-arounds in this thread (only the resolution magic numbers worked) we discovered that turning off anti-aliasing eliminates the issue for any resolution - if you can accept the jaggies.

                            Hope that helps someone diagnose and fix the issue, or is a workaround for someone until the fix.

                            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