hi, here, i want to use the viewpoints data contained in the clash detection results in Navisworks2013, but the api didn't provide any methods to access those data,so is there anyone can tell me how to extract the viewpoints data from those clash results?
Hi,
yes, this is not exposed. Sorry for the bad news. But you can still use COM API to get it:
InwOclTestResult.ViewPoint
Unfortunately the "it worked in the old version" doesn't really help people who's entire code base is written in the old API. I have figured out a way to find a clashes viewpoint by creating a new viewpoint via...
Viewpoint vp = new Viewpoint();
then these 2 lines...
vp.Position = new Point3D(clashResult.Center.X+75, clashResult.Center.Y+30, clashResult.Center.Z-10);
vp.PointAt(new Point3D(clashResult.Center.X, clashResult.Center.Y, clashResult.Center.Z));
will make 'vp' the clashes viewpoint.
However the functionality is still below average at best because even viewpoint lacks all the functionality of the InwOpAnonView and InwNvViewpoint.
For instance is there a way to recreate this code block with the new Viewpoint class??
var vpdAnonView = (InwOpAnonView)VpdPluginLauncher.pluginState.ObjectFactory
(nwEObjectType.eObjectType_nwOpAnonView, null, null);
vpdAnonView.ViewPoint = myViewpoint;
Bitmap pic = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureToImage
(VpdPluginLauncher.pluginState.CreatePicture(vpdAnonView, 1, 800, 800)) as Bitmap;
so that I can create a picture of the viewpoint.
I'm getting tired of the answers to 2013 api questions being, "ya we didn't expose that in the new Api, but you can use it in the old api". Then why did you even build a new API to expose more functionality and a better question why did you not create functionality to be able to convert the old ClashResult objects and old Viewpoint objects to the new api. It seems to me all you did was rearrange classes expose new functionality and then hide old functionality, it makes no sense.
Hi BBoretzky,
Thanks for your comments.
Firstly, could you take a look if the other post helps a bit?
http://forums.autodesk.com/t5/Autodesk-Navisworks-API/Clash-image/m-p/3598862#M599
The .NET API is NOT just a rearrangement of the existing COM API and wrap them. It encapsulates the core code of C++. I believe there is some considerations that our engineer team did not expose the ability of exporting viewpoint /clash image. Sometimes, it would not mean it is a small job, though it looks the old COM API has the similar ability. Or probably it may happen not to be in the bucket in this release. We have had a wish to ask the ability to export image of clash result in .NET API. I cannot gurantee, however I appreciate your understanding and patience. I also welcome you join the annual survey of API wish which would happen in mid-year. The survey of this year for the next release has ended.
I was able to do this after reading the other post here: https://forums.autodesk.com/t5/navisworks-api/how-to-get-a-inwocltestresult-from-a-net-clashresult/m...
You have to use the COM api, but you can get the view from there, and convert it back to a Viewpoint.
private Viewpoint FindComResult(ClashResult clashResult, ClashTest clashTest, Viewpoint defaultView) { InwOpClashElement comClashes = null; InwOpState10 comDoc = ComApiBridge.State; foreach (InwBase oPlugin in comDoc.Plugins()) { if(oPlugin.ObjectName == "nwOpClashElement") { comClashes = oPlugin as InwOpClashElement; if (comClashes != null) break; } } if (comClashes == null) return null; foreach (InwOclClashTest comTest in comClashes.Tests()) { if (comTest.name == clashTest.DisplayName) { foreach (InwOclTestResult comResult in comTest.results()) { if (comResult.name == clashResult.DisplayName) { InwOpAnonView av = ComApiBridge.ToInwOpAnonView(defaultView.CreateCopy()); av.ViewPoint = comResult.ViewPoint; return ComApiBridge.ToViewpoint(av); } } } } return null; }
I'm able to use this code to get Viewpoints of Clash Results but I can't get the Viewpoint of a Group. If you group multiple results together and add a viewpoint, this code cannot get it. Is there a way to get at those viewpoints?
Thanks,
Joe
"I'm getting tired of the answers to 2013 api questions being, "ya we didn't expose that in the new Api, but you can use it in the old api". Then why did you even build a new API to expose more functionality and a better question why did you not create functionality to be able to convert the old ClashResult objects and old Viewpoint objects to the new api. It seems to me all you did was rearrange classes expose new functionality and then hide old functionality, it makes no sense."
I couldn't agree more, well said.