Refer to PMI Viewer Example.
PMIViewerApplication.cs
using baseviewer;
using System.Collections.Generic;
namespace pmiviewer
{
{
{
myFactory = theFactory;
myNodes.Push(theRoot);
}
{
myNodes.Pop();
}
{
var anSGENode = myFactory.CreateNode (theSGE);
myNodes.Peek().AddChildNode(anSGENode);
myNodes.Push(anSGENode);
AddPMINodes(theSGE);
return true;
}
{
var aPartNode = myFactory.CreateNode(thePart);
myNodes.Peek().AddChildNode(aPartNode);
AddPMINodes(thePart);
var aRepNode = myFactory.CreateNode(aRep);
aPartNode.AddChildNode (aRepNode);
}
{
{
var anElement = anIt.
Next();
if (anElement != null)
{
var aPMINode = myFactory.CreateNode(anElement.GraphicalElement());
}
}
myNodes.Peek().AddChildNode(aRootNode);
}
private Stack<ModelPrs_SceneNode> myNodes = new Stack<ModelPrs_SceneNode>();
};
class PMIViewerApplication : BaseViewerApplication
{
public PMIViewerApplication(BaseViewer theViewer) : base(theViewer)
{
myReaderParameters.SetReadPMI(true);
}
protected override void CreateSceneNodes()
{
ModelVisitor aVisitor = new ModelVisitor(myRoot, aFactory);
myModel.Accept(aVisitor);
}
}
}
Provides an interface to appearance which is a collection of visual styles.
Definition: ModelData_Appearance.hxx:39
Defines an RGBA color (with alpha channel).
Definition: ModelData_Color.hxx:34
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
Iterator over added PMIData items, which contains graphical and semantical elements.
Definition: ModelData_PMITable.hxx:81
Defines a container storing PMI data.
Definition: ModelData_PMITable.hxx:40
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
Base class for part, instance and assembly.
Definition: ModelData_SceneGraphElement.hxx:39
ModelData_PMITable PMI() const
Returns a PMI table.
Definition: ModelData_SceneGraphElement.cxx:255
Creates a scene nodes and its children from input data model objects.
Definition: ModelPrs_SceneNodeFactory.hxx:53
Represents a node in the visual scene graph.
Definition: ModelPrs_SceneNode.hxx:44
bool AddChildNode(ModelPrs_SceneNode &theNode)
Adds theNode to children. Returns false if the node already has a parent, otherwise returns true.
Definition: ModelPrs_SceneNode.cxx:787
void SetAppearance(const ModelData_Appearance &theAppearance)
Definition: ModelPrs_SceneNode.cxx:894
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
PMIViewerWindow.xaml
<Window x:Class="pmiviewer.PMIViewerWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:baseviewer="clr-namespace:baseviewer"
mc:Ignorable="d"
Title="CAD Exchanger" Height="600" Width="1000">
<baseviewer:BaseViewer x:Name="myViewer"></baseviewer:BaseViewer>
</Window>
PMIViewerWindow.xaml.cs
using System.Windows;
namespace pmiviewer
{
public partial class PMIViewerWindow : Window
{
public PMIViewerWindow()
{
InitializeComponent();
myViewer.ViewerApplication = new PMIViewerApplication(myViewer);
}
}
}
App.xaml
<Application x:Class="pmiviewer.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="PMIViewerWindow.xaml">
</Application>
App.xaml.cs
using System.Runtime.InteropServices;
using System.Windows;
namespace pmiviewer
{
public partial class App : Application
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
public App()
{
SetDllDirectory("../../../../../../../win64/vc14.1/bin");
string aKey = LicenseKey.Value();
if (!LicenseManager.Activate(aKey))
{
MessageBox.Show("Failed to activate CAD Exchanger license.");
Shutdown();
}
}
}
}