Poi3D Nuget Packages
The Poi3D Nuget packages include .Net Framework controls which are used to embed the Poi3D collaboration portal into Windows© based client applications (more information about the Poi3D portal can be found at https://poi3d.com). These Poi3D controls allow documents, whether in the form of 2D files or 3D models, to be viewed and supplemented with attachments. For example, annotations can be added to PDF or image files, or sensor data, such as from home automation, can be displayed. In the 3D domain, surfaces can be designed, instructions defined, and bill of materials created. The software also supports Augmented Reality (AR) and Virtual Reality (VR), allowing viewer positions to be saved. All defined attachments can be stored parallel to the document, ensuring that the original document remains unchanged. The Poi3D controls provides their functionality both locally on the computer and via the web. This is achieved by embedding a web browser, which displays the portal version of Poi3D, within the Poi3D controls, allowing communication between the two. The corresponding portal URL can be set via a property, allowing self-hosted Poi3D portals to be integrated into the client. The Poi3D controls also support the conversion of 3D standard formats like 3DXML, IFC, JT, STEP, STL, OBJ, GLB, or GLTF into a format which can be displayed in the web browser.
In local mode, the user is not logged into the portal. While they use the functions of the embedded web portal, all attachments are passed to the client application and are not sent to the server.
When the user is logged in and a local file is open, it can be saved in the portal and shared with other portal users. This is done through the save dialog, which is accessed via the "Save to Portal" command in the portal menu. Once the document is saved in the portal, it can then be made available to other users via workgroups. Additionally, further files can be attached to the document. If attachments to portal documents which were sent from the client application are created or modified, these changes will be passed to the client application as well.
The Poi3D controls use the .Net Framework 4.7.2 and the C++ runtime 14.0 under 64 bit. The runtime can be downloaded from https://aka.ms/vs/17/release/vc_redist.x64.exe
The controls can be downloaded from https://www.nuget.org (Cadmai.Poi3dPlugin.WinFormsControl or Cadmai.Poi3dPlugin.WpfControl)
After the Nuget package is installed, the embedded Poi3dPortalControl can be dragged into a Windows/WPF Form.
The communication between the client and the Poi3D control is established by using methods provided from the Poi3D control and reacting to events sent by the Poi3D control. How to initialize the portal
public Form1()
{
InitializeComponent();
poi3dPortalControl.PortalUrl = "https://demo.mypoi3d.com/Poi3dViewer.html";
// default is https://poi3d-portal.com/Poi3dViewer.html
poi3dPortalControl.PortalColor = Poi3dPortalColor.Light;
poi3dPortalControl.PortalLanguage = Poi3dPortalLanguage.English;
poi3dPortalControl.OpenPortalWebSite();
}
How to convert/open a local file
private void openLocalFileMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "All Files|*.wpm;*.obj;*.stl;*.3ds;*.glb;*.gltf;*.stp;*.step;*.jt;*.3dxml;*.ifc;*.jpg;*.png;*.tif;*.bmp;*.svg;*.gif;*.pdf|" +
"3D Mesh Files (*.wpm;*.obj;*.stl;*.3ds;*.glb;*.gltf)|*.wpm;*.obj;*.stl;*.3ds;*.glb;*.gltf|" +
"3D CAD Files (*.stp;*.step;*.jt;*.3dxml;*.ifc)|*.stp;*.step;*.jt;*.3dxml;*.ifc|" +
"Image Files (*.jpg;*.png;*.tif;*.bmp;*.svg;*.gif)|*.jpg;*.png;*.tif;*.bmp;*.svg;*.gif|" +
"2D Documents (*.pdf)|*.pdf";
openFileDialog.FilterIndex = 1;
openFileDialog.Multiselect = false;
openFileDialog.RestoreDirectory = true;
var success = openFileDialog.ShowDialog();
if (success == DialogResult.OK) //if (success == true) for WPF
{
string inputFileName = openFileDialog.FileName;
string extension = System.IO.Path.GetExtension(inputFileName).ToLower();
switch (extension)
{
case ".obj":
case ".stl":
case ".3ds":
case ".glb":
case ".gltf":
case ".3dxml":
case ".jt":
case ".step":
case ".stp":
case ".ifc":
poi3dPortalControl.Convert3dModel(inputFileName);
break;
case ".wpm":
case ".jpg":
case ".png":
case ".bmp":
case ".svg":
case ".gif":
case ".tif":
case ".pdf":
poi3dPortalControl.OpenLeftDocumentFromFile(inputFileName, "");
break;
}
}
}
How to receive information from the portal
To handle events from the portal just add an even handler to the Poi3dControlEvent provided by the Poi3D control.
private async void poi3dPortalControl_Poi3dControlEvent(object sender, Poi3dControlEventArgs args)
{
switch (args.EventType)
{
case Poi3dPortalEvents.AnnotationsSaved:
string annotations = await poi3dPortalControl.GetDocumentAnnotations();
//-> save the annotations
break;
case Poi3dPortalEvents.AnnotationsRequested:
//-> read and send the annotations
string annotationString = "[]";
Poi3dMessage result = await poi3dPortalControl.SetDocumentAnnotations(annotationString);
break;
case Poi3dPortalEvents.ModelConverted:
string fullFileNameToLoad = args.Info;
//-> open the model
poi3dPortalControl.OpenLeftDocumentFromFile(fullFileNameToLoad, "");
break;
}
}
The following properties are published:
The following portal methods are available:
The following events are sent from the control:
To avoid DPI switching for Windows Forms applications (e.g. after model conversion) just use the DpiAware.manifest for your application which is inserted into the development project.
Poi3D controls, licensed under the MIT license, use external libraries like the Microsoft WebView2 control, Web-Ifc libraries or OpenCASCADE libraries for 3D model conversion. The license information is stored in the docs folder of the package. As a default, the Poi3D portal https://poi3d-portal.com is referenced, which can be used freely. If you want to use or host your own Poi3D portal instance please find more information here