Sample Code: Parasolid component highlighting

Language: C#

Highlight vertices and edges of the Parasolid component
Sample code for DemoUserCommand in hps_wpf_sandbox

  1. Set visibility of vertex and edge after importing Parasolid file
public override void Execute(object parameter)
{
  GetCanvas().GetFrontView().GetAttachedModel().GetSegmentKey().GetVisibilityControl().SetLines(true).SetMarkers(true);
  GetCanvas().Update();
}
  1. Get component of vertex and edge and highlight
public override void Execute(object parameter)
{
  HPS.Parasolid.CADModel cadmodel = _win.CADModel as HPS.Parasolid.CADModel;

  HPS.HighlightOptionsKit highlight_options = HPS.HighlightOptionsKit.GetDefault();
  highlight_options.SetStyleName("highlight_style");

  HPS.HighlightControl hightlightctrl = GetCanvas().GetWindowKey().GetHighlightControl();
  hightlightctrl.UnhighlightEverything();

  HPS.Component[] edgecomarray = cadmodel.GetAllSubcomponents(HPS.Component.ComponentType.ParasolidTopoEdge);
  foreach (Component com in edgecomarray)
  {
    HPS.KeyPath[] apath = HPS.Parasolid.CADModel.GetKeyPath(com);
    hightlightctrl.Highlight(apath[0], highlight_options);
  }

  HPS.Component[] vertexcomarray = cadmodel.GetAllSubcomponents(HPS.Component.ComponentType.ParasolidTopoVertex);
  foreach (Component com in vertexcomarray)
  {
    HPS.KeyPath[] apath = HPS.Parasolid.CADModel.GetKeyPath(com);
    hightlightctrl.Highlight(apath[0], highlight_options);
  }
  GetCanvas().Update();
}