Jörg 29 Report post Posted December 12, 2013 Hi, This is a post in the context of project performance: If you use loops with feature definitions, take care where you declare ("create") your participating objects: Most of the times, objects can be declared outside of the loop since the dependency is kept within the loop by means of the expression mechanism! In the attached example, I create N curves in between of two given rail curves and store them in a list for surface creation. The two points on the corresponding rails are declared right before the loop starts. You could also declare them within the loop but - and here comes the message - they would be created again and again, i.e. at each iteration (N-times). In the end, this might slow down your feature execution when it comes to a higher number of objects that get declared within a loop. Hope this helps ... CheersJoergloop.fdb Share this post Link to post Share on other sites
Mr. Carsten Fuetterer 9 Report post Posted December 16, 2013 Hi, in this post is just a little add on to measure the elapsed time of a feature. This can be helpful to optimize it. cheers Carsten Share this post Link to post Share on other sites
Mr. Daniel Floden 0 Report post Posted January 22, 2014 Hi all, I've tried this loop functionality with a generic function but although I get no error message in the attached feature I cannot get the curves to be plotted in caeses. My goal is the plot a number of radial 2d section-lines of a developed blade. BRDanielR_def.fdfc Share this post Link to post Share on other sites
Karsten Wenzke 12 Report post Posted January 28, 2014 Hey Daniel, I've had a look into your feature definition and I changed some minor but important things. You need to create the parameters inside the loop that they are updated every time. The feature creates the curves. I tested the feature with the propeller sample.Here you can see the result. Best Regards KarstenR_Def_FS.fdf Share this post Link to post Share on other sites
Guest Mr. Olivier Duquette Report post Posted June 25, 2015 Hi,I tried to declare a curve outside a loop and then give it a "value", like this:fcurve camber()loop (5) camber= camber_i.at(j-1).castTo(fcurve) // camber_i is an objectlist containing 5 curves. [...] endloopBut I am getting an error message: No operator = defined for types: FCurve and FCurveSo I did it this way:loop (5) fcurve camber(camber_i.at(j-1).castTo(fcurve)) // camber_i is an objectlist containing 5 curves. [...] endloopSo my question is: do I have to declare the curve inside the loop, or there is a way to do what I was trying in the first example?Thank you,Olivier Duquette Share this post Link to post Share on other sites
Mr. Arne Bergmann 27 Report post Posted June 26, 2015 Hi Oliver, since the Feature Language doesn't have the concept of scoping known from C or Java (or others). So, in short, it doesn't really matter whether you declare the FCurve reference "camber" inside or outside the loop. These two are equivalent: bsplinecurve myCurve() FCurve myReference() loop(1) FCurve myReference(myCurve) endloop // The reference is still valid here, so I can do the following, for example: myReference.getPos(0.5) // which is equivalent to calling ".getPos(0.5)" on "myCurve" and bsplinecurve myCurve() loop(1) FCurve myReference(myCurve) endloop // The reference is still valid here, so I can do the following, for example: myReference.getPos(0.5) // which is equivalent to calling ".getPos(0.5)" on "myCurve" Note that most types in the Feature Language do not have assignment operators ("="). Also note that the Syntax "FCurve something([...])" creates a reference to an existing curve. it does not create a new curve! Also see the documentation of FFeatureDefinition for more information about references. Be aware that in your example, the "camber" reference will reference the last (fifth) curve in your objectlist after the loop. Inside the loop it will reference different curves for each run of the loop. Finally, while my initial statement regarding variable scoping is true, there is one little exception: variables that are declared inside a function are only valid within the function. I hope this helps. Arne Share this post Link to post Share on other sites