Place Solid along the path

I am trying to place Road barriers along a path (polyline). The solid is converted from Microstation smart solid to GC readable solid. I have set-up a coordinate system at the start of my polyline. How can I array my solid (barrier) along the path? (Please note that my path is not planer, please check attached photo).

Things I want to achieve are,

1. Array Solid along the path.

2. Maintain min. 10mm spacing between each solid.

3. Output solids should follow the path vertically and horizontally.

4. If above mention things can be achieved then what are the steps (eg. do I have to setup point nodes, or coordinate system or planes along the path, any other things that I have to do to achieve my goal)

Thanks in Advance,

Jaimin Patel

Parents
  • Hi Jaimin,

    Yes, this can be achieved. Crucial is how you designed your components that you want to place along the path and the geometric type of your path.

    You know that any DGN Model can be used as a cell. A MicroStation solid (any MicroStation solid --there should not be any conversion required into a GC readable solid) in a DGN Model, therefore, is a cell, and the solid's relative location to the origin of the DGN Model determines how it will be placed as a cell. Cell nodes in GC align with their placement CoordinateSystem nodes (an input to the Cell node). Therefore, key in this is how to find the proper alignment of the GC CoordinateSystem node with the path at the placement point. This is the same challenge one would face when placing these cells manually along a path. However, with GC one can find out what the rules are for that placement once, and then apply it to all other cases (e.g. the dozens or more along that same path; or placement of another cell along another path in another project).

    You mention that your path is a polyline (Line String element in MicroStation, PolyLine node in GenerativeComponents, I assume). Depending on where the placement origin of the MicroStation solid (the cell) is, one would need to figure out how one would like the cells placed in relation to the path. There are perhaps three main cases: (1) the cell is short compared to the length of the polyline segments, (2) the cell is long compared to the length of the polyline segments, (3) there is a corner/bend in the path where the cell is supposed to be placed. For all those three cases, another question would be whether the start and end "points" of the cell are supposed to lie on the path, or whether it's the placement origin of the cell that should be on the path. All these aspects affect how the location and orientation of the placement coordinate systems for the cells would have to be determined.

    Lets focus on one case: "start point" and "end point" of the cell are supposed to lie on the path. Then I'd most likely use placement using the "ByFunction" technique and write a function that "walks" along the path, starting at whatever is the input for the start distance along the path (greater or equal to zero). Because I don't know on which of the polyline segments the "end point" of my cell will end up, I'll construct a sphere around the "start point" (and any next point I find alternating between the cell's length and the desired spacing between subsequent cells) and then check the resulting intersection with the current or next segments until I find a valid intersection further along the polyline. That intersection point will be the "end point" of my cell (or the interstitial space). From those two points in space I can construct an unambiguous coordinate system which will allow me to place the cell. I iterate between placing cells and creating interstitial spaces (not placing anything) until I reach the end of the polyline. This method will take care of cases (1) and (2), placing the cell by "chord" around corners/bends (case (3)).

    HTH,

         Volker

       

  • I got the theory of placement of an object.

    I assume I will have to develop a script which will place the cell followed by following steps.

    1. Find the origin of placement (which will be the start point of a line for example)

    2. Construct a "sphear" around the "start point" by the radius which will intersect a point on the path. This point will be a reference point to construct the unambiguous coordinate system.

    3. Place the cell along the coordinate system developed in Step 2.

    4. Place a point by offset along the curve (for eg. 10mm). The reference point for offset will be the point generated by the sphear intersection (as mention in step 2).

    5. Repeat step 1-4 by the number of cells along the path or distance along the path function.

    Please correct me if I am going on the wrong track. If my assumptions are right then is there any example script that covers this steps. My apologies for asking too much help, I am very new to GC and trying my head around. I am now comfortable with using different nodes but can't develop a script.

    If you could generate a full script, it will be very helpful for new users to understand scripts form real example and also for other people who want to achieve the same task. As you mention, it will be a standard script that can be used in any projects (by changing reference cell and polyline). 

    Any help will be appreciated.

  • Hi Jaimin,

    Attached is an example script for placing a CoordinateSystem along a PolyLine based on some object's length and desired spacing between neighboring objects. The objects are assumed as placed in their own DGN model and can be placed as Cells. One end of the object should be on 0, 0, 0, which is the placement point, and its length should align with the X-axis of the DGN model.

    Instead of using a sphere as I initially suggested, I am using an Arc, for which I find the Plane through the Arc's center and the PolyLine's segment with which I want the Arc to intersect. If the Arc and the PolyLine segment don't intersect, the function proceeds to the next segment, etc. I hope I added sufficient commentary in the function.

    This function is the result of iterative development, running up against omissions in my logic, debugging unexpected results (one of them an infinite loop), etc. Please consider this when encountering some frustrations: that's par for the course.

    To reuse the script for your own purposes you'd need to redirect the reference attachment to the Line String or PolyLine on which you want to place the objects and resize the two points spanning the Range node accordingly. Similarly, the CellName and LibraryName input properties on cell1 would need to be updated, as well as the object length input to coordinateSystem1.ByFunction. Toward the end of the script I added a Slider node which uses the ByValueList technique to allow switching between a short and a long cell, and an Expression node that changes the length value accordingly, which becomes an input to coordinateSystem1. This keeps cell and length values aligned and could come handy in similar situations.

    This script works along the alignment. With wider objects in tighter curves an issue may arise that the placed objects might overlap. Checking to avoid that type of situation, or to enforce spacing between the closest points of adjacent objects requires additional work and significantly more knowledge about the placed objects' geometry (in addition to their length).

    HTH,

       Volker

    PlacementAlongAlignment.dgn

       

    Answer Verified By: Jaimin Patel 

  • Hi Mueller,

    Thanks for developing the script, it is very useful and it almost what I wanted. It solved the problem 99% apart from a little issue. I understand that it is developed for a particular case and It can't serve all the scenarios. However, the algorithm behind the script is very powerful. I wish I could reach this level of script writing. I know with the knowledge I have I could never fulfill my task. Thanks for helping out.

    I wish this type of functions are directly added in GC where users have to provide inputs (eg. spacing, path, reference cell/solid etc.) and software will do the rest of the job. There is a Microstation add-on available in Australia developed by Adam Lambert called CADDPRO, which is a very powerful tool it has many functions for placement especially for Super-T beams for the bridge which is very popular in Australia. I have added few snapshots of the tools for reference.

    For the case we were discussing, CADDPro can do the same job with very user-friendly tools, but as it is for Microstation, It can't do parametrically. However, I would say, it is very user-friendly. I hope to see a function like this added straight to GC so one can use it in many different kinds of scenarios.

    This was just a suggestion, or else, you are doing a great job by helping the users, you have a very powerful brain Slight smile I wish I could reach even near to you in scripting, that is why I want to leave scripting to GC team and have something very user-friendly which we can use day to day basis by using very less brain ;)

    Regards,

    Jaimin Patel

    (Snapshots from CADDPro below)

  • Hi Jaimin,

    it is very useful and it almost what I wanted. It solved the problem 99% apart from a little issue

    What is the little issue (the 1%) that is missing?

    Best regards,

           Volker

       

  • While placing the cell, I tried to use B-spline Curve, but the script didn't work. looks like this function is written to work with polyline only. Also, When I placed the solid cell along the path, it didn't place for the full length of the polyline, when I tried to change offset from start, the number of units was also changing. I know there must be a way that we can specify the limits (number of units or length of polyline on which the array will happen) scripts but it is very hard for me at this stage.

    In addition, as you mentioned earlier, for sharp curves there will be an issue of clashing which certainly can be eliminated by taking this script at another level. That is where I like GC, there is no limit, you can modify things according to your needs. The only problem is, you have to be master in C# Disappointed

  • Hi Jaimin,

    Yes, for B-spline geometry the algorithm would change. The example script was in response to your request about placing objects along a polyline. To cover both cases, one would have to modify the algorithm.

    In the example script the long objects are long compared to the path so that it becomes obvious if the would-be last object cannot be placed because its end point would not fall onto the path. Starting the start of placement could easily affect the last object to drop off, which in the long objects' case would be very apparent. With longer paths and shorter objects this remainder becomes less obvious. Again, depending on the requirements of the design, this could be adjusted in the script. With fixed object length and fixed spacing, controlling the number of objects could only be a limit of objects placed but not extend object placement past the end of the path to meet the number of object.

    The object clash situation is not trivial with a curvature potentially in three dimensions. Most likely this can be done.

    It is, however, a geometric and algorithmic problem, not a problem of mastery of C#. The required C# knowledge could be taught in a few hours (a start is for example the Zero to Simple Scripting sequence of GC SIGs). For a speedy algorithm, most likely some shortcuts are necessary like including the spacing as part of the object's size which would result in some perhaps tolerable inaccuracies.

    Regards,

        Volker

       

Reply
  • Hi Jaimin,

    Yes, for B-spline geometry the algorithm would change. The example script was in response to your request about placing objects along a polyline. To cover both cases, one would have to modify the algorithm.

    In the example script the long objects are long compared to the path so that it becomes obvious if the would-be last object cannot be placed because its end point would not fall onto the path. Starting the start of placement could easily affect the last object to drop off, which in the long objects' case would be very apparent. With longer paths and shorter objects this remainder becomes less obvious. Again, depending on the requirements of the design, this could be adjusted in the script. With fixed object length and fixed spacing, controlling the number of objects could only be a limit of objects placed but not extend object placement past the end of the path to meet the number of object.

    The object clash situation is not trivial with a curvature potentially in three dimensions. Most likely this can be done.

    It is, however, a geometric and algorithmic problem, not a problem of mastery of C#. The required C# knowledge could be taught in a few hours (a start is for example the Zero to Simple Scripting sequence of GC SIGs). For a speedy algorithm, most likely some shortcuts are necessary like including the spacing as part of the object's size which would result in some perhaps tolerable inaccuracies.

    Regards,

        Volker

       

Children
No Data