$create_object_hierarchy

// create the Model object
HPS.Model myModel = HPS.Factory.CreateModel();
// get a reference to the View
HPS.View myView = GetCanvas().GetAttachedLayout().GetAttachedView();
// attach the Model to the View
myView.AttachModel(myModel);
// you can also get a reference to the Model segment
HPS.SegmentKey myModelKey = myModel.GetSegmentKey();


$create_subsegments

// get a reference to the Model segment
HPS.SegmentKey myModelKey = myModel.GetSegmentKey();
// create children of the model segment
HPS.SegmentKey childSegment1 = myModelKey.Subsegment();
HPS.SegmentKey childSegment2 = myModelKey.Subsegment();
// create a grandchild segment by calling Subsegment on the child
HPS.SegmentKey grandchild = childSegment1.Subsegment();


$include

// get a reference to the Model segment
HPS.SegmentKey myModelKey = myModel.GetSegmentKey();
myModelKey.IncludeSegment(subassemblySegment); // first branch
myModelKey.IncludeSegment(subassemblySegment); // second branch


$segment_operations

// move a segment to a new parent
someSegment.MoveTo(newParentSegment);
// copy a segment to another parent
someSegment.CopyTo(anotherSegment);
// delete a segment
childSegment.Delete();


$insert_shell

HPS.Point[] myPointArray = { new HPS.Point(0, 0, 0), new HPS.Point(0, 1, 0), new HPS.Point(1, 1, 0) };
int[] myFaceList = { 3, 0, 1, 2 };
HPS.SegmentKey shellSegment = myModel.GetSegmentKey().Subsegment();
shellSegment.InsertShell(myPointArray, myFaceList);


$2d_geometry

HPS.SegmentKey circleSegment = myModel.GetSegmentKey().Subsegment();
circleSegment.InsertCircle(new HPS.Point(2, 0.5f, 0), 0.5f, new HPS.Vector(0, 0, 1));
HPS.SegmentKey lineSegment = myModel.GetSegmentKey().Subsegment();
lineSegment.InsertLine(new HPS.Point(3, 0.5f, 0), new HPS.Point(4, 0.5f, 0));
lineSegment.GetVisibilityControl().SetLines(true);


$primitives

HPS.SegmentKey cylinderSegment = myModel.GetSegmentKey().Subsegment();
cylinderSegment.InsertCylinder(new HPS.Point(5, 0, 0.5f), new HPS.Point(5.3f, 1, 0), 0.5f);


$setting_attributes

myModel.GetSegmentKey().GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(1, 0, 0));
cylinderSegment.GetVisibilityControl().SetFaces(false);


$visibility

myModel.GetSegmentKey().GetVisibilityControl().SetEdges(true);


$line_settings

// change face color of shell to blue
shellSegment.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0, 1, 0));
// increase edge weight of circle
circleSegment.GetEdgeAttributeControl().SetWeight(3.0f);
// change the solid line to a dashed line
HPS.PortfolioKey myPortfolio = HPS.Database.CreatePortfolio();
lineSegment.GetPortfolioControl().Push(myPortfolio);
HPS.LinePatternKit myLinePatternKitpk = HPS.LinePatternKit.GetDefault(HPS.LinePattern.Default.Dashed);
myPortfolio.DefineLinePattern("dashed_pattern", myLinePatternKitpk);
lineSegment.GetLineAttributeControl().SetPattern("dashed_pattern");


$circle_segment

circleSegment.MoveTo(shellSegment);


$file_import

HPS.Stream.ImportNotifier notifier = null;
in_options.SetSegment(GetModel().GetSegmentKey());
// empty this segment
GetModel().GetSegmentKey().Flush();
try
{
notifier = HPS.Stream.File.Import(path_to_file, in_options);
notifier.Wait();
}
catch (HPS.IOException e)
{
// handle error
}
GetView().FitWorld();
GetView().Update();


$set_rendering_mode

