How to get SectionView cropbox?

How to get SectionView cropbox?

pochao
Contributor Contributor
1,085 Views
3 Replies
Message 1 of 4

How to get SectionView cropbox?

pochao
Contributor
Contributor

hi there,

 

I can get ViewSection's BoundingBoxXYZ、 Origin、ViewDirection

 

But i don't know how to get the CropBox's X,Y (like image dash line)

 

please help me, thank

擷取.PNG

0 Likes
Accepted solutions (1)
1,086 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Pochao,

 

Thank you for your query.

 

Here is a discussion of creating a section view that is parallel to and exactly aligned with a selected wall:

 

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

 

I also includes retrieving and setting the X and Y extents to size and align the view exactly with the wall.

 

The crop box is simply attached to the view.

 

To clarify how to determine the exact crop box X and Y coordinates, this discussion of a Element in View Crop Box Predicate might help:

 

http://thebuildingcoder.typepad.com/blog/2012/02/element-in-view-crop-box-predicate.html

 

I hope this helps.

 

Best regards,

 

Jeremy



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

0 Likes
Message 3 of 4

pochao
Contributor
Contributor

Dear Jeremy,

 

thanks for your quickly response.

 

So i need to use Transform object to get coordinate?

 

My stupid method:

 

        Dim bb As BoundingBoxXYZ = MyViewSection.CropBox

        If MyViewSection.ViewDirection.Y = -1 Then 'UP
            minX = MyViewSection.Origin.X - (bb.Max.X - bb.Min.X) / 2
            maxX = MyViewSection.Origin.X + (bb.Max.X - bb.Min.X) / 2
            minY = MyViewSection.Origin.Y
            maxY = MyViewSection.Origin.Y + (bb.Max.Z - bb.Min.Z)
        ElseIf MyViewSection.ViewDirection.Y = 1 Then 'DOWN
            minX = MyViewSection.Origin.X - (bb.Max.X - bb.Min.X) / 2
            maxX = MyViewSection.Origin.X + (bb.Max.X - bb.Min.X) / 2
            minY = MyViewSection.Origin.Y - (bb.Max.Z - bb.Min.Z)
            maxY = MyViewSection.Origin.Y
        ElseIf MyViewSection.ViewDirection.X = -1 Then 'RIGHT
            minX = MyViewSection.Origin.X
            maxX = MyViewSection.Origin.X + (bb.Max.Z - bb.Min.Z)
            minY = MyViewSection.Origin.Y - (bb.Max.X - bb.Min.X) / 2
            maxY = MyViewSection.Origin.Y + (bb.Max.X - bb.Min.X) / 2
        ElseIf MyViewSection.ViewDirection.X = 1 Then 'LEFT
            minX = MyViewSection.Origin.X - (bb.Max.Z - bb.Min.Z)
            maxX = MyViewSection.Origin.X
            minY = MyViewSection.Origin.Y - (bb.Max.X - bb.Min.X) / 2
            maxY = MyViewSection.Origin.Y + (bb.Max.X - bb.Min.X) / 2
        End If

 

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Pochau,

 

Thank you for your appreciation.

 

Just looking at your code I would guess that you want to compare two vectors, e.g. the bounding box Z vector and the view vector, project one onto the other, and determine the resulting X and Y components in some other direction, maybe perpendicular.

 

Find some ten-year old kid that goes to school and does geometry and vector algebra and ask her:

 

https://en.wikipedia.org/wiki/Vector_space

 

🙂

 

Cheers,

 

Jeremy



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