Message 1 of 10
Not applicable
06-01-2016
08:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am creating a Navisworks plugin that utilizes Triangle.Net to create a mesh from the locations of MTEXT items. When I run the plugin in Navisworks I get this error.
The project builds fine and I get this error while debugging. The exception at the bottom says it can't load Triangle, but I'm not sure why.
I'll insert my code as well.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Autodesk.Navisworks.Api.Plugins;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.ComApi;
using Autodesk.Navisworks.Api.Interop.ComApi;
using TriangleNet;
using TriangleNet.IO;
using TriangleNet.Geometry;
namespace Assets
{
[PluginAttribute("Assets", "AKR",
DisplayName = "Assets",
ToolTip = "Attributes space to each room tag and locates all of the assets within that room.")]
public class SaveViewpoints : AddInPlugin
{
public override int Execute(params string[] parameters)
{
InputGeometry roomCenters = new InputGeometry();
InputGeometry sects = new InputGeometry();
InputGeometry assets = new InputGeometry();
Mesh mesh = new Mesh();
Search search = new Search();
ModelItemCollection matches = new ModelItemCollection();
Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;
// create search group / add conditions to the group / execute the search
SearchCondition con1 = SearchCondition.HasPropertyByDisplayName("Item", "Type").EqualValue(VariantData.FromDisplayString("MTEXT"));
search.SearchConditions.Add(con1);
//make selection and execute search
search.Selection.CopyFrom(oDoc.CurrentSelection.SelectedItems.DescendantsAndSelf);
matches = search.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false);
// Add the points.
foreach(ModelItem room in matches)
{
roomCenters.AddPoint(room.Geometry.BoundingBox.Center.X, room.Geometry.BoundingBox.Center.Y);
}
mesh.Triangulate(roomCenters);
FileWriter.Write(mesh, "test.ele");
/*for (int i = 0; i < matches.Count; i++)
{
}*/
return 0;
}
}
}Any help would be greatly appreciated!
Solved! Go to Solution.