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: 

Elevation view crop parameters

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
ari.monteiro
1032 Views, 4 Replies

Elevation view crop parameters

I need to implement a method to create an elevation view of a wall. But, this elevation must to show some objets surrounding the wall, such as columns and beams like figure 1 attached.

 

My first idea: get two points on an plan view to define the lateral limits of elevation and select the wall. After I intended to use these data to calculate a bounding box for the elevation using the following code:

 

//getting two points  - lateral limits of the elevation

XYZ ptElev1 = uidoc.Selection.PickPoint("Specify the first point of elevation's lateral limits");
XYZ ptElev2 = uidoc.Selection.PickPoint("Specify the second point of elevation's lateral limits");

 

//bounding box of the wall
BoundingBoxXYZ boundingBoxWall = wall.get_BoundingBox(document.ActiveView);

 

//adjust the limits of elevation view
wallElevation.CropBox.Min = new XYZ(ptElev1.X, ptElev1.Y, boundingBoxWall.Min.Z);
wallElevation.CropBox.Max = new XYZ(ptElev2.X, ptElev2.Y, boundingBoxWall.Max.Z);

 

The last two lines of code seems don't work. The size of bounding box is not updated as I expected (see the figure 2 attached).

 

Any suggestions to solve this problem? I appreciate any suggestions!

 

Ari Monteiro

 

4 REPLIES 4
Message 2 of 5
jeremytammik
in reply to: ari.monteiro

Dear Ari,

 

Does this sample help answer your question?

 

http://thebuildingcoder.typepad.com/blog/2012/06/create-section-view-parallel-to-wall.html

 

Cheers,

 

Jeremy



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

Message 3 of 5
ari.monteiro
in reply to: ari.monteiro

Hi Jeremy! Thanks for your reply!

 

I've seen this article in your blog when I was looking for a solution for my problem. But, this article it is about Section Views and not about Elevation Views.

 

The method CreateElevation( ) does not accept the parameter bounding box like the CreateSection( ) method. See the last line of the following code:

 

IEnumerable<ViewFamilyType> viewFamilyTypes = from elem in new FilteredElementCollector(document).OfClass(typeof(ViewFamilyType))
let type = elem as ViewFamilyType
where type.ViewFamily == ViewFamily.Elevation
select type;


ElevationMarker marker = ElevationMarker.CreateElevationMarker(document, viewFamilyTypes.First().Id, ptElevMed, 1);

 

//Here I don't get supply a bounding box CreateElevation( ) method

ViewSection wallElevation = marker.CreateElevation(document, document.ActiveView.Id, 1);

 

For this reason, I decided to use the CropBox property to try to set the limits of the Elevation View.

 

I prefer determine these limits requesting two points on the plan view for the user, then use these points to calculate the limits.

 

I do not want to use an offset of the bounding box of the wall, as suggested in your code, because this can vary greatly depending on the dimensions of columns and beams around the wall. I imagine that I am forget something when I passed the bounding box Min and Max values.

 

In your code I see you used some methods such as Normalize( ), CrossProduct ( ), etc. for translate the bounding box points before use them, right?

 

Why these methods are needed?

 

Cheers,

 

Ari Monteiro

 

Message 4 of 5
jeremytammik
in reply to: ari.monteiro

Dear Ari,

To begin with, let me just address your last questions, since they are fundamental linear algebra and important in many calculations like this.

Normalize does what it says, i.e., normalise the length of a vector, which means, scale it so that its total length equals 1.

For instance, given a vector (5,0,0), the normalised vector equals (1,0,0).

Given a vector (1,2,3), the normalised vector is scaled by the inverse length = 1 / sqrt( 1 + 4 + 9 ) = 0.2672612419... which results in a vector of ca. (0.2672612419, 0.5345224838, 0.8017837257).

The cross product of two vectors is zero if the vectors are colinear, i.e. lie in a common line or are co-directional. Otherwise, it is perpendicular to them both:

http://en.wikipedia.org/wiki/Cross_product

I cannot say anything about the elevation view off-hand.

I would need to explore that in more depth, as you obviously already have.

I hope this helps.

Cheers,

Jeremy



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

Message 5 of 5
ari.monteiro
in reply to: ari.monteiro

Dear Jeremy,

 

Thank you for the information about linear algebra. Now I understand why the coordinates of model space (points on a plan view) must be transformed before I use them on view space (Elevation or Section View).

 

I saw that you send my question for ADN. I saw that you sent my question for ADN. Thank you for this, too! I will continue research in depth the methods of the class Geometry Helpers to use them my projects.

 

Regards,

Ari Monteiro

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community