Code line stops function from continuing on?

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

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

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

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

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.

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

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()