sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Camera import and control

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    23 Posts 6 Posters 4.9k Views 6 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      You could also look at the PageExIm script available from Smustard.com for just $5.
      It writes and reads '.sup' files in the format
      SceneName;(-107.49665, -174.644951, 91.64628);(201.036983, 201.920125, -22.396436);(0.144554343836861, 0.17642847255434, 0.973641122667915);true;30.0
      plus other stuff about location and style etc...
      The 'true' part is for 'perspective'.
      Its main purpose is to duplicate scene-tab cameras between SKP files, but clearly if you make a .sup file out of 3ds it'd import it too [perhaps with some tweaks to the code etc which might be 'a step too far']...

      TIG

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        The 'up' is a vector in Sketchup camera code to determine the 'roll' it could be simple to calculate that from an angle [from the vertical ?]...

        TIG

        1 Reply Last reply Reply Quote 0
        • M Offline
          mbark
          last edited by

          I will look into the script.
          Can you please explain what the following code describes (0.144554343836861, 0.17642847255434, 0.973641122667915)
          Is it camera tilt parameters?

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            That's the 'up' vector.
            For now forget the .sup file example, all I need to make a simple importer is a simple text file with
            name, xeye,yeye,zeye, xtarget,ytarget,ztarget, rollangle, fovangle
            I can then get the 'up' vector from all of that and make scene-tabs with cameras to suit...

            TIG

            1 Reply Last reply Reply Quote 0
            • M Offline
              mbark
              last edited by

              Hi again
              I have here two cameras that I would like get into sketchup. If you can explain the procedure and if there is a way to manipulate the cameras once in sketchup.
              The coordinates follow
              name, xeye,yeye,zeye, xtarget,ytarget,ztarget, rollangle, fovangle
              Camera_1 160,4 130,52 2,12 10,20 1,53 1,32 -1,52 26,89
              Camera_2 2510,23 1263,25 2,56 12,25 4,89 2,39 2,56 16,96
              Thanks!

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                What units are the xyz values ? meters/inches etc...
                I assume you are using a ',' as a decimal-separator and separate the values with a 'space' !

                TIG

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  Here's a first pass...
                  Copyright 2011 (c) TIG
                  All Rights Reserved.
                  THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
                  WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
                  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

                  Usage:
                  Menu "View" > "ImportCamera..."
                  Choose the file containing the camera data, in the following format:
                  name,xeye,yeye,zeye,xtarget,ytarget,ztarget,rollangle,fovangle
                  You can have one camera per line.
                  The xyz values should be in 'inches'.
                  The two angles should be in degrees.
                  If the ",rollangle," is replaced with ",upx,upy,upz," a vector can be used.
                  New scene-tabs are made, each called 'name', with cameras as specified.
                  Edit the ICVSEP and ICDSEP constants below to suit your typical file's
                  value-separator [' ',;:\t] and decimal.separator [. or ,]...

                  Donations:
                  info @ revitrev.org via PayPal.com
                  Version:
                  1.0 20110908 First issue.

                  Put into the Plugins folder and restart Sketchup - read the instructions!

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    mbark
                    last edited by

                    Hi TIG

                    Sorry I havn't given a quick answer...
                    The script works!!!
                    Would it be hard work to thange the units from inches to meters?
                    Also, would it be possible to make a input panal inside sketchup where the camera values could be entered and manipulated.

                    I appreciate your help very much, and i didn't think it was possible to get the same precision in sketchup as in 3ds Max - awsome!!

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @mbark said:

                      Hi TIG
                      Sorry I haven't given a quick answer...
                      The script works!!!
                      Would it be hard work to change the units from inches to meters?
                      Also, would it be possible to make a input panel inside Sketchup where the camera values could be entered and manipulated.
                      I appreciate your help very much, and i didn't think it was possible to get the same precision in Sketchup as in 3ds Max - awesome!!

                      This is a version that assumes the units are in 'meters'...
                      Copyright 2011 (c) TIG
                      All Rights Reserved.
                      THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
                      WARRANTIES,INCLUDING,WITHOUT LIMITATION,THE IMPLIED WARRANTIES OF
                      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

                      Usage:
                      Menu "View" > "ImportCamera..."
                      Choose the file containing the camera data, in the following format:
                      name,xeye,yeye,zeye,xtarget,ytarget,ztarget,rollangle,fovangle
                      You can have one camera per line.
                      The xyz values should be in 'METERS'.
                      The two angles should be in degrees.
                      If the ",rollangle," is replaced with ",upx,upy,upz," a vector can be used.
                      New scene-tabs are made, each called 'name', with cameras as specified.
                      Edit the ICVSEP and ICDSEP constants below to suit your typical file's
                      value-separator [' ',;:\t] and decimal.separator [. or ,]...

                      Donations:
                      info @ revitrev.org via PayPal.com
                      Version:
                      1.0 20110908 First issue.
                      1.1 20110910 METER version.
                      TIGimportcamera.rb

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        You can get a dialog that takes some input for camera data [but 'up' is a vector!] using this code [PC only, I'm afraid!]

                        <span class="syntaxdefault">require </span><span class="syntaxstring">'sketchup.rb'<br /></span><span class="syntaxdefault">UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">menu</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Camera"</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Camera Info..."</span><span class="syntaxkeyword">){</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">10624</span><span class="syntaxkeyword">)}</span><span class="syntaxdefault">unless&nbsp;file_loaded</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">file_loaded</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)&nbsp;</span><span class="syntaxdefault"></span>
                        

                        copy+paste this code into a file called camera_info.rb in the Plugins folder and you get the new item in the menu after a restart...

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • M Offline
                          mbark
                          last edited by

                          Thanks TIG
                          I have been looking for a way to get my exact camera information from max to sketchup for ..... a long time.
                          Thank you for your time and work.

                          1 Reply Last reply Reply Quote 0
                          • E Offline
                            eco
                            last edited by

                            I was looking something like this but I have different camera coordinates information: xeye,yeye,zeye, xrotation,yrotation,zrotation, focallenght(mm), framesize(px)

                            1 Reply Last reply Reply Quote 0
                            • L Offline
                              lapx
                              last edited by

                              pageexim is not working for me. Has anyone else had a problem getting it to work in su8? It makes the .sup file on export but when I try importing the .sup file it's doing nothing. It doesnt even give and error.

                              Thanks,

                              Lapx

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                mbarker
                                last edited by

                                @tig said:

                                You can get a dialog that takes some input for camera data [but 'up' is a vector!] using this code [PC only, I'm afraid!]

                                <span class="syntaxdefault">require </span><span class="syntaxstring">'sketchup.rb'<br /></span><span class="syntaxdefault">UI</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">menu</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Camera"</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">add_item</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"Camera Info..."</span><span class="syntaxkeyword">){</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">10624</span><span class="syntaxkeyword">)}</span><span class="syntaxdefault">unless file_loaded</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">file_loaded</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">__FILE__</span><span class="syntaxkeyword">)&nbsp;</span><span class="syntaxdefault"></span>
                                

                                copy+paste this code into a file called camera_info.rb in the Plugins folder and you get the new item in the menu after a restart...

                                Dear TIG
                                It has been a long time since last and i would like to ask you a big favor regarding the camera import script. I used to have the user name mbark and you made the TIGimportcamera.rb. I am now using Sketchup 2015 and the script will not import. Can you help with an updated version. I would really appreciate it!
                                Thanks

                                1 Reply Last reply Reply Quote 0
                                • TIGT Offline
                                  TIG Moderator
                                  last edited by

                                  I'd expect the old RB file still to work OK in v2015.
                                  However, how are you making the camera-data file ?
                                  Try Notepad++ and set the file's encoding to UTF8-without-BOM...
                                  Report back...

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    mbarker
                                    last edited by

                                    @tig said:

                                    I'd expect the old RB file still to work OK in v2015.
                                    However, how are you making the camera-data file ?
                                    Try Notepad++ and set the file's encoding to UTF8-without-BOM...
                                    Report back...
                                    Dear TIG
                                    Worked a little more with the script and camera file and I am back in business!!
                                    Thanks!! 😄

                                    1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      mbarker
                                      last edited by

                                      Hi TIG
                                      I found the old dialog regarding the file TIGimportcamera.rb
                                      I have updated the last Sketup update, but I can't get the script to work this time.
                                      Can you help me?

                                      Also, I would love to donate for having successfully used the script for many years! 🙂
                                      How can I donate?

                                      Kind regards,
                                      Mikkel

                                      TIGT 1 Reply Last reply Reply Quote 0
                                      • TIGT Offline
                                        TIG Moderator @mbarker
                                        last edited by TIG

                                        @mbarker
                                        I've replied to you in a PM

                                        I just tried it on v2024 and it works fine... although most of it is over a decade old !
                                        It imports a text file with a camera-view on each line.

                                        The camera-view entry must be as follows...
                                        name,xeye,yeye,zeye,xtarget,ytarget,ztarget,rollangle,fovangle
                                        there can be an optional value added after 'fovangle':
                                        ,image
                                        But you probably aren't wanting to use that.

                                        The values in the entry must be separated with the constants that are set in the RB file:
                                        Edit the ICVSEP and ICDSEP constants to suit your typical file's locale value-separator [' ',;:\t] and decimal.separator [. or ,]...
                                        In the example I show it's as a comma , separator and a .
                                        You might use a space or ; and a , to suit locale.
                                        Please check you are setting up you file correctly.

                                        As I said it works fine given the correct input.
                                        To attach an RB file just drop it into the message
                                        TIGimportcamera.rb

                                        There are donation buttons against many authors entries in the PluginStore and ExtensionStore³

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • 1
                                        • 2
                                        • 2 / 2
                                        • First post
                                          Last post
                                        Buy SketchPlus
                                        Buy SUbD
                                        Buy WrapR
                                        Buy eBook
                                        Buy Modelur
                                        Buy Vertex Tools
                                        Buy SketchCuisine
                                        Buy FormFonts

                                        Advertisement