Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
GenerativeComponents
  • Product Communities
GenerativeComponents
GenerativeComponents Community Wiki Selection of points based on Query Expressions
    • Sign In
    • +An Overview of GenerativeComponents
    • +Addin Content
    • +Bentley BIM Modeler Accreditation – Program Overview
    • +C# Sample Solution and other Add-ins
    • +GenerativeComponents Solutions
    • +Learn GenerativeComponents
    • +Reference Material
    • Support for GenerativeComponents
    • -Tutorials
      • 3D array copy surface
      • Add RFA data as BuildingContent to ABD with GC Extension
      • BSplineSurface.LoftCurve is throwing an error when trying to add get the curves from cell
      • Cell Feature
      • Create a Set of Random Points
      • Creation of Global function from Custom function
      • Creation of Parabolic curve
      • Error while creating GNT
      • Free Form Roof Example
      • GC Excel Feature
      • GenerativeComponents Essentials Course
      • Get Corner points of a Solid
      • How To Create Surface From Lines & Curves
      • How to Export GC elements
      • How to get concrete sections in the cross-section dialog in Generative Components
      • Landscape Bridge Example
      • +LawCurve
      • List Of Points With A Loop Example
      • Mesh feature 3d print
      • Modular Multiplication On Circle
      • +Operation Node
      • +Optimization with the Optimizer node type
      • Palm Tree Modeler
      • Point By Function Example
      • Points On Curve
      • Prime Number Pattern
      • Selection of Points
      • Selection of points based on Query Expressions
      • Selection of points based on range of indices
      • Set a New Property Value to a Set of Selected Nodes
      • Simple Bridge Example
      • Simple Equations To Describe Form Example
      • Simple Free Form Roof Example
      • Sin Tower
      • Skeleton
      • Sunflower Seed Pattern Modelling
      • Surface Division Basic Steps
      • Surface from Rails and Swept Sections
      • The use of Packager in Generative Components
      • +Tools and Techniques
      • Ulam Spiral From A Rectangular Spiral
      • Video Tutorials
      • Video Tutorials - Short Techniques
      • Working with Parametric cells
    • +User Projects
    • +Visualized Parametric Experimentations
    • +zed_Older Content

     
     Questions about this article, topic, or product? Click here. 

    Selection of points based on Query Expressions

      Product(s): OpenBuildings Generative Components
      Version(s): CONNECT Edition 
      Environment:  N\A

     

    Background

    You have a series of Points and want to select a sub-set of Points from that series. 

    Basics

    Let us discuss the basics of Query Expression:

    Query Expression works on linear lists. Query expressions have two required parts:

    1. Definition of variable

    2. Identification of the source list from which the variable is selected.

    In a Query Expression, 'from' is the keyword that starts the Query Expression, then we need to add the variable (here we have used 'point' as the variable). After that we need to use the 'in' keyword which will specify the source list, then we will be using the source list (here Point1 is the source list)

    Steps to Accomplish

    Method 1:

    If we need to select all the points in a point series, we can do it by using the expression below:

    from point in Point1

    This means the selected points will be all the points in the point list.

    To identify the sub-set of points, we will create vertical lines on those selected Points. Here Point1 is the set of points & it begins from left to right. (The same process will also be followed in the below mentioned methods)

    Method 2:

    If we need to select the first few points in a point series, we can do it by using the expression below:

    from point in Point1 take 5

    That means it will take the first 5 points (Point1[0] to point1[4]). You can select any number of points in the point list. Here we are selecting 5 points.

    Method 3 :

    If we need to select specific points in a point series, we can do it by using the expression below:

    from point in Point1 skip 5

    This means it will skip the first 5 points and take the rest of the points in the list.

    Method 4 :

    If we need to select the points in the middle of a point series, we can do it by the expression below:

    from point in Point1 take 8 skip 5

    That means it will take the points from 5 to 7 (Point1[5] to point1[7]). In this expression the starting of the selection of the point will be of point number 7, as 8 is an argument to the list method and as we have commanded to skip 5 points therefore point 5, point 6 and point 7 will be selected.



    Please go through the sample file, https://communities.bentley.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-00-28/Selection-of-points-based-on-Query-Expressions.gct

    Note: 

    For OBD Update 7 and later versions the First has been changed to Take and Last has been changed to TakeLast. The functionality is similar as the previous functions, only the name of the functions have been changed.

    • Line
    • OBD
    • GC Feature
    • OpenBuildings Designer
    • Point Series
    • Point
    • GenerativeComponents
    • Query Expression
    • GenerativeComponents CONNECT Edition
    • generative components
    • Select a Point
    • gct
    • Share
    • History
    • More
    • Cancel
    • Alifur Mandal Created by Bentley Colleague Alifur Mandal
    • When: Tue, Dec 3 2019 7:11 AM
    • Alifur Mandal Last revision by Bentley Colleague Alifur Mandal
    • When: Wed, Sep 23 2020 1:16 AM
    • Revisions: 6
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies