Change Grid Type value or its instance's Extents through API?

Change Grid Type value or its instance's Extents through API?

zefreestijl
Advocate Advocate
591 Views
3 Replies
Message 1 of 4

Change Grid Type value or its instance's Extents through API?

zefreestijl
Advocate
Advocate

Hi, is it possible to control the parameters of Grid type and its instances value via API?

 

Sometimes the extents 2D/3D switch symbol get stuck while turning on/off the crop view

zefreestijl_0-1634528674268.png

 

how can I reset its value through API?

 

 

 

Thanks in advance.

0 Likes
592 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Have you tried snooping the grid element and its methods and properties with RevitLookup?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

zefreestijl
Advocate
Advocate

Hi, Jeremy, thanks for your response.

 

Yes I've tried to lookup the parameters and found the GetExtents.Maximum & Minimum Point.

zefreestijl_0-1634603581304.png

 

I've used something like: 

grid.GetExtents().MaximumPoint = new XYZ(5,5,0);

grid.GetExtents().MaximumPoint = new XYZ(5,15,0);

 

to set its value,

but I couldn't change them to the new position.

 

zefreestijl_1-1634603696644.png

 

 

and nowhere to find the 2D / 3D switch parameter except this.

zefreestijl_2-1634603942627.png

 

I'm still working on how to use this method though.

 

 

 

 

0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

GetExtents returns a value. Using the MaximumPoint property, you are setting some data inside that value. This will obviously not affect the original grid in any way whatsoever. To modify the grid extents in such a direct manner, you would need to call something like a SetExtents method. Unfortunately, that does not exist, indicating that the grid extents are determined in some other manner. How do you modify the grid extents manually in the user interface? Determine the required steps, perform such modifications manually, and analyse what else is affected in the database besides the GetExtents return value:

  

https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-onto...

  

Maybe that will give an indication as to how you can indirectly modify the grid extents programmatically.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open