Usual Grid in Generative Components

Hello everybody,
I'm trying to create a simple axis grid. It should consist of X-directed and Y-directed axis lines and you should be able to set the number of axes and the distances between them by number-sliders.
My first thought was:
1. lines on the X and Y axis
2. points on these lines to determine distances and number of axes (e.g. length 10 m, number of points 5 --> points every 2 m)
3. axis grid lines: Starting points are the points on the axes (X direction, if point on Y axis and vice versa)
It seems quite complicated to me and I can imagine that there is an easier way. Does anyone know?
Best regards, Heiko

  • maybe something for a function (by Volker Mueller...)

    otherwise I would do it about the same way. Maybe you could remove some nodes for widthTotal and lenghtTotal to slim it a bit down.

    Ingo

  • Thinking about this for a while I would prefer using an Excel sheet for the definition of the grid distances.

    This allows different grid spacing (as frequently happening) on both axes without hassle.

  • Hey Ingo,

    thank you for your help. 

    I think your model Looks very nice and I like the Connection to Excel, that you created. Can you tell me how I can connect the Excel Sheet to Model?

    Heiko

  • Hey Heiko,

    there's a node type for excel connection. And some hints in the help file.

    Here's my script. You should be able to paste it into the transaction window.

    transaction 1 modelChange 'Add baseCS, cs1, lineX'
    {
        node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
        {
            Technique                 = 'AtModelOrigin';
            DGNModelName              = 'Design Model';
            SymbolSize                = 1;
        }
        node User.Objects.cs1 Bentley.GC.NodeTypes.CoordinateSystem
        {
            Technique                 = 'ByUniversalTransform';
            CoordinateSystem          = baseCS;
            XTranslation              = 2;
            YTranslation              = 1;
            ZTranslation              = 1;
        }
    }
    
    transaction 2 modelChange 'Add excelGridX, excelGridY'
    {
        node User.Objects.excelGridX Bentley.GC.NodeTypes.ExcelRange
        {
            Technique                 = 'ReadValue';
            WorkbookFileName          = 'C:\range1.xlsx';
            SheetName                 = "sheet1";
            RangeAddress              = "c3:e9";
        }
        node User.Objects.excelGridY Bentley.GC.NodeTypes.ExcelRange
        {
            Technique                 = 'ReadValue';
            WorkbookFileName          = 'C:\range1.xlsx';
            SheetName                 = "sheet1";
            RangeAddress              = "h3:j9";
        }
    }
    
    transaction 3 modelChange 'Add lenghtY, lenghtX, point1, point2'
    {
        node User.Objects.point2 Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'ByCoordinateList';
            CoordinateSystem          = cs1;
            XYZTranslation            = excelGridY.Value;
        }
        node User.Objects.point1 Bentley.GC.NodeTypes.Point
        {
            Technique                 = 'ByCoordinateList';
            CoordinateSystem          = cs1;
            XYZTranslation            = excelGridX.Value;
        }
        node User.Objects.lenghtX Bentley.GC.NodeTypes.Expression
        {
            Technique                 = 'Default';
            Value                     = point1[6].X-cs1.X;
        }
        node User.Objects.lenghtY Bentley.GC.NodeTypes.Expression
        {
            Technique                 = 'Default';
            Value                     = point2[6].Y-cs1.Y;
        }
    }
    
    transaction 4 modelChange 'Add gridX, gridY'
    {
        node User.Objects.gridX Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByStartPointDirectionLength';
            StartPoint                = point2;
            Direction                 = cs1.XDirection;
            Length                    = lenghtX;
        }
        node User.Objects.gridY Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByStartPointDirectionLength';
            StartPoint                = point1;
            Direction                 = cs1.YDirection;
            Length                    = lenghtY;
        }
    }
    
    transaction 5 modelChange 'Change gridX, gridY, lenghtX, lenghtY'
    {
        node User.Objects.gridY Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByStartPointDirectionLength';
            Length                    = lenghtY;
        }
        node User.Objects.gridX Bentley.GC.NodeTypes.Line
        {
            Technique                 = 'ByStartPointDirectionLength';
            Length                    = lenghtX;
        }
    }
    

    and the excel sheet. I placed it just under C:/

    range1.xlsx

    cheers

    Ingo

  • Hey Ingo,

    thats very cool stuff, thanks for sharing. 

    I have only two more question about this. 

    1. Do you know how I can create Points on every Intersection of the Axis, so that I can put columns onto them. Is it possible to intersect geometries with a node?

    2. How do i have to write the Code to get the first or the last item of a list? This Option would be great to have, if you consider to design walls on the outter lines of the Grid. 

    Thanks anyways for your Support. You helped me a lot so far.

    Heiko