Donate Now Goal amount for this year: 3000 USD, Received: 1207 USD (40%)

Results 1 to 4 of 4
Like Tree2Likes
  • 1 Post By amoursol
  • 1 Post By amoursol

Thread: Function with certain library not working

  1. #1
    Junior Member
    Join Date
    March 16, 2017
    Location
    Malaysia
    Posts
    16
    Current Local Time
    04:08 AM

    Function with certain library not working

    Dear All,

    I don't understand why below function not working with DSCore.List.MinimumItem keyword.

    Can anyone clarify?




    TQVM.
    Attached Thumbnails Attached Thumbnails Function with certain library not working-function-minimum.png  

  2. #2
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    05:08 AM
    Hello mimi,

    It works in the following format:

    Attached Thumbnails Attached Thumbnails Function with certain library not working-revitforumquery_getmin.jpg  
    Last edited by amoursol; August 4th, 2017 at 03:15 PM.
    Mimi Azimar likes this.

  3. #3
    Junior Member
    Join Date
    March 16, 2017
    Location
    Malaysia
    Posts
    16
    Current Local Time
    04:08 AM
    Thanks. It works, but i still don't understand the concept. What does the line of return = [Imperative] means? What is the difference with or without the line?

  4. #4
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    05:08 AM
    The default without that line uses Associative code: If a collection of elements is used as the input to a function which normally takes a single value, the function is called individually for each member of that collection.

    With the line it uses Imperative code: In Imperative, a programmer has the option to write code that manually iterates over the collection, extracting individual members one at a time.

    To quote the Designscript summary user manual:

    Imperative programming is characterized by explicit 'flow control' using for loops (for iteration) and if statements (for conditionals) as foundin familiar scripting and programming languages such as Python. Imperative programming is useful to perform iteration, either steppingthrough a collection or to perform some iterative feedback or optimisation loop.

    Associative programming uses the concept of graph dependencies to establish 'flow control’ and is useful for modeling complex operations(such as geometric processes) applied to collection of objects, in a very succinct programming style with automatic change propagation.

    The two styles of programming address different computational tasks and essentially complement each other. The different styles ofprogramming share a common notation which means that in some case the same code can be executed either associatively or imperatively. Inaddition there are certain computational tasks that benefit from a combination of programming styles within the same program or indeedwithin the same function or method. DesignScript supports this flexibility by allowing Imperative code to be nested within Associative codeand vice versa.
    Have a read of the following link: http://aucache.autodesk.com/au2012/s...ser_manual.pdf
    Mimi Azimar likes this.

Similar Threads

  1. Roundup Function
    By montanaboy27 in forum Structure - Family Creation
    Replies: 6
    Last Post: January 25th, 2017, 08:02 PM
  2. Suggestions for getting training on how to use the materials library/asset library?
    By DesignApparatus in forum Architecture and General Revit Questions
    Replies: 12
    Last Post: November 20th, 2014, 02:29 PM
  3. Archive Function?
    By Jock in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: December 5th, 2013, 04:01 PM
  4. Issues with working on a shared central file whilst working remotely.
    By mhug9 in forum Architecture and General Revit Questions
    Replies: 2
    Last Post: June 25th, 2013, 11:49 PM
  5. Replies: 0
    Last Post: April 27th, 2013, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •