Reverse a List

Hello GC Community,

I'm having a problem that maybe you could help me with, 

I need to reverse a list, in this case point4 represent a list that I need to reverse so I can match the lines in a parellel assemble.

I'm attaching a picture.

Regards

Parents Reply Children
  • Hi Rafael,

    This one reminded me of a similar issue I had with some curves.

    Maybe you could think of it in another direction.

    The points could be ordered by their X values in your case. This would in effect reverse the list. But it also provides future flexibility where you might place points in a random order but need to re-arrange them in a specific order like X, Y or Z direction.

    Using a similar approach to that Brenden suggested above this could be achieve with an expression node.

    Place an expression node and in the Value field type in:
    from V in Point7 orderby V.X

    The “V” is not important just a variable so it could be anything I believe

    Then just disconnect the wire between the endpoint of Line 5 and connect the expression to this endpoint.

    That should fix it up.

    I have attached a dgn example

    Let me know how you go

    Thanks

    Wayne

    1768.OrderOfPoints.dgn

  • Hi Wayne,

    very nice solution.

    Do you know some help-manual where we can find tricks like these?

    Ingo

  • Hi Ingo,

    Thanks

    I am asked the same question here in our office. Volker and the community are a very good starting point. I have learnt so much just asking questions here. The other great resource are the SIGs. So much info there every month!

    However I am just about to release some videos to our team on GC tips so I will package them up and get them online for everyone to enjoy. I will start a thread in the forum so keep an eye out for it. I am no expert but you might find it useful.

    Thanks

    Wayne

  • Hi Wayne,

    thanks for your hints.

    I know the forum probably is the best place for getting good advice for tricky problems. But sometimes it probably would help if there was a solid way to get some basics explained.

    For anyone following: here are some good ones. But I like just plain text help too - so if anyone has some knowlege of a manual out there please post.

    And Wayne I'm looking forward to your video package - any help is appreciated.

    Ingo

  • Hi Rafael,

    I tried a bit with this one.

    It seem as if the syntax has to be the other way round:

    transaction 1 modelChange 'Add baseCS'
    {
        node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
        {
            Technique                 = 'AtModelOrigin';
            DGNModelName              = 'Design Model';
            SymbolSize                = 1;
        }
    }
    
    transaction 2 modelChange 'Add line1, line1_EndPoint, line1_StartPoint, line2, line2_EndPoint, line2_StartPoint'
    {
        node User.Objects.line1_EndPoint Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'OnPlane';
            Plane                     = baseCS.XYPlane;
            XTranslation              = <free> 16509.8223048126;
            YTranslation              = <free> 610.905526160702;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
        node User.Objects.line1_StartPoint Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'OnPlane';
            Plane                     = baseCS.XYPlane;
            XTranslation              = <free> 6637.58036974987;
            YTranslation              = <free> 538.358987137388;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
        node User.Objects.line1 Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByPoints';
            StartPoint                = line1_StartPoint;
            EndPoint                  = line1_EndPoint;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
        node User.Objects.line2_StartPoint Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'OnPlane';
            Plane                     = baseCS.XYPlane;
            XTranslation              = <free> 16840.6576261299;
            YTranslation              = <free> -5076.57885616648;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
        node User.Objects.line2_EndPoint Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'OnPlane';
            Plane                     = baseCS.XYPlane;
            XTranslation              = <free> 6445.86233955;
            YTranslation              = <free> -5147.35756845185;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
        node User.Objects.line2 Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByPoints';
            StartPoint                = line2_StartPoint;
            EndPoint                  = line2_EndPoint;
            Color                     = -1;
            LevelName                 = 'A-WALL-CONC';
            LineStyleName             = 'STYLE_ByLevel';
            LineWeight                = -1;
        }
    }
    
    transaction 3 modelChange 'Add point1, point2'
    {
        node User.Objects.point2 Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'ByNumberAlongCurve';
            Curve                     = line2;
            NumberAlongCurve          = 5;
        }
        node User.Objects.point1 Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'ByNumberAlongCurve';
            Curve                     = line1;
            NumberAlongCurve          = 5;
        }
    }
    
    transaction 4 modelChange 'Add expression1'
    {
        node User.Objects.expression1 Bentley.GC.NodeTypes.Expression
        {
            Technique                 = 'Default';
            Value                     = from r in point2 orderby r.X;
        }
    }
    
    transaction 5 modelChange 'Add line3; change expression1, line2, line2_EndPoint, line2_StartPoint, point1, point2'
    {
        node User.Objects.line2_StartPoint Bentley.GC.NodeTypes.Point
        {
            GraphLocation             = {332.537, 403.003, 0.0, 142.443};
        }
        node User.Objects.line2_EndPoint Bentley.GC.NodeTypes.Point
        {
            GraphLocation             = {332.537, 585.446};
        }
        node User.Objects.line2 Bentley.GC.NodeTypes.Line
        {
            GraphLocation             = {606.537, 403.003};
        }
        node User.Objects.point1 Bentley.GC.NodeTypes.Point
        {
            GraphLocation             = {915.579, 36.317};
        }
        node User.Objects.point2 Bentley.GC.NodeTypes.Point
        {
            GraphLocation             = {943.433, 339.438};
        }
        node User.Objects.expression1 Bentley.GC.NodeTypes.Expression
        {
            GraphLocation             = {1181.222, 138.884};
        }
        node User.Objects.line3 Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByPoints';
            StartPoint                = point1;
            EndPoint                  = expression1;
            GraphLocation             = {1342.411, 336.653};
        }
    }
    
    transaction 6 modelChange 'Change line3 support'
    {
        node User.Objects.line3 Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByPoints';
            EndPoint                  = Reverse(point2);
        }
    }

    The last one shows the support change.

    EndPoint    = Reverse(point2)

    Even if Wayne's solution looks cooler I find this a bit more understandable.Wink

    regards

    Ingo