Cropview with picked box

Cropview with picked box

MiguelGT17
Advocate Advocate
715 Views
5 Replies
Message 1 of 6

Cropview with picked box

MiguelGT17
Advocate
Advocate

Dear community, I aim to crop a section view by picking a box and pass its BB.Min and BB.Max data to the  GetCropRegionShapeManager().

 

So far I do not see the need of using transformations as the curve loop from the GetCropRegionShapeManager() work with XYZ global systems. However, it's not cropping the view. Would you be kind of heading me toward the right direction?

 

Kind regards,

Miguel G

0 Likes
Accepted solutions (2)
716 Views
5 Replies
Replies (5)
Message 3 of 6

MiguelGT17
Advocate
Advocate

Actually I've made a code mistake as I was nailing it overnight. The next subject that I am working on has to be with transforms. I've read your post about that topic on https://jeremytammik.github.io/tbc/a/0290_abg07_transform.htm 

MiguelGT17_0-1643566748682.png

MiguelGT17_2-1643567048114.png

then if I want to get the coordinates of my study point with respect to the section view coordinate systems (x'=right direction, y'= up direction, z'= view direction) I will need to follow the next steps: 

 

1). Get the view cropbox transform

MiguelGT17_3-1643567501682.png

2). Wrap the basis and origin value in a M matrix. Then Multiply M with the Study Point. So far, I acknowledge that OfPoint() comprise this operation.

MiguelGT17_4-1643568039393.png

3) Script:

Study point: (24.973068124511, 55.8886371936385, 54.430719963225)

 

view = doc.ActiveView
cropbox = view.CropBox
transform = cropbox.Transform

NEWpoint = transform.OfPoint(XYZ(24.97306812451155.888637193638554.430719963225))

MiguelGT17_5-1643568471736.png

 

 

Indeed, OfPoint() Method is determining a point that has non sense pertaining to view coordinate system as it lays on the view plane, and therefore the z' basis should no depict a 97.75 value. (it must be less or more between -1 or 1)

 

secondly, If I repeat the same process to the point ( 32.909966197563436.174604659224954.430719963225) that is located to the left off the section view origin, the x' keeps a positive value (67.14).

MiguelGT17_6-1643569060041.pngMiguelGT17_7-1643569109661.png

 

 

Am I skipping or misunderstanding something here?  I would appreciate hearing some thoughts from you Jeremy.

Thanks in advance,

Miguel G.

 

 

 

 

 

 

0 Likes
Message 4 of 6

jeremy_tammik
Alumni
Alumni

Dear Miguel,

 

Sorry, I am not fit enough to answer this question off the top of my head.

 

I would have to program, test, and debug it myself to provide a reliable answer.

 

Hence:

 

Sorry, no comment.

 

Cheers,

 

Jeremy

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 6

RPTHOMAS108
Mentor
Mentor
Accepted solution

There are two subtle things about this process:

 

Firstly I believe you are looking for the inverse transform, converting picked model locations to the local view system for cropbox.

 

Secondly your max and min diagonal points must relate to the view system so that every ord of min is less than every equivalent ord of max. You can't just pick two points and transform them you have to create two new points after transformation based on the max and min of each transformed coord.

 

I think there is the posts out there that provide details for this process. In the above I assume you are not intending to change the view direction?

Message 6 of 6

MiguelGT17
Advocate
Advocate

Dear Thomas, Absolutely, pertaining to Jeremy's blog I should've been using the inverse transformation from the section view. 

MiguelGT17_0-1643587809822.png

Currently I'm aiming to get the location of a rebar reinforcement(by taking the mid point between BB.min and BB.max) and then determining its X and Y location in the local section view system by making use of the Inverse transformation so I can place multi-rebar tags. I am set to go and continue working on the script, many thanks to both of you!

 

Study point: XYZ(20,20,50)

Transform.Inverse.OfPoint():  MiguelGT17_1-1643589121568.png

MiguelGT17_4-1643589319447.png

 

 

 

0 Likes