HPS.Rendering.Mode render_mode = GetView().GetRenderingMode();
if (render_mode == HPS.Rendering.Mode.HiddenLine)
GetView().SetRenderingMode(HPS.Rendering.Mode.Default);
else
GetView().SetRenderingMode(HPS.Rendering.Mode.HiddenLine);
GetView().Update();


$shadows

GetView().SetRenderingMode(HPS.Rendering.Mode.GouraudWithLines);
bool state, ignore_transparency;
uint resolution, blurring;
GetView().GetSegmentKey().GetVisualEffectsControl().ShowSimpleShadow(out state, out resolution, out blurring, out ignore_transparency);
if (state == true) // toggle the effect
vxfkit.SetShadowMaps(false).SetSimpleShadow(false);
else
vxfkit.SetShadowMaps(false).SetSimpleShadow(true).SetSimpleShadowPlane(new HPS.Plane(0, 1, 0, 0.005f));
GetView().GetSegmentKey().SetVisualEffects(vxfkit);
GetView().Update();


$loading_shell

HPS.Model model = HPS.Factory.CreateModel(); // creating the Model
GetView().AttachModel(model); // attaching it to the view
try
{
importOptionsKit.SetSegment(model.GetSegmentKey()); // model from file is imported into our model segment
notifier = HPS.Stream.File.Import(path_to_file, importOptionsKit);
// pauses this thread until the file is finished loading
notifier.Wait();
}
catch (HPS.IOException ioe)
{
// handle exception
}
GetView().FitWorld();


$set_color

mySegmentKey.GetMaterialMappingControl()
.SetFaceColor(new HPS.RGBAColor(1.0f, 0.0f, 0.0f, 0.5f))
.SetEdgeColor(new HPS.RGBAColor(0, 0, 0));
mySegmentKey.GetVisibilityControl().SetEdges(true);


$set_face_texture

mySegmentKey.GetMaterialMappingControl()
.SetFaceTexture("woodDiffuse",
HPS.Material.Texture.Channel.DiffuseTexture);


$face_level_texturing

// building the array of six materials
HPS.MaterialKit[] materialKitArray = new HPS.MaterialKit[] { new HPS.MaterialKit(), new HPS.MaterialKit(),
new HPS.MaterialKit(), new HPS.MaterialKit(),
new HPS.MaterialKit(), new HPS.MaterialKit() };
materialKitArray[0].SetDiffuseTexture("woodDiffuse"); // sets a texture on the material
// ... set other materials
HPS.MaterialPaletteDefinition mpd = myPortfolio.DefineMaterialPalette
("myPalette", materialKitArray); // defines a palette using the materials
// the palette is made active on the segment
model.GetSegmentKey().SetMaterialPalette("myPalette");


$set_face_colors

ulong[] faceIndices = { 0, 1, 2, 3, 4, 5 };
float[] materialIndices = { 0, 1, 2, 3, 4, 5 };
myShellKey.SetFaceIndexColorsByList(faceIndices, 0);


$search

HPS.SearchResults searchResults;
ulong numResults = model.GetSegmentKey().Find(HPS.Search.Type.Shell, // searching for circles
HPS.Search.Space.SegmentOnly, // within all subsegments
out searchResults); // search results returned here
HPS.SearchResultsIterator it = searchResults.GetIterator();
while (it.IsValid())
{
HPS.Key key = it.GetItem();
if (key.Type() == HPS.Type.ShellKey)
{
myShellKey = new HPS.ShellKey(key);
}
it.Next();
}


$set_diffuse_color

materialKitArray[1].SetDiffuse(new HPS.RGBAColor(1.0f, 0.0f, 0.0f, 0.5f));


$set_bump

model.GetSegmentKey().InsertDistantLight(new HPS.Vector(1, 1, 1));
materialKitArray[2].SetDiffuseTexture("my_texture");
materialKitArray[2].SetBump("my_heightmap");


$multitexturing

