Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Center of a section view

carolina.machado
Advocate

Center of a section view

carolina.machado
Advocate
Advocate

Hello!

 

I am building a code to extend the boundaries of the cropbox of a section view to determined levels. The biggest problem right now is that I can't get the origin of the cropbox/section view.

Is there any logic behind the propertie Origin present in elements of ViewSection Class?

Does anyone attempted to change cropbox boundaries and was succeful?

 

Thank you very much,

Carolina.

0 Likes
Reply
Accepted solutions (1)
2,216 Views
5 Replies
Replies (5)

carolina.machado
Advocate
Advocate

*Did anyone attempt...

I'm sorry... my english is not very good yet.

 

Was it possible to understand what I asked?

Anyone?

0 Likes

aignatovich
Advisor
Advisor

Hi!

 

Once created view.CropBox changing does not affect anything. This is from SDK:

 

The effect of setting the crop box of a view is to modify the crop region and far clip plane to the smallest values which will completely contain the 3D box specified by the source. Neither the cut plane nor the view frame are affected by setting the crop box.

 

But you can achieve what you want using crop box region shape manager. This is Revit Python shell code for your consideration:

 

v = doc.ActiveView

shpManager = v.GetCropRegionShapeManager()

loop = CurveLoop.CreateViaTransform(shpManager.GetCropShape()[0], Transform.CreateTranslation(XYZ.BasisZ))

tx = Transaction(doc, "move section view")
tx.Start()

shpManager.SetCropShape(loop)

tx.Commit()

You also can be interesting in changing far clip plane. It can be done by changing VIEWER_BOUND_OFFSET_FAR parameter value

0 Likes

carolina.machado
Advocate
Advocate

Thank you for your answer @aignatovich

However it didn't solve my problem.

 

I am creating a code that allows the user to select a ViewSection and choose the levels that he wants to see through the ViewSection. Do you know if that's possible?

 

Or do you know if there's any way to relate the Max and Min properties of the BoundingBox that is associated to the ViewSection to the real boundaries of it, like the elevation of levels or something like that?

 

 

0 Likes

jeremytammik
Autodesk
Autodesk
Accepted solution

Here is a discussion of cropping a 3D view to specific extents:

 

http://thebuildingcoder.typepad.com/blog/2009/12/crop-3d-view-to-room.html

 

Here is one on aligning a section view to exactly match a selected wall:

 

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

carolina.machado
Advocate
Advocate

Thank you a lot @jeremytammik!

 

Your solution to crop a 3D view to specific extents fitted perfectly!!! 

 

I get the bounding box of the view section, transform its max and min points, change the Z value of them, transform them back and then I set a new bounding box to the view section.

0 Likes