Grid line API

Grid line API

EugenijusJanuskevicius6305
Participant Participant
2,941 Views
8 Replies
Message 1 of 9

Grid line API

EugenijusJanuskevicius6305
Participant
Participant

Hi All,

 

is it possible to access the segments of the split (not multisegment) grid line in Python? I'm working on a solution to match the grid endpoints, bubbles and  leaders between different views. Right now just the split and multi-segment grids are the issues.

 

I always get the number of the associated lines as 1 here, although the grid is split into 3 distinct parts: start segment, the middle and the end segment:

selection = rpw.ui.Selection()
...
for cGrid in selection:
    el = cGrid.unwrap()
    if isinstance(el, DB.Grid):
        curves=el.GetCurvesInView(DB.DatumExtentType.ViewSpecific, cView)
        if len(curves) <> 1:
            UI.TaskDialog.Show('pyRevitPlus', 'The grid line is defind by {} curves, unable to proceed', len(curves))
        else:
            cCurve = curves[0]

 

0 Likes
2,942 Views
8 Replies
Replies (8)
Message 2 of 9

jeremytammik
Autodesk
Autodesk

Please check out the CurtainWallGrid and GridCreation Revit SDK samples.

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 9

EugenijusJanuskevicius6305
Participant
Participant

Thank you for the response.

GridCreation is dealing with the predefined ar new grids.

 

I'm working on the solution for adjusting grids on the separate views when they are "out of sync" with the desired result. Manual grid adjustment is a highly time -consuming operation.

 

Here, in this example template, I can restore grid points '1' to '6', but not point '7' or '8' of the gridline "2". Ths same is true for grid"3", "4", "7"

EugenijusJanuskevicius6305_0-1597053231073.png

The initial condition:

EugenijusJanuskevicius6305_1-1597053315883.png

The result. The leader line for grid "4" looks different from the template, but there is yet no API to adjust it.

EugenijusJanuskevicius6305_2-1597053384295.png

 

0 Likes
Message 4 of 9

jeremytammik
Autodesk
Autodesk

Thank you for the explanation and clarification.

 

I am not experienced enough with grids to understand what you are talking about or even see the differences that you mention.

 

If you can achieve the desired adjustments manually in the user interface, you can use RevitLookup to analyse what properties were affected and how they were modified and try to achieve that same effect programmatically. If that is not possible, please submit a minimal reproducible case for this with detailed and exact descriptions of the steps to reproduce the problem that I can share with the development team:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

  

If you cannot achieve the desired effect manually in the UI, I would recommend searching for a corresponding wish list for this in the Revit Idea Station, and adding your comments there, or creating a new entry, if there is none already present there yet for the suggested functionality:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302

 

Tag it as an API wish:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent/label-name/api

 

Ensure it gets as many votes as possible to underline its importance to you and the rest of the developer community.

 

The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements.

 

The Revit development team look there. Your comment here in the discussion forum might be overlooked.

  

Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 5 of 9

EugenijusJanuskevicius6305
Participant
Participant

Thank You for the response and guidance.

The desired adjustments can be achieved manually, but I am not able to identify them via RevitLookup.

 

The final goal is to save time wasted in per-view adjusting grid positions for drawing consistency. This is a time-consuming operation, especially when dealing with repeated, dependant views and multiple levels, eg, designing a condominium.

The workflow is supposed to be as follows:

  • the user adjust the view-dependant configuration of axes in a view;
  • the uses saves the configuration;
  • the user recalls the saved configuration in another view

The solution right now works in a plan view using continuous grids. Multisegment grids, section an elevation views are to be implemented in the future.

For the split grid, I haven't found a way to adjust the split between segments. The grids should intersect for the readability of the drawing.

I've pasted the suggestion to the Idea Board, https://forums.autodesk.com/t5/revit-ideas/grid-api/idi-p/9683318

0 Likes
Message 6 of 9

tito.galleguillos
Explorer
Explorer

Hi Eugenijus

 

I came accross this topic while trying to solve a similar problem (replicating display lines for grids in similar user selected views, including grid splits). I was able to access the three lines (start, middle, and end) for splitted grids, but could not modify them (for the same grid in a different view). However, the PropagateToViews method from the DatumPlane class achieved exactly what I was looking for. I don't know if it also accomplishes the same on those multi-segment grids, but it may be worth the try (if not already solved).

 

Cheers

0 Likes
Message 7 of 9

catalinaDV4PA
Observer
Observer

Hi tito.galleguillos,

I know this was a long time ago, but did you manage to find a way to modify these end curves from the split grid through the API? How did you even obtain them? I’m doing something similar to what EugenijusJanuskevicius6305 show us in the first post, and I consistently get just one curve

 

 

thanks!

0 Likes
Message 8 of 9

tito.galleguillos
Explorer
Explorer

Hi Catalina

 

Sorry for the delay on the reply.

 

I don't remember exactly. I think I did not manage to modify the curves, and that's why I opted to go with the PropagateToViews method (which to be honest I don't even use too much, as it's pretty straightforward from the UI).

 

However, if it is of any use, I did manage to find the curves of continuous (1) and splitted (3) grids with the following code (part of a foreach loop):

 

if (!g.CanBeVisibleInView(vista_actual)) //g is the current Grid object and vista_actual is the document's ActiveView.
continue;
curves = g.GetCurvesInView(DatumExtentType.ViewSpecific, vista_actual);
List<Line> lista_lineas = new List<Line>();
Options o = new Options();
o.ComputeReferences = true;
o.IncludeNonVisibleObjects = true;
o.View = vista_actual;
GeometryElement ge = g.get_Geometry(o);
if (null != ge)
{
foreach (GeometryObject go in ge)
{
Line l = go as Line;
if (null != l)
lista_lineas.Add(l);
}
}

 

The above code returns 1 line for continuous grids, 3 lines for splitted grids and... zero lines for curved grids.

Cheers

0 Likes
Message 9 of 9

catalinaDV4PA
Observer
Observer

Thanks, Tito! I’ll give it a try. I suppose I was missing the get_geometry part.

0 Likes