Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Code line stops function from continuing on?

    Scheduled Pinned Locked Moved PYTHON Development
    7 Posts 0 Posters 579 Views
    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.
    • H Offline
      Helper
      last edited by

      On 22/10/2015 at 08:06, xxxxxxxx wrote:

      Hi Guys,

      Code line stops function from continuing on?

      def The_Funtion(self, unit) :

      c4d.CallCommand(100004820, 100004820) # Copy

      #---------------| New Doc |-----------------#
              c4d.CallCommand(12094, 12094) # New

      #----| GenerateProjectSettings |----#
              doc = c4d.documents.GetActiveDocument()
              unitScale = c4d.UnitScaleData()
              unitScale.SetUnitScale(1.0, unit)

      bc = c4d.BaseContainer()

      bc[c4d.DOCUMENT_DOCUNIT] = unitScale

      bc[c4d.DOCUMENT_MINTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_FROM_FBX), 30)
              bc[c4d.DOCUMENT_MAXTIME] = c4d.BaseTime(self.GetLong(UI_FRAME_TO_FBX), 30)

      #---|Problem|----------------------------------------------------------------------------------------------------------#
      #--| When this 2 lines Excute, it stops the Function from going to Paste and It do what it suppose to do but don't continue | ----------#
              doc.GetLong(UI_FRAME_TO_FBX, bc[c4d.DOCUMENT_MINTIME].GetMinTime(doc.GetFps()))
              doc.GetLong(UI_FRAME_TO_FBX, bc[c4d.DOCUMENT_MAXTIME].GetMaxTime(doc.GetFps()))
      #----------------------------------------------------------------------------------------------------------------------#
              doc.SetDocumentData(c4d.DOCUMENTSETTINGS_DOCUMENT, bc)

      #--------------- | Paste |-----------------#
              c4d.CallCommand(100004821, 100004821) # Paste

      #---------------------------------------------------------------------------------------------------------#

      Help Plz or Tips,
      Ashton

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 22/10/2015 at 08:49, xxxxxxxx wrote:

        Either

        a) Include an SSCCE, or
        b) be more descriptive (did you check for errors in the console? what did you already try? etc.)

        and please use the

        [*/CODE] tags.
          
        -N
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 22/10/2015 at 09:56, xxxxxxxx wrote:

          Hi NiklasR

          This what Console Say:
          Traceback (most recent call last) :
            File "'SelectedObjectExporter.pyp'", line 1034, in Command
            File "'SelectedObjectExporter.pyp'", line 505, in Bake_Export_Takes_Funtion
          AttributeError: 'c4d.documents.BaseDocument' object has no attribute 'GetLong'

          But if the 2 lines is not there it go through without a problem.

          Help or Tips,
          Ashton

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 22/10/2015 at 10:37, xxxxxxxx wrote:

            Hi Ashton
            If you search over c4d's pySDK only get

            > BaseContainer. GetLong (Python method, in c4d.BaseContainer)
            > GeDialog. GetLong (Python method, in c4d.gui.GeDialog)
            >
            Seems, you need to retrieve data from bc(or dialog's widget), not doc

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 22/10/2015 at 10:42, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              Hi NiklasR

              This what Console Say:
              Traceback (most recent call last) :
                File "'SelectedObjectExporter.pyp'", line 1034, in Command
                File "'SelectedObjectExporter.pyp'", line 505, in Bake_Export_Takes_Funtion
              AttributeError: 'c4d.documents.BaseDocument' object has no attribute 'GetLong'

              But if the 2 lines is not there it go through without a problem.

              Help or Tips,
              Ashton

              Makes sense, no? Since the lines cause this error.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                On 26/10/2015 at 18:27, xxxxxxxx wrote:

                Hey guys notthing works, i give up, if yall have a answer or another tip plz tell me,  I am already mad about this!, all i want this thing to do is set the Frame time line which is:
                you put your 30 to 40 in
                press export button
                and 
                then,
                Set numbers in a new doc project Settings, Which happens! 
                and then, 
                min to max long that you drag it or set to,
                  in the new project,
                and move on 
                lol thats all i ask this thing to do.
                Code i post say it the tells it all.

                Help or Tips,
                Ashton

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  On 27/10/2015 at 01:40, xxxxxxxx wrote:

                  Hi
                  Your code is like small snippet for script manager and few lines are from script-log 😠 (like copy-paste, new, callCommand)

                  maybe need to something like

                  import c4d  
                  from c4d import gui, documents  
                    
                  def main() :  
                    new = documents.BaseDocument()  
                    bc = c4d.BaseContainer()  
                    bc[c4d.DOCUMENT_FPS] = 30  
                    bc[c4d.DOCUMENT_MINTIME] = c4d.BaseTime(0) # your data from your gui > c4d.BaseTime(self.GetLong(UI_FRAME_FROM_FBX), 30)  
                    bc[c4d.DOCUMENT_MAXTIME] = c4d.BaseTime(50, 30) # your data from your gui > c4d.BaseTime(self.GetLong(UI_FRAME_TO_FBX), 30)  
                      
                    new.SetDocumentData(c4d.DOCUMENTSETTINGS_GENERAL, bc)  
                    c4d.documents.InsertBaseDocument(new)  
                    
                  if __name__=='__main__':  
                    main()
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post