textureOptionsKit.SetModulation(true);
materialKitArray[3].SetDiffuseTexture("brickDiffuse", 0);
materialKitArray[3].SetDiffuseTexture("grassDiffuse", 1);


$mmk

HPS.MaterialMappingKit myMaterialMappingKit = new HPS.MaterialMappingKit();
myMaterialMappingKit.SetFaceColor(new HPS.RGBAColor(0, 0, 1));
myShellKit.SetMaterialMapping(myMaterialMappingKit);


$import_notifier

try
{
importOptionsKit.SetSegment(mySegmentKey);
notifier = HPS.Stream.File.Import(filename, importOptionsKit);
// pauses this thread until the HSF is finished loading
notifier.Wait();
}
catch (HPS.IOException ioe)
{
// handle exception
}


$get_model_key

HPS.SegmentKey modelSegmentKey = GetTopView().GetAttachedModel().GetSegmentKey();


$reflection

modelSegmentKey.GetVisualEffectsControl().SetSimpleReflection(true, 0.5f, 1U, false, 0, 2.0f);
// parameters for equation of a plane
modelSegmentKey.GetVisualEffectsControl().SetSimpleReflectionPlane(new HPS.Plane(0, 1, 0, 0.375f));


$set_shadows

modelSegmentKey.GetVisibilityControl().SetShadows(true);
modelSegmentKey.GetVisualEffectsControl().SetShadowMaps(true, 16, 2048, true, true);


$shadow_attributes

modelSegmentKey.GetVisualEffectsControl().SetSimpleShadow(true); // enables simple shadows
modelSegmentKey.GetVisualEffectsControl().SetSimpleShadowPlane(new HPS.Plane(0, 1, 0, 0.425f)); // sets the plane where the shadows are projected
modelSegmentKey.GetVisualEffectsControl().SetSimpleShadowColor(new RGBAColor(0.2f, 0.2f, 0.2f)); // color of the shadow
modelSegmentKey.GetVisualEffectsControl().SetSimpleShadowLightDirection(new Vector(0, 1, 0)); // light direction


$ppe

ppek.SetBloom(true, 10.0f); // enables bloom. strength can be set from 0 to 10
myWindowKey.SetPostProcessEffects(ppek);
ppek.SetBloom(false); // disables bloom


$create_style

HPS.PortfolioKey myPortfolio = HPS.Database.CreatePortfolio();
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
NamedStyleDefinition myHighlightStyle = myPortfolio.DefineNamedStyle("myStyle", HPS.Database.CreateRootSegment());
myHighlightStyle.GetSource().GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1.0f, 1.0f, 0.0f));
myHighlightStyle.GetSource().GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(1.0f, 0.0f, 0.0f));
myHighlightStyle.GetSource().GetVisibilityControl().SetFaces(true).SetEdges(true);
mySegmentKey.GetStyleControl().PushNamed("myStyle");


$attach_operator

// Get a reference to your View object. In this case I'm using the View from the mfc_sandbox application.
HPS.View myView = GetCanvas().GetAttachedLayout().GetAttachedView();
HPS.HighlightOperator myHighlightOperator = new HPS.HighlightOperator();
// operator becomes 'active' after pushing it onto the operator stack
myView.GetOperatorControl().Push(myHighlightOperator);
// set the highlight style, which we previously defined
HPS.HighlightOptionsKit hok = new HPS.HighlightOptionsKit("myHighlightStyle");
myHighlightOperator.SetHighlightOptions(hok);


$processing_selection

HPS.SelectionResults selectionResults = myHighlightOperator.GetActiveSelection();
HPS.SelectionResultsIterator it = selectionResults.GetIterator();
while (it.IsValid())
{
HPS.SelectionItem selectionItem = it.GetItem();
HPS.Key key;
if (selectionItem.ShowSelectedItem(out key))
{
if (key.Type() == HPS.Type.ShellKey)
{
HPS.ShellKey shellKey = new HPS.ShellKey(key);
// do something with this object
}
}
it.Next();
}