AligntoSpline SetData



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 09:56, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.5 
    Platform:      
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    What am I missing?  My position isn't changing.

        
        
        
        
        AS::Execute(doc, op)  
        {
        
        
        
        
         op->InitLength(0);  
         leng=op->GetLength();  
         var ind=0;  
         FT=op->GetDown();  
         pos=6.5*ind/leng;  
         FTC=FT->GetFirstTag()->GetContainer();  
         FTC->SetData(ALIGNTOSPLINETAG_POSITION,pos);  
         SetContainer(FTC);
        
        
        
    

    thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 10:17, xxxxxxxx wrote:

    ind = 0
    0*anything = 0
    0/anything = 0
    anything/0 = crash



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 10:43, xxxxxxxx wrote:

    Thanks Robert but,  In this case I want my position to be 0.  I am going to increment ind for subsequent objects.  I had my align to spline position set to 37%, and it doesn't change to 0%.  That is the problem.     Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 11:09, xxxxxxxx wrote:

    I'd definitely check the tag type and make sure it is Taligntospline. You'd be better off doing a for loop until you have it (there is no guarantee that the first tag is the one you think it is!). One quick way to check here is to do FTC->GetData(ALIGNTOSPLINETAG_POSITION) right after you get the container and before calling SetData(). If it returns NIL, it can't possibly be the correct tag.

    Otherwise, I don't see anything incorrect in the code.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 11:11, xxxxxxxx wrote:

    I changed the SetContainer line to this and now it works.

        
        
        
        
        AS::Execute(doc, op)  
        {
        
        
        
        
         op->InitLength(0);  
         leng=op->GetLength();  
         var ind=0;  
         FT=op->GetDown();  
         pos=6.5*ind/leng;  
         FTC=FT->GetFirstTag()->GetContainer();  
         FTC->SetData(ALIGNTOSPLINETAG_POSITION,pos);  
         FT->GetFirstTag()->SetContainer(FTC);
        
        
        
    

    Don't know why this is necessary, but it works



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 11:17, xxxxxxxx wrote:

    Ah. Didn't catch that. Well, yeah, SetContainer() all by itself doesn't tell you which container it is setting. There probably should have been a warning or something during execution.

    You might want to consider:

    var FTT = FT->GetFirstTag();
    if (!FTT) return FALSE;
    if (FTT->GetType() != Taligntospline) return FALSE;
    FTT->GetContainer();
    ...
    FTT->SetContainer(FTC);

    You should be checking for two things here: is there a tag and is it of the correct type.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 22/04/2008 at 11:25, xxxxxxxx wrote:

    Thanks Robert,  I think that is a good idea.  I am going to switch and get the tag with a loop GetType() Taligntospline because eventually there may be more than one tag on the objects.


Log in to reply