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

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.
  • M Offline
    mbark
    last edited by 8 Sept 2011, 21:50

    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
    • T Offline
      TIG Moderator
      last edited by 8 Sept 2011, 22:04

      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
      • T Offline
        TIG Moderator
        last edited by 8 Sept 2011, 22:13

        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 10 Sept 2011, 19:09

          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
          • T Offline
            TIG Moderator
            last edited by 10 Sept 2011, 20:45

            @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
            • T Offline
              TIG Moderator
              last edited by 10 Sept 2011, 20:54

              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 10 Sept 2011, 21:09

                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 6 Nov 2011, 21:11

                  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 29 Feb 2012, 20:22

                    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 9 May 2015, 21:13

                      @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
                      • T Offline
                        TIG Moderator
                        last edited by 10 May 2015, 16:04

                        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 10 May 2015, 21:17

                          @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 28 Jun 2024, 13:25

                            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

                            T 1 Reply Last reply 28 Jun 2024, 13:41 Reply Quote 0
                            • T Offline
                              TIG Moderator @mbarker
                              last edited by TIG 28 Jun 2024, 13:41

                              @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
                              • 1 / 2
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement