Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i draw grid lines on levels?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
1382 Views, 3 Replies

How can i draw grid lines on levels?

Hi 

I have a problem on drawing grids.

When i create grids, the grids exist on ground floor and first level view plan

But It doesn't show from second level on plan view.

 


캡처3.PNG캡처2.PNG

First picture is on a ground floor view plan.

Second picture is on a Secound Level view plan.

 

 

But i don't know how to solve.

 

And at elevation view, grids are short than level's elevation

I wanna fix it too.

 

캡처.PNG

 

Here is my code.

int cnt =0;

for (int i = 0; i < horLenght; i++)
{
XYZ z = XYZ.BasisZ;
XYZ start = new XYZ(0, cnt,  0) * 0.3048;
XYZ end = new XYZ(hor + gri , cnt , 0) * 0.3048;
Line geomLine = Line.CreateBound(start, end);
lineGrid1 = Grid.Create(doc, geomLine);

 

cnt += gri;
}
double verLenght = hor / gri + 1;
double cnt2 = 0;
for (int i = 0; i < verLenght; i++)
{
XYZ start2 = new XYZ(cnt2 , -gri , 0) * 0.3048;
XYZ end2 = new XYZ(cnt2, ver + gri, 0) * 0.3048;
Line geomLine2 = Line.CreateBound(start2, end2);
lineGrid2 = Grid.Create(doc, geomLine2);


cnt2 += gri;
}

3 REPLIES 3
Message 2 of 4
naveen.kumar.t
in reply to: Anonymous

Hi @Anonymous ,

To solve your first part of the question (i.e)to make the grid visible in Second level view plan

Go to level 2 -->In Properties-->Visibility/Graphics override-->Annotation Category-->Under visibility make sure the GRID is checked-->apply/Ok

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
naveen.kumar.t
in reply to: Anonymous

To make the grid visible in Second level on plan view

Try using this code

 View view = doc.ActiveView;
                foreach(Category cat in view.Document.Settings.Categories)
                {
                    if(cat.Name.Contains("Grids"))
                    {                       
                        cat.set_Visible(doc.ActiveView, true);                        
                    }
                }

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 4
Extraneous
in reply to: Anonymous

@naveen.kumar.t you was reading @Anonymous question inattentively, it isn't a problem with visible of Grids category, it is a problem that 3D-grips are not stretched to the top Level. The are some methods in Revit API to resolve this question, for example Grid.Maximize3DExtents (auto-stretch grips to the most top and most bottom point og Model Geometry) and  SetVerticalExtents (manual set a heigth position of top and bottom point of Grid).

Sample code:

 

public void CreateAndStrechGridByHeight()
{
	Document doc = this.ActiveUIDocument.Document;
	XYZ p1 = new XYZ(0,0,0);
	XYZ p2 = new XYZ(10,0,0);
	Line l = Line.CreateBound(p1,p2);
	
	using(Transaction t= new Transaction(doc))
	{
		t.Start("Create grid");
		Grid g = Grid.Create(doc, l);
		g.SetVerticalExtents(-100, 200);
		t.Commit();
	}
}

 

 

Alexander Zuev
In BIM we trust
Facebook | Linkedin | Telegram

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community