Retrieve View Cube directions from an assembly environment without opening Part Document
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I am looking for a solution to improve my algorithm and I am not sure if it's possible to do that.
The task is to change part document iProperty from assembly environment. I am able to do that, but there are some conditions - I have to retrieve vectors from view cube and based on these vectors data I am changing an appropriate iProperties.
My current approach is to open part document -> retrieve vectors -> close part document.
This is the code which does the job when the part document is opened.
public static Matrix GetXYZVectorsFromViewCube(Inventor.View activeView)
{
TransientGeometry oTG = activeView.Application.TransientGeometry;
Camera camera = activeView.Camera;
camera.ViewOrientationType = ViewOrientationTypeEnum.kRightViewOrientation;
Vector xVector = camera.Target.VectorTo(camera.Eye);
camera.ViewOrientationType = ViewOrientationTypeEnum.kBackViewOrientation;
Vector yVector = camera.Target.VectorTo(camera.Eye);
camera.ViewOrientationType = ViewOrientationTypeEnum.kTopViewOrientation;
Vector zVector = camera.Target.VectorTo(camera.Eye);
Point origin = oTG.CreatePoint();
Matrix mtx = oTG.CreateMatrix();
mtx.SetCoordinateSystem(origin, xVector, yVector, zVector);
return mtx;
}
The question is:
Can I get the same result without opening part document (accessing camera View of active document), OpenVisible = False property is also not an option, because I get different / unexpected results.
Here is a related topic posted by me:
https://forums.autodesk.com/t5/inventor-programming-ilogic/get-vector-values-from-view-cube-inventor...
Thank you
Best regards,
Karolis Šarskus