« MEP Sample Ribbon Panel | Main | Fixing RvtMgdDbg for MEP Connectors »

August 17, 2009

Comments

Hi Jeremy,
I am using Revit since 7 version , but i never make some programming work in it.

Can you help me?
1.What language i must to use ?
2.What i need to start programming?
3.Some useful links for biginer!

I am interesting in FreeForm programming.
To make Revit do something like this (it was made in Maya (MEL):http://www.flickr.com/photos/daniloarsic/

http://www.flickr.com/photos/danielwidrig

Big Thanks

Dear Roman,

I am glad to hear of your interest. Regarding your specific questions:

1. You can use any .NET language. C# or VB is easiest and recommended.

2. VSTA or Visual Studio Tools for Applications is built in to the Revit product. The recommended external development environment is Microsoft Visual Studio. You can also use the Express edition, which is free.

3. The Building Coder blog includes a category named 'Getting Started' which includes many topics that are useful for novice Revit API users. A succinct overview of helpful additional resources for getting started is provided in

http://thebuildingcoder.typepad.com/blog/2009/04/getting-started-with-the-revit-2009-api.html

It is written for the Revit 2009 API, but most of it applies equally well to Revit 2010.

Good luck and cheers, Jeremy.

Hi, Jeremy,
I think this way to get bottom is not exact, if the wall has door, It will get two bottom faces which is the wall bottom face splitted by door.

thanks,
Jinshou.

Dear Jinshou,

You are absolutely right, and all kinds of exceptional and not so exceptional cases will need special handling for production use.

Above all, you need lots of testing, and automated testing, and an ever-expanding collection of test cases to insure against regression.

Cheers, Jeremy.

Hi, Jeremy,
I found that the Revit 2012 API has some problems.Like that if the wall has one door, the bottom face should be split into two bottom faces by door, but by API get wall's solid and get solid's faces, only can get one bottom face, it should be two bottom faces. And if more than one door also can only get one bottom face.

thanks,
Jinshou.

Dear Jinshou,

I believe the Revit development team might disagree with you there.

Why should there be two faces? One single face may contain multiple loops, both disconnected outer loops and inner hole loops.

The bottom face of a wall is probably always just one single face, as long as the wall has a flat bottom at all, regardless of any doors it may contain.

That one face may have holes in it, if the door really breaks through the bottom of the wall.

Also, the door may be a little bit up in the wall, off the floor, with no break at all in the bottom face.

Check out that one face and see whether it contains multiple loops.

Cheers, Jeremy.

Hi, Jeremy,

I'm sorry, I made a mistake.

As you said, after add a doors into the wall, it still one face, but the face contains multiple loops.

Thanks,
Jinshou.

Hi Jeremy,
I am trying to get the bottom face of a Beam (structural Framing). In some beams I am getting bottom face when I use Normal.Z0, it is giving me the required bottom face. Can you explain why this happens? kindly help me.

Here is my code:

//methdo to get the bottom face of element passed to it
public static List GetBottomFace(Element ele, Document doc)
{
try
{
List faces = new List();

if (ele is Floor)
{
IList bottomFaces = HostObjectUtils.GetBottomFaces((Floor)ele);

foreach (Reference refer in bottomFaces)
{
faces.Add((doc.GetElement(refer)).GetGeometryObjectFromReference(refer) as Face);
}

return faces;
}

Options opt = new Options();
opt.DetailLevel = ViewDetailLevel.Fine;

GeometryElement geoEle = ele.get_Geometry(opt);
IEnumerator enu = geoEle.GetEnumerator();
enu.Reset();

while (enu.MoveNext())
{
Solid solid = enu.Current as Solid;
if (null != solid)
{
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;

if (null != pf)
{
if (pf.Normal.Z < 0)
{
faces.Add(face);
return faces;
}
}
}
}
}

return null;
}
catch
{
throw new Exception();
}
}

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource