$database
$show_subsegments
mySegmentKey.ShowSubsegments(out children);
for (int i = 0; i < children.Length; i++)
{
String s = sk.Name();
}
$manipulate_segment
anotherSegmentKey.MoveTo(mySegmentKey);
anotherSegmentKey.Flush();
anotherSegmentKey.Delete();
$create_subsegment
HPS.SegmentKey newSegmentKey = mySegmentKey.Down(
"new segment",
true);
$create_root_segment
$include_segment
$include_filter
includeKey.SetFilter(HPS.AttributeLock.Type.VisibilityLights);
$delete_include
$conditional_include
mySegmentKey.IncludeSegment(someSpecialSegment, condition1);
mySegmentKey.SetCondition("c1");
$reference_segment
mySegmentKey.ReferenceGeometry(anotherSegment);
$keys
myText.SetFont("times new roman");
$geometry_keys
myCircleKey.SetRadius(2.0f);
myCircleKey.SetCenter(
new HPS.Point(1.0f, 2.5f, 3.2f));
$edge_attribute_control_example
mySegmentKey.GetLineAttributeControl().SetPattern("my_line_pattern");
mySegmentKey.GetEdgeAttributeControl().SetWeight(3.0f);
$camera_attribute_control_example
mySegmentKey.GetCameraControl().ShowProjection(out proj);
mySegmentKey.GetCameraControl().Orbit(20, 30);
mySegmentKey.GetCameraControl().Zoom(10);
$insert_circle
circleKit.SetRadius(0.75f);
circleKit.SetRadius(0.25f);
mySegmentKey.InsertCircle(circleKit);
circleKey.Show(out anotherCircleKit);
$modify_circle
circleKey.SetRadius(0.5f);
circleKey.SetCenter(
new HPS.Point(0, 0, 0)).SetNormal(
new HPS.Vector(0, 0, 1)).SetRadius(0.5f);
$attribute_locks
parentSegment.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1, 0, 0));
parentSegment.GetAttributeLockControl().SetLock(HPS.AttributeLock.Type.Everything);
childSegment.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0, 0, 1));
childSegment.InsertSphere(
new HPS.Point(0, 0, 0), 0.5f);
$create_application_window
HPS.ApplicationWindowKey appWindowKey = HPS.Database.CreateApplicationWindow(myWindowHandle, HPS.Window.Driver.OpenGL2);
appWindowKey.IncludeSegment(modelKey);
appWindowKey.Update();
$standalone
HPS.Database.CreateStandAloneWindow(HPS.Window.Driver.DirectX11);
$attribute_locks
parentSegment.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1, 0, 0));
parentSegment.GetAttributeLockControl().SetLock(HPS.AttributeLock.Type.Everything);
childSegment.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0, 0, 1));
childSegment.InsertSphere(
new HPS.Point(0, 0, 0), 0.5f);
$sawok
sawok.SetSubscreen(
new HPS.Rectangle(0.25f, 0.75f, -0.35f, 0.75f));
sawok.SetMobility(HPS.Window.Mobility.FixedRatio);
$traversal_1
$traversal_2
if (mySegmentKey.Type() == HPS.Type.None)
{
}
$traversal_3
ulong numChildren = mySegmentKey.ShowSubsegments();
numChildren = mySegmentKey.ShowSubsegments(out childArray);
$search
ulong numResults = mySegmentKey.Find(HPS.Search.Type.Circle,
HPS.Search.Space.Subsegments,
out searchResults);
while (it.IsValid())
{
if (key.Type() == HPS.Type.CircleKey)
{
}
it.Next();
}
$examining_type
if (myKey.Type() == HPS.Type.ShellKey)
{
}
else
{
}
$set_projection
mySegmentKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Orthographic);
$insert_example
mySegmentKey.InsertShell(shellKit);
mySegmentKey.InsertText(textKit);
mySegmentKey.InsertSphere(sphereKit);
$update
windowKey.Update();
myCanvas.Update();
$keypath
keyArray[0] = shellKey;
keyArray[1] = includeKey;
keyPath.SetKeys(keyArray);
$shownet
keyPath.ShowNetCamera(out cameraKit);
$010302_a
mySegmentKey.ShowCamera(out myCameraKit);
myCameraKit.ShowTarget(out target);
myCameraKit.ShowPosition(out pos);
mySegmentKey.GetCameraControl().ShowTarget(out target);
mySegmentKey.GetCameraControl().ShowPosition(out pos);
$010302_b
HPS.TextKey myText = mySegmentKey.InsertText(
new HPS.Point(0.0f, 0.0f, 0.0f),
"My string is here.");
$010302_c
$010302_d
$010302_e
highlightText.SetBold(true);
myTextKey.Set(highlightText);
$010303_a
HPS.TextKey myTextKey = mySegmentKey.InsertText(
new HPS.Point(0.0f, 0.0f, 0.0f),
"My important text string.");
myTextKey.SetBold(true);
myTextKey.SetLineSpacing(1.5f);
myTextKey.SetRotation(20);
$010303_b
textKit.SetText("My important text string.");
textKit.SetBold(true);
textKit.SetLineSpacing(1.5f);
textKit.SetRotation(20);
mySegmentKey.InsertText(textKit);
$010303_c
myTextKey.Show(out textKit);
textKit.SetFont("times new roman");
textKit.SetSize(10, HPS.Text.SizeUnits.Points);
myTextKey.Set(textKit);
$010304_a
float w, h;
myCameraControl.ShowTarget(out target);
myCameraControl.ShowField(out w, out h);
myCameraControl.ShowPosition(out pos);
$show_logic
bool state;
if (mySegmentKey.GetVisibilityControl().ShowLines(out state))
{
}
else
{
}
$010305_a
highlightText.SetBold(true);
$010305_b
highlightText.SetBold(true).SetColor(new RGBAColor(1, 0, 1));
$010305_c
highlightText.SetBold(true).SetColor(new HPS.RGBAColor(1, 0, 1));
myTextKey.Set(highlightText);
$010305_d
myTextKey.SetBold(true);
myTextKey.SetColor(new RGBAColor(1, 0, 1));
$010305_e
highlightText.SetBold(true);
highlightText.SetColor(new RGBAColor(1, 1, 0));
myTextKey.Set(highlightText);
$010305_f
highlightText.SetBold(true).SetColor(new HPS.RGBAColor(1, 1, 0));
myTextKey.Set(highlightText);
$010308_a
$user_data
byte [] myData = new byte[] { (byte) 'H', (byte) 'O', (byte) 'O', (byte) 'P', (byte) 'S' } ;
mySegmentKey.SetUserData(new IntPtr(33), 5, myData);
byte[] myByteArray = new byte[100];
mySegmentKey.ShowUserData(new IntPtr(33), out myByteArray);
ulong data_count = mySegmentKey.ShowUserDataCount();
mySegmentKey.UnsetUserData(new IntPtr(33));
$create_shell
HPS.Point[] points = {
new HPS.Point(0, 0, 0),
new HPS.Point(2, 0, 0),
new HPS.Point(2, 2, 0),
new HPS.Point(0, 2, 0),
new HPS.Point(0, 0, 2),
new HPS.Point(2, 0, 2),
new HPS.Point(2, 2, 2),
new HPS.Point(0, 2, 2) };
int[] faceList = { 4, 0, 1, 2, 3,
4, 1, 5, 6, 2,
4, 5, 4, 7, 6,
4, 4, 0, 3, 7,
4, 3, 2, 6, 7,
4, 0, 4, 5, 1 };
mySegmentKey.InsertShell(points, faceList);
$set_normals
myShellKit.SetVertexNormalsByRange(0, normalArray);
myShellKit.SetFaceNormalsByRange(0, normalArray);
myShellKit.UnsetFaceNormals();
$hole
HPS.Point[] points = {
new HPS.Point(0, 0, 0),
new HPS.Point(3, 0, 0),
new HPS.Point(3, 3, 0),
new HPS.Point(0, 3, 0),
new HPS.Point(1, 1, 0),
new HPS.Point(2, 1, 0),
new HPS.Point(2, 2, 0),
new HPS.Point(1, 2, 0) };
int[] faces = { 4, 0, 1, 2, 3,
-4, 4, 5, 6, 7 };
mySegmentKey.InsertShell(points, faces);
$020103_a
HPS.Point[] points = {
new HPS.Point(-1, 0, 0),
new HPS.Point(0, 0, 0),
new HPS.Point(0, 1, 0),
new HPS.Point(-1, 1, 0),
new HPS.Point( 0, 0, 0),
new HPS.Point(1, 0, 0),
new HPS.Point(1, 1, 0),
new HPS.Point( 0, 1, 0),
new HPS.Point( 1, 0, 0),
new HPS.Point(2, 0, 0),
new HPS.Point(2, 1, 0),
new HPS.Point( 1, 1, 0) };
int[] faces = { 4, 0, 1, 2, 3,
4, 4, 5, 6, 7,
4, 8, 9, 10, 11 };
mySegmentKey.InsertShell(points, faces);
$020103_b
HPS.Point[] points = {
new HPS.Point(-1, 0, 0),
new HPS.Point(0, 0, 0),
new HPS.Point(0, 1, 0),
new HPS.Point(-1, 1, 0),
new HPS.Point( 1, 0, 0),
new HPS.Point(1, 1, 0),
new HPS.Point(2, 0, 0),
new HPS.Point( 2, 1, 0) };
int[] faceList = { 4, 0, 1, 2, 3,
4, 1, 4, 5, 2,
4, 4, 6, 7, 5 };
$020103_c
myShellKey.EditFacelistByDeletion(1, 1);
$020103_d
insertedPoints[0] =
new HPS.Point(0.5f, 0.5f, 0);
int[] insertedFacelist = { 3, 1, 8, 2 };
myShellKey.EditPointsByInsertion(8, insertedPoints);
myShellKey.EditFacelistByInsertion(1, insertedFacelist);
$020104_a
myShellKey.SetVertexRGBAColorsByRange(0, vertexColors);
$020104_b
mySegmentKey.GetVisibilityControl().SetFaces(false);
mySegmentKey.GetVisibilityControl().SetFaces(true);
$020104_c
mySegmentKey.GetVisibilityControl().SetVertices(true).SetEdges(false).SetFaces(false);
$set_marker_size
mySegmentKey.GetMarkerAttributeControl().SetSize(0.25f, HPS.Marker.SizeUnits.WorldSpace);
$sphere_marker
PortfolioKey portfolioKey = HPS.Database.CreatePortfolio();
portfolioKey.DefineGlyph("my sphere", HPS.GlyphKit.GetDefault(Glyph.Default.Sphere));
mySegmentKey.GetPortfolioControl().Push(portfolioKey);
mySegmentKey.GetVisibilityControl().SetVertices(true);
mySegmentKey.GetVisibilityControl().SetMarkerLights(true).SetLights(true);
mySegmentKey.GetMaterialMappingControl().SetVertexColor(new RGBAColor(1, 1, 0));
mySegmentKey.GetMarkerAttributeControl().SetSymbol("my sphere").SetSize(0.75f);
$020104_e
mySegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(1, 0, 0));
$shell_from_geometry
HPS.ShellKey newSphereShell = mySegmentKey.InsertShellFromGeometry(sphereKey);
HPS.ShellKey newCylinderShell = mySegmentKey.InsertShellFromGeometry(cylinderKey);
HPS.ShellKey newTextShell = mySegmentKey.InsertShellFromGeometry(textKey);
$0202_a
PointArray[0] =
new HPS.Point(-0.8f, 0.4f, -0.8f);
PointArray[1] =
new HPS.Point(-0.8f, 0, -0.6f);
PointArray[2] =
new HPS.Point(-0.8f, -0.4f, -0.4f);
PointArray[3] =
new HPS.Point(-0.4f, 0.4f, -0.4f);
PointArray[4] =
new HPS.Point(-0.4f, 0, -0.2f);
PointArray[5] =
new HPS.Point(-0.4f, -0.4f, -0.3f);
PointArray[6] =
new HPS.Point(0, 0.4f, 0.15f);
PointArray[8] =
new HPS.Point(0, -0.4f, 0.05f);
PointArray[9] =
new HPS.Point(0.4f, 0.4f, 0.2f);
PointArray[10] =
new HPS.Point(0.4f, 0, 0.2f);
PointArray[11] =
new HPS.Point(0.4f, -0.4f, 0.4f);
PointArray[12] =
new HPS.Point(0.8f, 0.4f, 0.5f);
PointArray[13] =
new HPS.Point(0.8f, 0, 0.3f);
PointArray[14] =
new HPS.Point(0.8f, -0.4f, 0.3f);
PointArray[15] =
new HPS.Point(1.2f, 0.4f, 0.3f);
PointArray[16] =
new HPS.Point(1.2f, 0, 0.3f);
PointArray[17] =
new HPS.Point(1.2f, -0.4f, 0.3f);
MeshKey meshKey = mySegmentKey.InsertMesh(6, 3, PointArray);
$mesh_normals
new HPS.Vector(0.9f, 0.5f, 0.55f),
myMeshKit.SetVertexNormalsByRange(0, normalArray);
myMeshKit.SetFaceNormalsByRange(0, normalArray);
myMeshKit.UnsetFaceNormals();
$020202_a
mySegmentKey.GetVisibilityControl().SetEdges(false);
mySegmentKey.GetVisibilityControl().SetMeshQuadEdges(true);
$020202_b
ulong[] faceList = new ulong[3];
faceList[0] = 5;
faceList[1] = 10;
faceList[2] = 13;
meshKey.SetFaceRGBColorsByList(faceList, rgbColor);
meshKey.SetFaceVisibilitiesByList(faceList, false);
$0203_a
textKit.SetFont("verdana");
textKit.SetText("TECH SOFT 3D");
textKit.SetSize(40, HPS.Text.SizeUnits.Pixels);
textKit.SetAlignment(HPS.Text.Alignment.Center);
mySegmentKey.InsertText(textKit);
$text_region
TextKey myTextKey = mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"This is my text!");
bool adjust_direction = true;
bool relative_coordinates = true;
bool window_space = false;
myTextKey.SetRegion(pointArray,
HPS.Text.RegionAlignment.Center,
HPS.Text.RegionFitting.Auto,
adjust_direction,
relative_coordinates,
window_space);
$font_search
windowKey.FindFonts(out fsr);
while (iter.IsValid())
{
state.GetName();
iter.Next();
}
$020301_a
uint width, height;
myWindowKey.GetWindowInfoControl().ShowPhysicalPixels(out width, out height);
$020302_a
HPS.TextKey tk = mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"Good morning\nThis is another line");
tk.SetLineSpacing(2.0f);
tk.SetLineSpacing(0.5f);
$020303_a
HPS.TextKey textKey = mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"TECH SOFT 3D\nBUILD WITH THE BEST");
textKey.EditTextByDeletion(1, 6, 4);
textKey.EditTextByInsertion(1, 6, 3, "FOR");
$020304_a
mySegmentKey.GetTextAttributeControl().SetTransform(HPS.Text.Transform.Transformable);
$020304_b
mySegmentKey.GetTextAttributeControl().SetTransform(HPS.Text.Transform.CharacterPositionOnly);
$020305_a
mySegmentKey.GetTextAttributeControl().SetAlignment(HPS.Text.Alignment.BottomLeft);
mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"Tech Soft 3D");
$020305_b
mySegmentKey.GetTextAttributeControl().SetAlignment(HPS.Text.Alignment.Center,
HPS.Text.ReferenceFrame.WorldAligned,
HPS.Text.Justification.Right);
mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"Choose\nTech Soft 3D\nfor high\nperformance\ngraphics");
$rotated_text
HPS.TextKey textKey = mySegmentKey.InsertText(
new HPS.Point(0, 0, 0),
"Choose\nTech Soft 3D\nfor high\nperformance\ngraphics");
mySegmentKey.GetTextAttributeControl().SetFont("stroked");
mySegmentKey.GetTextAttributeControl().SetSize(40, HPS.Text.SizeUnits.Points);
mySegmentKey.GetModellingMatrixControl().Rotate(0, 0, 30);
mySegmentKey.GetTextAttributeControl().SetTransform(HPS.Text.Transform.Transformable);
$020305_d
mySegmentKey.GetTextAttributeControl().SetRotation(40);
$020305_e
mySegmentKey.GetTextAttributeControl().SetPath(new HPS.Vector(1, 0.5f, 0));
mySegmentKey.GetTextAttributeControl().SetRotation(HPS.Text.Rotation.FollowPath);
$020306_a
mySegmentKey.GetTextAttributeControl().SetTransform(HPS.Text.Transform.Transformable);
mySegmentKey.GetTextAttributeControl().SetGreeking(true, 6,
HPS.Text.GreekingUnits.Points, HPS.Text.GreekingMode.Box);
$020307_a
String text = "TECH SOFT 3D\u2197\u2300\u21A7";
mySegmentKey.GetTextAttributeControl().SetFont("ts3d");
$0204_a
mySegmentKey.GetMaterialMappingControl().SetLightColor(new HPS.RGBAColor(1, 0, 1));
$020401_a
spotlightKit.SetCameraRelative(false)
.SetPosition(new HPS.Point(20, 40, 0))
.SetTarget(new HPS.Point(0, 0, 0))
.SetInnerCone(20, HPS.Spotlight.InnerConeUnits.Degrees)
.SetOuterCone(30, HPS.Spotlight.OuterConeUnits.Degrees);
$020402_a
mySegmentKey.InsertDistantLight(
new HPS.Vector(x, y, z));
$camera_relative_lights
spotlightKey.SetCameraRelative(true);
distantLightKey.SetCameraRelative(true);
$0205_a
mySegmentKey.InsertLine(pointArray);
$0205_b
mySegmentKey.GetLineAttributeControl().SetWeight(2.0f);
$ray
rayKit.SetType(HPS.InfiniteLine.Type.Ray);
mySegmentKey.InsertInfiniteLine(rayKit);
$editing_lines
myLineKey.EditPointsByReplacement(0, editedPoints);
myLineKey.EditPointsByInsertion(3, editedPoints);
$insert_nurbs_surface
int index = 0;
for (int j = 0; j < 10; j++)
{
for (float i = 0; i < 10; i += 0.1f)
{
pointArray[index++] =
new HPS.Point(i, (float)Math.Sin(i), (float)j);
}
}
nsk.SetPoints(pointArray);
nsk.SetUCount(10);
nsk.SetVCount(100);
nsk.SetUDegree(3);
nsk.SetVDegree(3);
mySegmentKey.InsertNURBSSurface(nsk);
$nst_step1
linePoints[0] =
new HPS.Point(0.35f, 0.3f, 0);
linePoints[1] =
new HPS.Point(0.70f, 0.3f, 0);
linePoints[2] =
new HPS.Point(0.5f, 0.7f, 0);
$nst_step2
lineKit.SetPoints(linePoints);
trimElement.SetCurve(lineKit);
$nst_step3
trimElementArray[0] = trimElement;
$nst_step4
trimKit.SetOperation(HPS.Trim.Operation.Remove);
trimKit.SetShape(trimElementArray);
$nst_step5
trimKitArray[0] = trimKit;
$nst_step6
nurbsSurfaceKit.SetTrims(trimKitArray);
mySegmentKey.InsertNURBSSurface(nurbsSurfaceKit);
$end_caps_joins
lpok.SetEndCap("solid_circle");
lpok.SetStartCap("circle");
mySegmentKey.GetLineAttributeControl().SetPattern("solid", lpok);
$infinite_line
ilk.SetType(HPS.InfiniteLine.Type.Line);
ilk.SetFirst(new Point(0, 0, 0));
ilk.SetSecond(new Point(1, 1, 0));
mySegmentKey.InsertInfiniteLine(ilk);
$020601_a
circleKit.SetRadius(0.75f);
$020602_a
mySegmentKey.InsertCircularArc(
new HPS.Point(-0.5f, -0.5f, 0),
new HPS.Point(0, 0.75f, 0),
$020603_a
mySegmentKey.InsertCircularWedge(
new HPS.Point(-0.5f, -0.5f, 0),
new HPS.Point(0, 0.75f, 0),
$020604_a
ellipseKit.SetCenter(
new HPS.Point(0, 0, 0));
ellipseKit.SetMajor(
new HPS.Point(0.75f, 0, 0));
ellipseKit.SetMinor(
new HPS.Point(0, 0.5f, 0));
mySegmentKey.InsertEllipse(ellipseKit);
$020605_a
ellipticalArcKit.SetCenter(
new HPS.Point(0, 0, 0));
ellipticalArcKit.SetMajor(
new HPS.Point(0.75f, 0, 0));
ellipticalArcKit.SetMinor(
new HPS.Point(0, 0.5f, 0));
ellipticalArcKit.SetStart(0.0f);
ellipticalArcKit.SetEnd(0.75f);
mySegmentKey.InsertEllipticalArc(ellipticalArcKit);
$0207_a
mySegmentKey.GetMarkerAttributeControl().SetSymbol("myMarkerName");
mySegmentKey.InsertMarker(new Point(0, 0, 0));
$020701_a
segKey1.GetMarkerAttributeControl().SetSize(5).SetDrawingPreference(Marker.DrawingPreference.Fastest);
segKey2.GetMarkerAttributeControl().SetSize(10, HPS.Marker.SizeUnits.Pixels).SetDrawingPreference(Marker.DrawingPreference.Fastest);
segKey3.GetMarkerAttributeControl().SetSize(0.1f, HPS.Marker.SizeUnits.WorldSpace).SetDrawingPreference(Marker.DrawingPreference.Fastest);
MarkerKey markerKey3 = segKey3.InsertMarker(
new HPS.Point(0, -0.35f, 0));
$020702_a
markerKey2.SetPoint(
new HPS.Point(-0.25f, 0, 0));
someOtherMarkerKey.Delete();
$020703_a
mySegmentKey.GetVisibilityControl().SetMarkers(false);
mySegmentKey.GetVisibilityControl().SetMarkers(true);
mySegmentKey.GetMaterialMappingControl().SetMarkerColor(new HPS.RGBAColor(1, 0, 0));
$0209_a
pointArray[0] =
new HPS.Point(0.15f, 0.25f, 0);
pointArray[1] =
new HPS.Point(-0.35f, 0.35f, 0);
pointArray[3] =
new HPS.Point(-0.35f, -0.4f, 0);
pointArray[4] =
new HPS.Point(0.15f, -0.15f, 0);
$0209_b
mySegmentKey.GetVisibilityControl().SetFaces(true);
mySegmentKey.GetEdgeAttributeControl().SetWeight(2);
mySegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(0, 0, 0));
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0.32f, 0.78f, 0.95f));
$0209_c
editedPoints[0] =
new HPS.Point(-0.35f, 0.65f, 0);
polygonKey.EditPointsByReplacement(1, editedPoints);
polygonKey.EditPointsByDeletion(3, 1);
editedPoints[0] =
new HPS.Point(0.25f, 0, 0);
polygonKey.EditPointsByInsertion(4, editedPoints);
polygonKey.ShowPoints(out editedPoints);
$0210_a
sphereKit.SetRadius(0.5f);
sphereKit.SetBasis(
new HPS.Vector(0, 1, 0),
new HPS.Vector(1, 0, 0));
mySegmentKey.InsertSphere(sphereKit);
$0210_b
mySegmentKey.GetSphereAttributeControl().SetTessellation(50);
$0211_a
new HPS.Point(-0.75f, -0.5f, -1),
0.55f,
HPS.Cylinder.Capping.Both);
$021101_a
float[] radii = { 0.5f, 0 };
cylinderKit.SetPoints(endPoints);
cylinderKit.SetRadii(radii);
cylinderKit.SetCaps(HPS.Cylinder.Capping.Both);
mySegmentKey.InsertCylinder(cylinderKit);
$021102_a
float[] radius = { 0.25f };
for (int i = 0; i < 64; i++) {
float angle = 2.0f * 3.1415926536f * i / 64.0f;
float x = 0;
float y = (float) Math.Cos(angle);
float z = (float) Math.Sin(angle) - 1.5f;
points[i] = new Point(x, y, z);
}
points[64] = points[0];
mySegmentKey.InsertCylinder(points, radius, HPS.Cylinder.Capping.Both);
$021102_b
float[] radii = { 0.25f, 0.3f };
mySegmentKey.InsertCylinder(points, radii, HPS.Cylinder.Capping.Both);
$021102_c
mySegmentKey.GetCylinderAttributeControl().SetTessellation(40);
$021102_d
float[] radius = { 0 };
Point[] points = {
new HPS.Point(-0.5f, -0.5f, 0),
new HPS.Point(0.5f, -0.5f, 0),
new HPS.Point(0.5f, 0.5f, 0),
new HPS.Point(-0.5f, 0.5f, 0),
new HPS.Point(-0.5f, 0, 0) };
ck.SetVertexRGBColorsByRange(0, rgbColorArray, HPS.Cylinder.Component.Faces);
$021201_a
Point[] pointArray = {
new HPS.Point(-1.75f, -1.75f, 0),
new HPS.Point(-0.75f, -0.75f, 0),
new HPS.Point(-0.5f, 0.5f, 0),
new HPS.Point( 0, -0.5f, 0),
new HPS.Point( 0.5f, 0.75f, 0),
new HPS.Point( 0.75f, 0, 0),
float[] knotArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
float[] weightArray = { 1, 0.7f, 1, 0.5f, 1, 0.8f, 1 };
nck.SetPoints(pointArray);
nck.SetKnots(knotArray);
nck.SetWeights(weightArray);
nck.SetDegree(2);
nck.SetParameters(0, 1);
mySegmentKey.GetCurveAttributeControl().SetViewDependent(true);
$021201_b
float[] newKnots = { 3.5f, 4.5f };
nurbsKey.EditKnotsByReplacement(3, newKnots);
HPS.Point[] newPoints = {
new HPS.Point(-2.5f, -1.5f, -0.5f),
new HPS.Point(-1.0f, -0.5f, 0.5f) };
nurbsKey.EditPointsByReplacement(0, newPoints);
float[] newWeights = { 0.3f };
nurbsKey.EditWeightsByReplacement(5, newWeights);
$021202_a
Point[] points = {
new HPS.Point(3, 1, 0),
new HPS.Point(1, 1, 0),
new HPS.Point(0, 2, 0),
new HPS.Point(-2, 2, 0),
new HPS.Point(-2, 3, 0),
new HPS.Point(3, 1, 1),
new HPS.Point(1, 1, 1),
new HPS.Point(0, 2, 1),
new HPS.Point(-2, 2, 1),
new HPS.Point(-2, 3, 1),
new HPS.Point(3, -1, 2),
new HPS.Point(1, -1, 2),
new HPS.Point(0, 0, 2),
new HPS.Point(-2, 0, 2),
new HPS.Point(-2, 1, 2),
new HPS.Point(3, -1, 3),
new HPS.Point(1, -1, 3),
new HPS.Point(0, 0, 3),
new HPS.Point(-2, 0, 3),
new HPS.Point(-2, 1, 3),
new HPS.Point(3, 0, 4),
new HPS.Point(1, 0, 4),
new HPS.Point(0,-1, 4),
new HPS.Point(-2, -1, 4),
new HPS.Point(-2, 2, 4) };
float[] weights = { 1, 1, 1, 1, 1, 1, 0.5f, 0.5f, 0.5f, 1, 1, 0.5f, 0.5f,
0.5f, 1, 1, 0.5f, 0.5f, 0.5f, 1, 1, 1, 1, 1, 1 };
float[] uKnots = { 0, 0, 0, 1, 2, 3, 4, 4, 4 };
float[] vKnots = { 0, 0, 0, 1, 2, 3, 4, 4, 4 };
nsk.SetPoints(points);
nsk.SetWeights(weights);
nsk.SetUKnots(uKnots);
nsk.SetVKnots(vKnots);
nsk.SetUCount(5);
nsk.SetVCount(5);
nsk.SetUDegree(3);
nsk.SetVDegree(3);
mySegmentKey.InsertNURBSSurface(nsk);
$insert_cutting_section
mySegmentKey.GetVisibilityControl().SetCutEdges(true);
mySegmentKey.GetMaterialMappingControl().SetCutEdgeColor(new HPS.RGBAColor(1, 0, 0));
mySegmentKey.InsertCuttingSection(new Plane(0, 1, 0, -0.42f));
$capping_plane
csk.SetVisualization(HPS.CuttingSection.Mode.Square,
new HPS.RGBAColor(0.25f, 0.25f, 0.25f, 0.25f));
csk.SetPlanes(
new HPS.Plane(0, 1, 0, -0.42f));
mySegmentKey.InsertCuttingSection(csk);
$capping_geometry
mySegmentKey.GetVisibilityControl().SetCutFaces(true);
mySegmentKey.GetMaterialMappingControl().SetCutFaceColor(new HPS.RGBAColor(0.5f, 0, 0));
$multiple_sections
planeArray[0] = new Plane(0, 1, 0, -0.1f);
planeArray[1] = new Plane(-1, 0, 0, 0);
csk.SetPlanes(planeArray);
mySegmentKey.InsertCuttingSection(csk);
$cutting_sections_gather
myWindowKey.GetVisibilityControl().SetCutGeometry(true);
myWindowKey.GetCuttingSectionAttributeControl()
.SetCappingLevel(HPS.CuttingSection.CappingLevel.Segment)
.SetCuttingLevel(HPS.CuttingSection.CuttingLevel.Global);
opt.SetLevel(HPS.CuttingSection.GatheringLevel.Segment);
path.Append(myWindowKey);
ulong cap_count = path.GatherCutGeometry(myWindowKey.Subsegment("caps"), opt);
myWindowKey.Subsegment("model").Delete();
$reference_geometry
HPS.ShellKey shellKey = isolatedSegment.InsertShell(shellKit);
refKey.SetModellingMatrix(matrixKit);
refKey.Delete();
$text_extents
float out_xfrac, out_yfrac;
myKeyPath.ComputeTextExtent("My text string...", out out_xfrac, out out_yfrac);
$set_face_rgb_by_range
myShellKey.SetFaceRGBColorsByRange(0, 3,
new HPS.RGBColor(1, 0.5f, 0));
$set_face_vis_by_range
myShellKey.SetFaceVisibilitiesByRange(0, 3, false);
$level
mySegmentKey.GetCuttingSectionAttributeControl().SetCuttingLevel(HPS.CuttingSection.CuttingLevel.Local);
mySegmentKey.GetCuttingSectionAttributeControl().SetCuttingLevel(HPS.CuttingSection.CuttingLevel.Global);
$csak
csak.SetCappingLevel(HPS.CuttingSection.CappingLevel.SegmentTree);
csak.SetMaterialPreference(HPS.CuttingSection.MaterialPreference.Explicit);
mySegmentKey.SetCuttingSectionAttribute(csak);
$optimize_shell
sook.SetTolerance(0.1f, HPS.Shell.ToleranceUnits.FeatureSizePercentage);
sook.SetHandednessOptimization(HPS.Shell.HandednessOptimization.Fix);
myShellKey.Optimize(sook);
$grids
gridKit.SetFirstCount(10);
gridKit.SetSecondCount(10);
gridKit.SetFirstPoint(
new HPS.Point(0.3f, 0, 0));
gridKit.SetSecondPoint(
new HPS.Point(0, 0.1f, 0));
gridKit.SetType(HPS.Grid.Type.Quadrilateral);
mySegmentKey.InsertGrid(gridKit);
$simple
srok.SetTest(HPS.Shell.RelationTest.Simple);
myShellKey.ComputeRelation(pointArray, srok, out srrk);
srrk.ShowRelations(out shellRelationArray);
for (int i = 0; i < shellRelationArray.size(); i++)
{
if (relation == HPS.Shell.Relation.On)
{
}
else if (relation == HPS.Shell.Relation.Off)
{
}
}
$enclosure
srok.SetTest(HPS.Shell.RelationTest.Enclosure);
srok.SetTreeContext(treeContext);
myShellKey.ComputeRelation(pointArray, srok, out srrk);
float[] floatArray = new float[3];
srrk.ShowRelations(out shellRelationArray);
for (int i = 0; i < shellRelationArray.size(); i++)
{
if (relation == HPS.Shell.Relation.In)
{
}
else if (relation == HPS.Shell.Relation.Out)
{
}
else if (relation == HPS.Shell.Relation.On)
{
}
}
$distance
srok.SetTest(HPS.Shell.RelationTest.Distance);
myShellKey.ComputeRelation(pointArray, srok, out srrk);
srrk.ShowDistances(out floatArray);
for (int i = 0; i < floatArray.size(); i++)
{
float distance = floatArray[i];
}
$0301_a
mySegmentKey.GetDrawingAttributeControl().SetWorldHandedness(HPS.Drawing.Handedness.Left);
$030101_a
windowKey.ConvertCoordinate(HPS.Coordinate.Space.Window, windowPoint, HPS.Coordinate.Space.World, out worldPoint);
$030102_a
mySegmentKey.SetModellingMatrix(matrixKit);
mySegmentKey.GetModellingMatrixControl().Concatenate(matrixKit);
mySegmentKey.ShowModellingMatrix(out matrixKit);
mySegmentKey.GetModellingMatrixControl().Rotate(10, 50, 90);
mySegmentKey.GetModellingMatrixControl().SetElement(1, 3, -5);
mySegmentKey.UnsetModellingMatrix();
$0302_a
mySegment.GetCameraControl().SetUpVector(new HPS.Vector(0, 1, 0)).SetPosition(new HPS.Point(0, -10, 0))
.SetTarget(new HPS.Point(0, 0, 0)).SetField(4, 4)
.SetProjection(HPS.Camera.Projection.Perspective);
cameraKit.SetPosition(
new HPS.Point(0, -10, 0));
cameraKit.SetField(4, 4);
cameraKit.SetProjection(HPS.Camera.Projection.Perspective);
mySegmentKey.SetCamera(cameraKit);
$camera_components_a
mySegmentKey.ShowCamera(out cameraKit);
cameraKit.ShowPosition(out position);
mySegmentKey.GetCameraControl().ShowPosition(out position);
$set_field
mySegmentKey.GetCameraControl().SetField(5, 5);
$set_near_limit
mySegmentKey.GetCameraControl().SetNearLimit(0.1f);
$aspect_ratio
sawok.SetMobility(HPS.Window.Mobility.FixedRatio);
$zoom_dolly
mySegmentKey.GetCameraControl().Zoom(2.0f);
mySegmentKey.GetCameraControl().Dolly(0.5f, 0.25f, 0);
$orbit
mySegmentKey.GetCameraControl().Orbit(90.0f, 0);
$pan
mySegmentKey.GetCameraControl().Pan(0, 90.0f);
$roll
mySegmentKey.GetCameraControl().Roll(180.0f);
$transformMasks
axisSegment.GetTransformMaskControl().SetCameraScale(true).SetCameraTranslation(true);
$set_orthgraphic
mySegmentKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Orthographic, 15, 15);
$oblique_perspective
mySegmentKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Perspective, 21.8f, -21.8f);
$stretched_projection
cameraKit.SetProjection(HPS.Camera.Projection.Stretched);
mySegmentKey.SetCamera(cameraKit);
$border
borderKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Stretched);
borderKey.InsertLine(pointArray);
borderKey.GetLineAttributeControl().SetWeight(6.0f);
$030206_a
mySegmentKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Perspective, 21.8f, -21.8f);
$030206_b
cameraKit.SetProjection(HPS.Camera.Projection.Stretched);
mySegmentKey.SetCamera(cameraKit);
$030206_c
borderKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Stretched);
borderKey.InsertLine(pointArray);
borderKey.GetLineAttributeControl().SetWeight(6.0f);
$0303_a
subwindowKit.SetSubwindow(
new HPS.Rectangle(0.4f, 0.95f, -0.5f, 0), HPS.Subwindow.Type.Standard);
HPS.SegmentKey anotherSegmentKey = mySegmentKey.Down(
"subwindow",
true);
anotherSegmentKey.SetSubwindow(subwindowKit);
$0303_b
subwindowKit.SetSubwindow(
new HPS.Rectangle(0.4f, 0.95f, -0.5f, 0), HPS.Subwindow.Type.Lightweight);
$0303_c
subwindowKit.SetSubwindow(
new HPS.Rectangle(-1, 0, -1, 1), HPS.Subwindow.Type.Standard);
leftSubwindowSeg.SetSubwindow(subwindowKit);
subwindowKit.SetSubwindow(
new HPS.Rectangle(0, 1, -1, 1), HPS.Subwindow.Type.Standard);
rightSubwindowSeg.SetSubwindow(subwindowKit);
$0303_d
subwindowKit.SetBorder(HPS.Subwindow.Border.InsetBold);
subwindowKit.SetBackground(HPS.Subwindow.Background.Transparent);
$0303_e
mySegmentKey.SetPriority(5);
$create_core_step1
HPS.Canvas canvas = HPS.Factory.CreateCanvas(windowKey);
HPS.View view1 = HPS.Factory.CreateView();
HPS.View view2 = HPS.Factory.CreateView();
$create_core_step2
canvas.AttachLayout(layout);
view1.AttachModel(model);
view2.AttachModel(model);
$create_core_step3
HPS.ShellKey shellKey = modelSegmentKey.InsertShell(myShellKit);
$create_core_step4
viewSegmentKey.GetVisibilityControl().SetText(false);
viewSegmentKey.SetCamera(cameraKit);
modelSegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0.81f, 0.72f, 0.08f));
modelSegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(0, 0, 0));
modelSegmentKey.GetVisibilityControl().SetEdges(true);
$using_canvas
canvas.AttachViewAsLayout(view);
$fixed_framerate
canvas.SetFrameRate(20.0f);
windowKey.GetCullingControl().SetDeferralExtent(100);
windowKey.GetCullingControl().SetExtent(10);
$using_layout
$using_view
view.SetRenderingMode(HPS.Rendering.Mode.Wireframe);
view.SetRenderingMode(HPS.Rendering.Mode.Phong);
view.SetRenderingMode(HPS.Rendering.Mode.HiddenLine);
$fit_world
$axis_navcube
myView.GetAxisTriadControl().SetVisibility(true).SetLocation(HPS.AxisTriadControl.Location.BottomRight);
myView.GetNavigationCubeControl().SetVisibility(true).SetLocation(HPS.NavigationCubeControl.Location.BottomLeft);
$nav_aid_set_location
myView.GetNavigationCubeControl()
.SetLocation(HPS.NavigationCubeControl.Location.Custom,
new HPS.Rectangle(-0.5f, 0.5f, -0.5f, 0.5f));
$complex_clip_regions
new HPS.Point(1, 0, 0),
new HPS.Point(0, 1, 0) };
new HPS.Point(-0.75f, 0.25f, 0),
new HPS.Point(0.25f, -0.75f, 0) };
mySegmentKey.GetDrawingAttributeControl().SetClipRegion(loops, HPS.Drawing.ClipSpace.World, HPS.Drawing.ClipOperation.Remove);
$clip_regions
mySegmentKey.InsertSphere(
new HPS.Point(0, 0, 0), 2.0f);
mySegmentKey.GetVisibilityControl().SetEdges(true);
mySegmentKey.GetDrawingAttributeControl().SetClipRegion(
pointArray, HPS.Drawing.ClipSpace.World, HPS.Drawing.ClipOperation.Keep);
$portfolios_introduction
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
$example_definitions
myPortfolio.DefineLinePattern("dashedLine", myLinePatternKit);
myPortfolio.DefineShader("superShader", myShaderKit);
myPortfolio.DefineNamedStyle("custom style", HPS.Database.CreateRootSegment());
myPortfolio.UndefineTexture("roughTexture");
$import_all
myPortfolio.ImportPortfolio(otherPortfolio);
myPortfolio.ImportAllTextures(otherPortfolio);
myPortfolio.ImportGlyph(someGlyph);
$import_all_replace
myPortfolio.ImportAllTextures(otherPortfolio, true);
myPortfolio.ImportAllTextures(otherPortfolio, false);
$style_segment
styleSegment.GetVisibilityControl().SetFaces(false).SetEdges(true);
styleSegment.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(0, 1, 0));
anotherSegment.GetStyleControl().PushSegment(styleSegment);
$unset_style
mySegmentKey.GetStyleControl().Pop();
mySegmentKey.GetStyleControl().SetNamed("newStyle");
mySegmentKey.GetStyleControl().UnsetEverything();
$create_named_style
HPS.NamedStyleDefinition wire_style = myPortfolio.DefineNamedStyle(
"green wireframe", HPS.Database.CreateRootSegment());
wire_style.GetSource().GetVisibilityControl().SetFaces(false).SetEdges(true);
wire_style.GetSource().GetMaterialMappingControl().SetEdgeColor(
new HPS.RGBAColor(0.0f, 1.0f, 0.0f));
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
mySegmentKey.GetStyleControl().PushNamed("green wireframe");
$simple_condition
mySegmentKey.GetStyleControl().SetNamed("glossy red", condition1);
mySegmentKey.SetCondition("c1");
$multiple_conditions
String[] conditionArray = new String[2];
conditionArray[0] = "c1";
conditionArray[1] = "c3";
mySegmentKey.SetConditions(conditionArray);
$complex_condition
mySegmentKey.GetStyleControl().SetNamed("myStyle", complexAND);
$push_style
mySegmentKey.GetStyleControl().PushNamed("myStyle");
$edit_stack
String[] styleNames = new String[3];
mySegmentKey.GetStyleControl().ShowAllNamed(out styleNames, out conditions);
String[] newStyleNames = new String[2];
newStyleNames[0] = styleNames[0];
newStyleNames[1] = styleNames[2];
styleTypesArray[0] = HPS.Style.Type.Named;
styleTypesArray[1] = HPS.Style.Type.Named;
mySegmentKey.GetStyleControl().Set(styleTypesArray, segmentKeyArray, newStyleNames, conditions);
$define_image
try
{
iok.SetFormat(HPS.Image.Format.Jpeg);
HPS.ImageKit imageKit = HPS.Image.File.Import(filename, iok);
ImageDefinition imageDefinition = myPortfolio.DefineImage("my_image", imageKit);
}
catch (HPS.IOException ioe)
{
String problem = ioe.what();
}
$manual_define_image
imageKit.SetData(image_data);
imageKit.SetSize(512, 512);
imageKit.SetFormat(HPS.Image.Format.RGB);
$basic_glyph_usage
HPS.GlyphKit myGlyphKit = HPS.GlyphKit.GetDefault(HPS.Glyph.Default.CircleWithCircle);
myPortfolio.DefineGlyph("circle in a circle", myGlyphKit);
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
mySegmentKey.GetMarkerAttributeControl().SetSymbol("circle in a circle");
mySegmentKey.InsertMarker(
new HPS.Point(0, 0, 0));
$defining_glyphs_step1
$defining_glyphs_step2
$defining_glyphs_step3
lineGlyphElement.SetPoints(glyphPoints);
$defining_glyphs_step4
glyphKit.SetElements(gea);
$defining_glyphs_step5
myPortfolio.DefineGlyph("myCustomGlyph", glyphKit);
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
$defining_glyphs_step6
mySegmentKey.GetMarkerAttributeControl().SetSymbol("myCustomGlyph");
mySegmentKey.InsertMarker(
new HPS.Point(0, 0, 0));
$basic_example
HPS.LinePatternKit myLinePatternKit = HPS.LinePatternKit.GetDefault(HPS.LinePattern.Default.Dashed);
myPortfolio.DefineLinePattern("my_new_pattern", myLinePatternKit);
mySegmentKey.GetLineAttributeControl().SetPattern("my_new_pattern");
$line_patterns_step1
slpe_orange.SetSize(50, HPS.LinePattern.SizeUnits.Pixels);
blpe.SetSize(20, HPS.LinePattern.SizeUnits.Pixels);
$line_patterns_step2
lpea_dashed[0] = slpe_orange;
lpea_dashed[1] = blpe;
lpea_solid[0] = slpe_blue;
$line_patterns_step3
lppka[0].SetBody(lpea_dashed).SetOffset(4, HPS.LinePattern.SizeUnits.Pixels).SetWeight(2, HPS.LinePattern.SizeUnits.Pixels);
lppka[1].SetBody(lpea_solid);
$line_patterns_step4
$line_patterns_step5
myPortfolio.DefineLinePattern("myLinePattern", lpk);
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
$line_patterns_step6
mySegmentKey.GetLineAttributeControl().SetPattern("myLinePattern");
mySegmentKey.InsertLine(
new HPS.Point(-10, 0, 0),
new HPS.Point(10, 0, 0));
$glyph_line_pattern
glpe.SetSource("myGlyph");
glpe.SetInsetBehavior(HPS.LinePattern.InsetBehavior.Inline);
lpea[0] = anotherElement;
lpea[1] = glpe;
lpea[2] = anotherElement;
$040203_a
float[] materialIndices = new float[] { 0, 0.25f, 0.5f, 0.75f, 1 };
shellKit.SetFaceIndexColorsByList(faceIndices, materialIndices);
$040204_a
materialKitArray[1].SetDiffuseTexture("my_texture");
$040301_a
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0.75f, 0.4f, 0.24f, 0.5f));
mySegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(0, 0, 1));
$040303_a
ulong[] vertexIndices = new ulong[4];
vertexIndices[0] = 0;
vertexIndices[1] = 1;
vertexIndices[2] = 2;
vertexIndices[3] = 3;
shellKey.SetVertexRGBColorsByList(vertexIndices, colorArray);
$040304_a
mySegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(1, 1, 1));
$0404_a
mySegmentKey.GetMaterialMappingControl().SetEdgeColor(new HPS.RGBAColor(1, 1, 1));
$show_snapshot
myWindowKey.ShowSnapshot(out myImageKit);
myImageKit.Convert(myImageKit, HPS.Image.Format.Png);
Byte[] imageData;
myImageKit.ShowData(out imageData);
$create_material_kit
materialKit.SetDiffuse(
new HPS.RGBAColor(0.5f, 0.7f, 0.3f, 0.2f));
materialKit.SetDiffuseTexture("myDefinedTexture");
materialKit.SetGloss(15.0f);
$material_kit_array
materialKitArray[1].SetDiffuse(
new HPS.RGBAColor(1, 0, 0, 0.5f));
materialKitArray[1].SetGloss(0.5f);
$material_palette_definition
myPortfolio.DefineMaterialPalette("myPalette", materialKitArray);
mySegmentKey.SetMaterialPalette("myPalette");
$using_material_mapping_control
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1.0f, 0, 0, 0.5f));
mySegmentKey.GetMaterialMappingControl().SetFaceGloss(12.4f);
$using_material_palettes
myPortfolio.DefineMaterialPalette("myPalette", materialKitArray);
mySegmentKey.GetPortfolioControl().Set(myPortfolio);
mySegmentKey.GetMaterialMappingControl().SetFaceMaterialByIndex(0);
$diffuse_color
mySegmentKey.GetMaterialMappingControl().SetFaceColor
(new RGBAColor(0.0f, 0.0f, 1.0f), HPS.Material.Color.Channel.DiffuseColor);
$specular
myMaterialKit.SetSpecular(
new HPS.RGBAColor(1, 0.8f, 0.9f, 0.5f));
$gloss
myMaterialKit.SetGloss(15.0f);
$emission
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1, 0, 0.5f),
HPS.Material.Color.Channel.Emission);
mySegmentKey.InsertDistantLight(
new HPS.Vector(x, y, z));
$environment
textureOptionsKit.
SetParameterizationSource(HPS.Material.Texture.Parameterization.ReflectionVector);
mySegmentKey.GetMaterialMappingControl()
.SetFaceTexture("my_texture", HPS.Material.Texture.Channel.EnvironmentTexture);
$basic_transparency
segmentKey1.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0.24f, 0.48f, 0.56f));
segmentKey2.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(1.0f, 0.0f, 0.0f, 0.5f));
$set_alpha
myMaterialMappingKit.SetFaceAlpha(0.5f);
myMaterialMappingKit.SetEdgeAlpha(0.75f);
myMaterialMappingKit.SetVertexAlpha(0.25f);
$depth_peeling
mySegmentKey.GetTransparencyControl().SetAlgorithm(HPS.Transparency.Algorithm.DepthPeeling);
mySegmentKey.GetTransparencyControl().SetDepthPeelingLayers(3);
$transparency_method
windowKey.GetTransparencyControl().SetMethod(HPS.Transparency.Method.ScreenDoor);
windowKey.GetTransparencyControl().SetMethod(HPS.Transparency.Method.Blended);
windowKey.GetTransparencyControl().SetMethod(HPS.Transparency.Method.None);
$texture_step1
try
{
iok.SetFormat(HPS.Image.Format.Png);
imageKit = HPS.Image.File.Import(filename, iok);
}
catch (HPS.IOException ioe)
{
String problem = ioe.what();
return Test.Result.Failure;
}
$texture_step1b
imageKit.SetData(imageData);
imageKit.SetSize(256, 256);
imageKit.SetFormat(HPS.Image.Format.RGB);
$texture_step2
$texture_step3
textureOptionsKit.SetParameterizationSource(HPS.Material.Texture.Parameterization.UV);
portfolioKey.DefineTexture("my_texture", imageDefinition, textureOptionsKit);
$texture_step4
mySegmentKey.GetPortfolioControl().Push(portfolioKey);
$texture_step5
ulong[] vertices_map = new ulong[4];
vertices_map[0] = 0;
vertices_map[1] = 1;
vertices_map[2] = 2;
vertices_map[3] = 3;
float[] vparams = new float[8];
vparams[0] = 0; vparams[1] = 0;
vparams[2] = 1; vparams[3] = 0;
vparams[4] = 1; vparams[5] = 1;
vparams[6] = 0; vparams[7] = 1;
shellKit.SetPoints(pointArray);
shellKit.SetFacelist(faceList);
shellKit.SetVertexParametersByList(vertices_map, vparams, 2);
$texture_step6
mySegmentKey.InsertShell(shellKit);
mySegmentKey.GetMaterialMappingControl().SetFaceTexture("my_texture");
$direct_bump
mySegmentKey.GetMaterialMappingControl().SetFaceTexture("my_texture", HPS.Material.Texture.Channel.DiffuseTexture);
mySegmentKey.GetMaterialMappingControl().SetFaceTexture("my_bump_map", HPS.Material.Texture.Channel.Bump);
mySegmentKey.InsertDistantLight(
new HPS.Vector(0, 1, 0));
$mka_bump
materialKit[1].SetDiffuseTexture("my_texture");
materialKit[1].SetBump("my_bump_map");
$decal
textureOptionsKit.SetDecal(true);
$shaders_step1
String shader_source =
"void custom_shader(const HGlobals globals, inout HColor color) { \n" +
"color.diffuse.rgb = globals.tex.coords.rgb;}\n" +
"#define H3D_COLOR_SHADER custom_shader\n";
$shaders_step2
shaderKit.SetSource(shader_source);
portfolioKey.DefineShader("myShader", shaderKit);
mySegmentKey.GetPortfolioControl().Push(portfolioKey);
$shaders_step3
mySegmentKey.GetMaterialMappingControl().SetFaceShader("myShader");
$mka_segment
for (int i = 0; i < myMaterialKitArray.Length; i++)
myMaterialKitArray[i] = new MaterialKit();
("my_palette", myMaterialKitArray);
mySegmentKey.GetPortfolioControl().Push(myPortfolio);
mySegmentKey.GetMaterialMappingControl().SetFaceMaterialByIndex(1);
$direct_segment
mySegmentKey.GetMaterialMappingControl().SetFaceColor
(new HPS.RGBAColor(0.75f, 0.4f, 0.24f, 0.5f));
mySegmentKey.GetMaterialMappingControl().SetEdgeColor
(new HPS.RGBAColor(0, 0, 1));
$material_mapping
myShellKit.SetMaterialMapping(myMaterialMappingKit);
$subentity_materials
ulong[] faceIndices = new ulong[3];
faceIndices[0] = 0;
faceIndices[1] = 1;
faceIndices[2] = 2;
float[] materialIndices = new float[3];
materialIndices[0] = 0;
materialIndices[1] = 1;
materialIndices[2] = 2;
myShellKit.SetFaceIndexColorsByList(faceIndices, materialIndices);
$040302_a
shellKey.SetFaceRGBColorsByRange(3, 1,
new HPS.RGBColor(1, 0.5f, 0));
$040302_b
ulong[] faceIndices = new ulong[2];
faceIndices[0] = 3;
faceIndices[1] = 0;
shellKey.SetFaceRGBColorsByList(faceIndices, colorArray);
$040302_c
shellKey.SetFaceRGBColorsByRange(0, 3,
new HPS.RGBColor(1, 0.5f, 0));
$040303_a
ulong[] vertexIndices = new ulong[4];
vertexIndices[0] = 0;
vertexIndices[1] = 1;
vertexIndices[2] = 2;
vertexIndices[3] = 3;
shellKey.SetVertexRGBColorsByList(vertexIndices, colorArray);
$040204_a
materialKitArray[1].SetDiffuseTexture("my_texture");
$040203_a
float[] materialIndices = new float[] { 0, 0.25f, 0.5f, 0.75f, 1 };
shellKit.SetFaceIndexColorsByList(faceIndices, materialIndices);
$selection_algorithm
myWindowKey.GetSelectionOptionsControl().SetAlgorithm(HPS.Selection.Algorithm.Visual);
myWindowKey.GetSelectionOptionsControl().SetAlgorithm(HPS.Selection.Algorithm.Analytic);
$proximity
options.SetProximity(0.05f);
$granularity
myWindowKey.GetSelectionOptionsControl().SetGranularity(HPS.Selection.Granularity.General);
myWindowKey.GetSelectionOptionsControl().SetGranularity(HPS.Selection.Granularity.Detailed);
$selection_by_point_example
myWindowKey.GetSelectionOptionsControl().SetLevel(HPS.Selection.Level.Entity);
myWindowKey.GetSelectionOptionsControl().SetProximity(0.01f);
myWindowKey.GetSelectionOptionsControl().SetAlgorithm(HPS.Selection.Algorithm.Analytic);
ulong numSelectedItems = myWindowKey.GetSelectionControl().SelectByPoint(
selectionPoint,
out selectionResults);
$selection_by_ray_example
myWindowKey.GetSelectionOptionsControl().SetLevel(HPS.Selection.Level.Entity);
myWindowKey.GetSelectionOptionsControl().SetProximity(0.01f);
myWindowKey.GetSelectionOptionsControl().SetAlgorithm(HPS.Selection.Algorithm.Analytic);
myKeyPath.ConvertCoordinate(HPS.Coordinate.Space.Pixel, pickStart, HPS.Coordinate.Space.World, out rayStart);
myKeyPath.ConvertCoordinate(HPS.Coordinate.Space.Pixel, pickEnd, HPS.Coordinate.Space.World, out rayEnd);
ulong numSelectedItems = myWindowKey.GetSelectionControl().SelectByRay(
rayStart,
rayDir,
out selectionResults);
$selection_results
while (srIterator.IsValid())
{
selectionItem.ShowSelectedItem(out key);
if (key.Type() == HPS.Type.ShellKey)
{
}
srIterator.Next();
}
$selection_by_shell_example
selectionOptions.SetAlgorithm(HPS.Selection.Algorithm.Analytic);
selectionOptions.SetLevel(HPS.Selection.Level.Entity);
selectionOptions.SetScope(myWindowKey);
ulong numSelectedItems = HPS.Database.SelectByShell(myShellKit, selectionOptions, out selectionResults);
while (srIterator.IsValid())
{
selectionItem.ShowSelectedItem(out key);
if (key.Type() == HPS.Type.ShellKey)
{
}
srIterator.Next();
}
$selection_by_volume_example
ulong numSelectedItems = myWindowKey.GetSelectionControl()
.SelectByVolume(boundingCuboid, out selectionResults);
$selection_by_area_example
selectionOptions.SetAlgorithm(HPS.Selection.Algorithm.Analytic);
selectionOptions.SetLevel(HPS.Selection.Level.Entity);
ulong numSelectedItems = myWindowKey.GetSelectionControl().SelectByArea(new HPS.Rectangle(-1, 1, -1, 1), selectionOptions, out selectionResults);
while (srIterator.IsValid())
{
selectionItem.ShowSelectedItem(out key);
if (key.Type() == HPS.Type.ShellKey)
{
}
srIterator.Next();
}
$limiting_enhancing
myWindowKey.GetSelectabilityControl().SetEdges(HPS.Selectability.Value.On).SetMarkers(HPS.Selectability.Value.Off);
myWindowKey.GetSelectabilityControl().SetFaces(HPS.Selectability.Value.ForcedOn);
myWindowKey.GetSelectionOptionsControl().SetInternalLimit(10);
myWindowKey.GetSelectionOptionsControl().SetRelatedLimit(2);
$highlighting
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new HPS.RGBAColor(0.89f, 0.62f, 0.11f));
hok.SetStyleName("myHighlightStyle");
myWindowKey.GetPortfolioControl().Push(myPortfolio);
myWindowKey.GetHighlightControl().Highlight(keyPath, hok);
$overlays
mySegmentKey.GetDrawingAttributeControl().SetOverlay(HPS.Drawing.Overlay.Default);
mySegmentKey.GetDrawingAttributeControl().SetOverlay(HPS.Drawing.Overlay.WithZValues);
mySegmentKey.GetDrawingAttributeControl().SetOverlay(HPS.Drawing.Overlay.InPlace);
$activate_operator_1
HPS.View myView = HPS.Factory.CreateView();
myView.GetOperatorControl().Push(orbitOperator);
$activate_operator_2
=
new HPS.OrbitOperator(HPS.MouseButtons.ButtonRight(), HPS.ModifierKeys.KeyControl());
$activate_operator_with_priority
myView.GetOperatorControl().Push(walkOperator, Operator.Priority.Default);
$change_priority
myView.GetOperatorControl().Set(walkOperator, Operator.Priority.High);
$detach_view
orbitOperator.DetachView();
$combining_operators
myView.GetOperatorControl().Push(new HPS.ZoomOperator(HPS.MouseButtons.ButtonMiddle()))
.Push(new HPS.OrbitOperator(HPS.MouseButtons.ButtonLeft()));
$handles_operator
myView.GetOperatorControl().Push(new HPS.HandlesOperator(HPS.MouseButtons.ButtonLeft()));
$MyCustomOperator_step1
class MyCustomOperator : HPS.Operator
{
public override bool OnMouseDown(HPS.MouseState in_state)
{
return true;
}
}
$MyCustomOperator_step2
public override bool OnTouchDown(HPS.TouchState in_state)
{
ulong numTouches = in_state.GetTouchCount();
HPS.Touch[] touchArray = in_state.GetTouches();
return true;
}
$0202_b
if (in_state.GetButtons().Left())
{
if (in_state.GetModifierKeys().Control())
{
}
}
$select_operator
myView.GetOperatorControl().Push(selectOperator);
sok.SetInternalLimit(3);
sok.SetLevel(HPS.Selection.Level.Entity);
sok.SetProximity(2.0f);
selectOperator.SetSelectionOptions(sok);
$highlight_operator
myView.GetOperatorControl().Push(highlightOperator);
highlightOperator.SetHighlightOptions(hok);
$selection_culling
sok.SetExtentCullingRespected(true);
sok.SetVectorCullingRespected(false);
$subentity_selection
while (srIterator.IsValid())
{
selectionItem.ShowSelectedItem(out key);
ulong [] out_faces, out_vertices, edges1, edges2;
selectionItem.ShowFaces(out out_faces);
selectionItem.ShowVertices(out out_vertices);
selectionItem.ShowEdges(out edges1, out edges2);
srIterator.Next();
}
$window_update
$window_update_progress
myWindowKey.Update();
if (status == HPS.Window.UpdateStatus.InProgress)
{
}
if (status == HPS.Window.UpdateStatus.Completed)
{
}
$window_update_type
myWindowKey.Update();
myWindowKey.Update(HPS.Window.UpdateType.Complete);
$fixed_framerate
myWindowKey.Update(HPS.Window.UpdateType.Default, 0.75);
$offscreen_window
oswok.SetDriver(HPS.Window.Driver.OpenGL2);
offscreenWindowKey.IncludeSegment(mySegmentKey);
$notifier_offscreen
$get_image_data
oswoc.ShowImage(HPS.Image.Format.RGB, out imageKit);
Byte[] imageData;
imageKit.ShowData(out imageData);
$offscreen_window_opacity
oswok.SetOpacity(0.0f);
oswok.SetOpacity(0.5f);
oswok.SetOpacity(1.0f);
$modify_offscreen_image_data
oswoc.ShowImage(HPS.Image.Format.RGB, out imageKit);
Byte[] imageData;
imageKit.ShowData(out imageData);
imageKit.SetData(imageData);
$set_display_lists
mySegmentKey.GetPerformanceControl().SetDisplayLists(HPS.Performance.DisplayLists.Segment);
mySegmentKey.GetPerformanceControl().SetDisplayLists(HPS.Performance.DisplayLists.Geometry);
$set_static_model
mySegmentKey.GetPerformanceControl().SetStaticModel(HPS.Performance.StaticModel.Attribute);
mySegmentKey.GetPerformanceControl().SetStaticModel(HPS.Performance.StaticModel.AttributeSpatial);
mySegmentKey.GetPerformanceControl().SetStaticModel(HPS.Performance.StaticModel.None);
$culling_optimizations01_a
mySegmentKey.GetCullingControl().SetBackFace(true);
mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS.Drawing.Handedness.Left);
mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS.Drawing.Handedness.Right);
mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS.Drawing.Handedness.None);
$distance_culling_search
SelectionOptionsKit selection_options = SelectionOptionsKit.GetDefault();
selection_options.SetDistanceCullingRespected(false);
$distance_culling_set_distance
myWindow.GetCullingControl().SetDistance(((float)8.2));
$volume_culling
volume.min = new Point(-1000, -1000, -1000);
volume.max = new Point(1000, 1000, 1000);
cullControl.SetVolume(volume);
$volume_culling_full_source
HPS.Canvas canvas = Factory.CreateCanvas(myWindowKey);
HPS.Model myModel = HPS.Factory.CreateModel();
HPS.View myView = HPS.Factory.CreateView();
canvas.AttachViewAsLayout(myView);
myView.AttachModel(myModel);
in_options.SetSegment(mySegKey);
mySegKey.Flush();
try
{
notifier = HPS.Stream.File.Import(path_to_model_file, in_options);
notifier.Wait();
}
catch (HPS.IOException e)
{
}
myView.FitWorld();
myView.Update();
volume.min = new Point(-1000, -1000, -1000);
volume.max = new Point(1000, 1000, 1000);
cullControl.SetVolume(volume);
myView.FitWorld();
$culling_optimizations01_b
mySegmentKey.GetDrawingAttributeControl().SetPolygonHandedness(HPS.Drawing.Handedness.Left);
mySegmentKey.GetCameraControl().SetPosition(new Point(0, 0, 5));
pointArray[0] =
new HPS.Point(-1.0f, -1.0f, 0);
pointArray[1] =
new HPS.Point(-1.0f, 1.0f, 0);
pointArray[2] =
new HPS.Point(1.0f, 1.0f, 0);
pointArray[3] =
new HPS.Point(1.0f, -1.0f, 0);
int[] faceList = new int[5];
faceList[0] = 4;
faceList[1] = 0;
faceList[2] = 1;
faceList[3] = 2;
faceList[4] = 3;
faceList[0] = 4;
faceList[1] = 0;
faceList[2] = 3;
faceList[3] = 2;
faceList[4] = 1;
mySegmentKey.InsertShell(pointArray, faceList);
$frustum_culling
mySegmentKey.GetCullingControl().SetFrustum(true);
mySegmentKey.GetCullingControl().SetFrustum(false);
$hardcopy
try
{
float width, height;
myWindowKey.GetWindowInfoControl().ShowPhysicalSize(out width, out height);
exportOptionsKit.SetWYSIWYG(true);
exportOptionsKit.SetSize(width, height, HPS.Hardcopy.SizeUnits.Centimeters);
exportOptionsKit.SetResolution(100, HPS.Hardcopy.ResolutionUnits.DPCM);
HPS.IOResult PDFResult =
HPS.Hardcopy.File.Export("output.pdf", HPS.Hardcopy.File.Driver.PDF, myWindowKey, exportOptionsKit);
HPS.IOResult postScriptResult =
HPS.Hardcopy.File.Export("output.ps", HPS.Hardcopy.File.Driver.Postscript, myWindowKey, exportOptionsKit);
}
catch (HPS.IOException)
{
}
$window_update_notifier
$update_options_kit
uok.SetUpdateType(HPS.Window.UpdateType.Refresh);
uok.SetTimeLimit(0.5f);
myWindowKey.SetUpdateOptions(uok);
$culling_extents
mySegmentKey.GetCullingControl().SetExtent(10);
mySegmentKey.GetCullingControl().SetDeferralExtent(100);
$set_soft_memory_limit
ulong memoryLimit = 132581244 / 2;
HPS.Database.SetSoftMemoryLimit(memoryLimit);
$MyEmergencyHandler
class MyEmergencyHandler : HPS.EmergencyHandler
{
public MyEmergencyHandler(){ notif = null;}
public override void Handle(string message, HPS.Emergency.Code code)
{
if (code == HPS.Emergency.Code.SoftMemoryLimit)
{
lock (lockObj)
{
if (notif != null)
notif.Cancel();
}
}
else if (code == HPS.Emergency.Code.HardMemoryLimit)
delete_reserve_buffer();
else if (code == HPS.Emergency.Code.Fatal)
abort();
}
public void SetNotifier(HPS.Stream.ImportNotifier in_notif)
{
lock (lockObj)
{
notif = in_notif;
}
}
private void abort() { }
private void delete_reserve_buffer() { }
private System.Object lockObj = new System.Object();
};
$set_emergency_handler
MyEmergencyHandler handler = new MyEmergencyHandler();
HPS.Database.SetEmergencyHandler(handler);
$img_def_target
$toggle_anti_alias
awok.SetAntiAliasCapable(true, 8);
awok.SetAntiAliasCapable(false);
mySegmentKey.GetVisualEffectsControl().SetAntiAliasing(true);
mySegmentKey.GetVisualEffectsControl().SetAntiAliasing(false);
$enable_simple_shadows
mySegmentKey.GetVisualEffectsControl().SetSimpleShadow(true);
mySegmentKey.GetVisualEffectsControl().SetSimpleShadowPlane(new HPS.Plane(0, 1, 0, 0.425f));
mySegmentKey.GetVisualEffectsControl().SetSimpleShadowColor(new HPS.RGBAColor(0.2f, 0.2f, 0.2f));
mySegmentKey.GetVisualEffectsControl().SetSimpleShadowLightDirection(new HPS.Vector(0, 1, 0));
$set_shadow_options
mySegmentKey.GetVisualEffectsControl().SetSimpleShadow(true,
256,
16,
false);
$enable_shadow_maps
mySegmentKey.GetVisualEffectsControl().SetShadowMaps(true,
16,
2048,
true,
true);
mySegmentKey.GetVisibilityControl().SetShadows(true);
$cast_emit_receive
mySegmentKey.GetVisibilityControl().SetShadowCasting(true);
mySegmentKey.GetVisibilityControl().SetShadowEmitting(true);
mySegmentKey.GetVisibilityControl().SetShadowReceiving(false);
$shadow_direction
mySegmentKey.GetVisualEffectsControl().SetSimpleShadowLightDirection(new Vector(1, 1, 1));
$set_simple_reflection
mySegmentKey.GetVisualEffectsControl().SetSimpleReflection(true, 0.5f, 1U, false, 0, 0.2f);
mySegmentKey.GetVisualEffectsControl().SetSimpleReflectionPlane(new HPS.Plane(0, 1, 0, 1));
$enable_bloom
ppek.SetBloom(true, 10.0f);
windowKey.SetPostProcessEffects(ppek);
ppek.SetBloom(false);
windowKey.SetPostProcessEffects(ppek);
$star_bloom
ppek.SetBloom(true, 10.0f, 5U, HPS.PostProcessEffects.Bloom.Shape.Star);
$algorithms
mySegmentKey.GetLightingAttributeControl().SetInterpolationAlgorithm(HPS.Lighting.InterpolationAlgorithm.Gouraud);
mySegmentKey.GetLightingAttributeControl().SetInterpolationAlgorithm(HPS.Lighting.InterpolationAlgorithm.Phong);
mySegmentKey.GetLightingAttributeControl().SetInterpolationAlgorithm(HPS.Lighting.InterpolationAlgorithm.Flat);
$hemispheric_ambient
mySegmentKey.GetMaterialMappingControl().SetAmbientLightUpColor(new HPS.RGBAColor(1, 0, 0));
mySegmentKey.GetMaterialMappingControl().SetAmbientLightDownColor(new HPS.RGBAColor(0, 0, 1));
$set_hsra
myWindowKey.GetSubwindowControl().SetRenderingAlgorithm(HPS.Subwindow.RenderingAlgorithm.HiddenLine);
$unset_hsra
myWindowKey.GetSubwindowControl().UnsetRenderingAlgorithm();
$priority
mySegmentKey.GetSubwindowControl().SetRenderingAlgorithm(HPS.Subwindow.RenderingAlgorithm.Priority);
s1.SetPriority(1);
s1.InsertCircle(
new HPS.Point(0, 0, 0), 0.25f,
new HPS.Vector(0, 0, 1));
s2.SetPriority(2);
s2.InsertShell(myShellKit);
$hidden_line
mySegmentKey.GetVisibilityControl().SetFaces(true).SetEdges(true).SetLines(true);
mySegmentKey.GetSubwindowControl().SetRenderingAlgorithm(HPS.Subwindow.RenderingAlgorithm.HiddenLine);
mySegmentKey.GetHiddenLineAttributeControl().SetVisibility(false);
$dim_factor
mySegmentKey.GetHiddenLineAttributeControl().SetDimFactor(0.75f);
mySegmentKey.GetHiddenLineAttributeControl().SetVisibility(true);
$special_segments
mySegmentKey.GetHiddenLineAttributeControl().SetRenderFaces(true);
mySegmentKey.GetHiddenLineAttributeControl().SetRenderText(true);
$depth_range
mySegmentKey.GetDrawingAttributeControl().SetDepthRange(0, 0);
$set_depth_of_field
ppek.SetDepthOfField(true, 5.0f, 5.0f, 30.0f);
myWindowKey.SetPostProcessEffects(ppek);
$enable_perimeter_edges
mySegmentKey.GetVisibilityControl().SetEdges(false);
mySegmentKey.GetVisibilityControl().SetPerimeterEdges(true);
mySegmentKey.GetVisibilityControl().SetPerimeterEdges(false);
$interior_silhouette_edges
mySegmentKey.GetVisibilityControl().SetInteriorSilhouetteEdges(true);
$perimeter_edge_options
myWindowKey.GetPostProcessEffectsControl().SetSilhouetteEdges(true, 10, true);
$hard_edges
mySegmentKey.GetVisibilityControl().SetHardEdges(true);
mySegmentKey.GetEdgeAttributeControl().SetHardAngle(135);
$smooth
mySegmentKey.GetColorInterpolationControl().SetFaceColor(true);
ulong[] vertexIndices = { 0, 1, 2, 3 };
RGBColor[] colorArray = {
new HPS.RGBColor(0.24f, 0.48f, 0.56f),
new HPS.RGBColor(0.67f, 0.07f, 0.64f),
new HPS.RGBColor(0, 0, 0)
};
myShellKey.SetVertexRGBColorsByList(vertexIndices, colorArray);
$hard
for (int i = 0; i < materialKitArray.Length; i++)
float[] materialIndices = new float[5];
materialIndices[0] = 0;
materialIndices[1] = 0.25f;
materialIndices[2] = 0.5f;
materialIndices[3] = 0.75f;
materialIndices[4] = 1;
myShellKit.SetFaceIndexColorsByList(faceIndices, materialIndices);
$contour_lines
mySegmentKey.GetContourLineControl().SetVisibility(true)
.SetPositions(1.0f, 0.5f).SetWeights(2.0f).SetColors(new RGBColor(1, 0, 0));
$enabling_ci
mySegmentKey.GetColorInterpolationControl().SetFaceColor(true);
mySegmentKey.GetColorInterpolationControl().SetFaceIndex(true);
mySegmentKey.GetColorInterpolationControl().SetEdgeColor(true);
mySegmentKey.GetColorInterpolationControl().SetEdgeIndex(true);
mySegmentKey.GetColorInterpolationControl().SetVertexColor(true);
mySegmentKey.GetColorInterpolationControl().SetVertexIndex(true);
$ambient_occlusion
myWindowKey.GetPostProcessEffectsControl().SetAmbientOcclusion(true, 2.0f,
HPS.PostProcessEffects.AmbientOcclusion.Quality.Nicest);
$eye_dome
windowKey.GetPostProcessEffectsControl().SetEyeDomeLighting(true, 60.0f, 1.2f);
$eye_dome_disable
mySegmentKey.GetVisualEffectsControl().SetPostProcessEffectsEnabled(false);
$read_hsf
try
{
importOptionsKit.SetSegment(mySegmentKey);
notifier = HPS.Stream.File.Import(filename, importOptionsKit);
float percent_complete;
notifier.Status(out percent_complete);
notifier.Wait();
}
catch (HPS.IOException ioe)
{
}
$notifier
HPS.IOResult ioResult = notifier.Status();
if (ioResult == HPS.IOResult.Success)
{
}
else
{
}
$results
importResultsKit.ShowDefaultCamera(out cameraKit);
importResultsKit.ShowSegment(out someSegment);
$notifier_cancel
notifier = HPS.Stream.File.Import(filename, importOptionsKit);
notifier.Cancel();
notifier.Wait();
if (notifier.Status() != HPS.IOResult.Canceled);
$stream_buffer_import
try
{
importOptionsKit.SetSegment(mySegmentKey);
notifier = HPS.Stream.File.Import(buffers, importOptionsKit);
notifier.Wait();
}
catch (HPS.IOException ioe)
{
throw;
}
$stream_buffer_export
byte[][] buffers;
try
{
exportNotifier.Wait();
}
catch (HPS.IOException ioe)
{
throw;
}
$exporting
try
{
exportOptionsKit.SetColorCompression(true, 16);
HPS.Stream.File.Export(filename, mySegmentKey, exportOptionsKit).Wait();
}
catch (HPS.IOException ioe)
{
}
$loading_images
try
{
iok.SetFormat(HPS.Image.Format.Jpeg);
imageKit = HPS.Image.File.Import(filename, iok);
}
catch (HPS.IOException ioe)
{
String problem = ioe.Message;
}
$save_image
HPS.Image.File.Export(filename, myImageKit);
$screenshot
export_options.SetFormat(HPS.Image.Format.Png);
export_options.SetSize(800, 450);
HPS.Image.File.Export(filename, myWindowKey, export_options);
$other_formats
stlOptionsKit.SetSegment(mySegmentKey);
stlNotifier.Wait();
objOptionsKit.SetSegment(mySegmentKey);
objNotifier.Wait();
$030102_a
try
{
notifier.Wait();
HPS.View myView = modelFile.ActivateDefaultCapture();
myCanvas.AttachViewAsLayout(myView);
model = modelFile.GetModel();
myView.AttachModel(model);
}
catch (HPS.IOException ioe)
{
}
$set_transform_component_path
SelectionOptionsKit selection_options = new SelectionOptionsKit();
if (myWindowKey.GetSelectionControl().SelectByPoint(new Point(0, 0, 0), selection_options, out results) > 0)
{
item.ShowPath(out path_to_selection);
HPS.Component transform_target = HPS.Factory.DeInstanceComponent(component_path);
transform.Translate(5, 0, 0);
transform_target.SetTransform(transform);
myCanvas.Update();
}
$set_transform_full_source
Canvas myCanvas = Factory.CreateCanvas(myWindowKey);
try
{
importOptionsKit.SetBRepMode(Exchange.BRepMode.BRepAndTessellation);
importNotifier = HPS.Exchange.File.Import(modelPath, importOptionsKit);
float percent_complete;
importNotifier.Status(out percent_complete);
importNotifier.Wait();
}
catch (HPS.IOException ioe)
{
throw;
}
Exchange.CADModel myCADModel = importNotifier.GetCADModel();
myCanvas.AttachViewAsLayout(myCADModel.ActivateDefaultCapture());
myCanvas.Update();
SelectionOptionsKit selection_options = new SelectionOptionsKit();
if (myWindowKey.GetSelectionControl().SelectByPoint(new Point(0, 0, 0), selection_options, out results) > 0)
{
item.ShowPath(out path_to_selection);
HPS.Component transform_target = HPS.Factory.DeInstanceComponent(component_path);
transform.Translate(5, 0, 0);
transform_target.SetTransform(transform);
myCanvas.Update();
}
$file_load_result
HPS.IOResult result = notifier.Status();
if (result == HPS.IOResult.Success)
{
}
notifier.Cancel();
$pmi
importOptions.SetPMI(false);
$configurations
for (int i = 0; i < configArray.Length; i++)
{
String configName = configArray[i].GetName();
importOptionsKit.SetConfiguration(configName);
}
$handling_views
HPS.Capture[] captureArray = modelFile.GetAllCaptures();
for (int i = 0; i < captureArray.Length; i++)
{
Capture capture = captureArray[i];
String viewName = metadata.GetValue();
if (viewName == "<some interesting view>")
{
capture.Activate();
break;
}
}
$handling_metadata
for (int i = 0; i < metadataArray.Length; i++)
{
if (metadata.Type() == HPS.Type.StringMetadata)
{
String metadataName = sm.GetName();
String someString = sm.GetValue();
}
else if (metadata.Type() == HPS.Type.DoubleMetadata)
{
String metadataName = dm.GetName();
double someDouble = dm.GetValue();
}
else if (metadata.Type() == HPS.Type.IntegerMetadata)
{
String metadataName = im.GetName();
int someInteger = im.GetValue();
}
else if (metadata.Type() == HPS.Type.UnsignedIntegerMetadata)
{
String metadataName = uim.GetName();
uint someUnsignedInt = uim.GetValue();
}
else if (metadata.Type() == HPS.Type.TimeMetadata)
{
String metadataName = tm.GetName();
uint someUnsignedInt = tm.GetValue();
String timeString = tm.GetValueAsString();
}
}
$activating_filters
CADModel cadModel = notifier.GetCADModel();
HPS.View myFirstView = cadModel.GetAllCaptures()[0].Activate();
filters[0].Activate(myFirstView);
$deactivating_filters
HPS.Filter[] filterArray = modelFile.GetActiveFilters(myFirstView);
for (int i = 0; i < filterArray.Length; i++)
{
filter.Deactivate(myFirstView);
}
$exchange_component_reload
$exchange_simple_export
try
{
}
catch (HPS.IOException ioe)
{
}
$exchange_data_mapping
if (component.GetComponentType() == HPS.Component.ComponentType.ExchangeProductOccurrence)
{
}
HPS.Key[] keys = component.GetKeys();
$simple_export
keyPathArray[0] = sprocketPath.GetKeyPath();
$declarations
$setup_view
cameraKit = HPS.CameraKit.GetDefault();
viewKit.SetCamera(cameraKit);
viewKit.SetExternalName("My custom view #1");
artworkKit.AddView(viewKit);
cameraKit.SetPosition(
new HPS.Point(1, 1, 1));
viewKit.SetCamera(cameraKit);
viewKit.SetExternalName("My custom view #2");
artworkKit.AddView(viewKit);
$annotation_kit
keyPathArray[0] = sprocketPath.GetKeyPath();
annotationKit.SetArtwork(artworkKit);
annotationKit.SetSource(keyPathArray);
annotationKit.SetPRCBRepCompression(HPS.Publish.PRC.BRepCompression.Medium);
annotationKit.SetPRCTessellationCompression(true);
documentKit.AddPage(pageKit);
$template_kit
templateKit.SetTemplateFile("<path to template file>");
templateKit.SetAnnotationByField("My3DWindow_1", annotationKit);
templateKit.SetTextValueByField("DocumentTitle_1", "BILL OF MATERIALS");
templateKit.SetTextValueByField("Part NameRow1_1", "Turbine engine");
templateKit.SetTextValueByField("SupplierRow1_1", "Tech Soft 3D");
documentKit.AddPage(templateKit);
$linkkit
myLinkKit.SetJavaScript("//activate page 2\n" +
"var a3d = this.getAnnots3D( 1 )[0];\n" +
"a3d.activated=true;\n" +
"c3d = a3d.context3D;\n" +
"c3d.runtime.setView(\"ALL\", true);\n");
myLinkKit.SetBorderWidth(1);
myLinkKit.SetHighlighting(HPS.Publish.Highlighting.Mode.Invert);
$component_mask
if (component.HasComponentType(HPS.Component.ComponentType.ExchangePMIMask))
{
}
if (component.HasComponentType(HPS.Component.ComponentType.ExchangeTopologyMask))
{
}
if (component.HasComponentType(HPS.Component.ComponentType.ExchangeRepresentationItemMask))
{
}
$create_document
$modify_document
ulong pageCount = myDocumentKey.GetPageCount();
myDocumentKey.AddAttachment(attachmentFilename, attachmentDescription);
myDocumentKey.SetPasswords(newUserPassword, newOwnerPassword);
$page_control
myPageControl.AddAnnotation(myAnnotationKit,
new HPS.IntRectangle(200, 300, 200, 500));
$export_document
HPS.Publish.File.ExportPDF(myDocumentKey, filename);
$skp_import
iok.SetTarget(myModel);
iok.SetView(myView);
notifier.Wait();
$parasolid_add_body
Exchange.ImportOptionsKit import_kit = Exchange.ImportOptionsKit.GetDefault();
import_kit.SetPMI(false);
Exchange.ImportNotifier notifier = Exchange.File.Import(my_cad_file, import_kit);
notifier.Wait();
Exchange.CADModel exchange_cad_model = new Exchange.CADModel(cad_model);
View view1 = cad_model.ActivateDefaultCapture();
PK.BODY_t solid_body = PK.ENTITY_t.@null;
PK.BODY.create_solid_block(0.05f, 0.05f, 0.05f, null, &solid_body);
PK.ATTDEF_t system_color;
PK.ERROR.code_t error = PK.ATTDEF.find("SDL/TYSA_COLOUR_2", &system_color);
PK.ATTRIB_t color_attribute;
error = PK.ATTRIB.create_empty(solid_body, system_color, &color_attribute);
double [] color = { 1, 0, 0 };
error = PK.ATTRIB.set_doubles(color_attribute, 0, 3, color);
MatrixKit translation = new MatrixKit();
translation.Translate(100.0f, 0.0f, 50.0f);
HPS.Parasolid.Component added_component = ExchangeParasolid.File.AddEntity(exchange_cad_model, solid_body, translation);
PK.ENTITY_t entity = added_component.GetParasolidEntity();
PK.CLASS_t entity_type;
PK.ENTITY.ask_class(entity, &entity_type);
$parasolid_import
iok.SetFormat(HPS.Parasolid.Format.Text);
notifier.Wait();
$parasolid_import_options
ftk.SetNormals(true);
ftk.SetFacetSize(1.0, 3.0, 10);
ltk.SetEdges(true, true);
ltk.SetIgnoreCriteria(false);
iok.SetCompoundBodyBehavior(HPS.Parasolid.CompoundBodyBehavior.Split);
iok.SetFacetTessellation(ftk);
iok.SetLineTessellation(ltk);
iok.SetFormat(HPS.Parasolid.Format.Text);
$import_default_options
try
{
ExchangeParasolid.ImportNotifier notifier = HPS.ExchangeParasolid.File.Import(
filename,
Exchange.ImportOptionsKit.GetDefault(),
Exchange.TranslationOptionsKit.GetDefault(),
Parasolid.FacetTessellationKit.GetDefault(),
Parasolid.LineTessellationKit.GetDefault());
notifier.Wait();
HPS.View myView = modelFile.ActivateDefaultCapture();
myCanvas.AttachViewAsLayout(myView);
myView.AttachModel(model);
}
catch (HPS.IOException)
{
}
$query_cad_model
if (!subcomponents.empty())
{
Component.ComponentType component_type = subcomponents[0].GetComponentType();
if (component_type == Component.ComponentType.ExchangeProductOccurrence)
{
Exchange.Component exchange_component = new Exchange.Component(subcomponents[0]);
IntPtr entity = exchange_component.GetExchangeEntity();
}
}
subcomponents = cad_model.GetAllSubcomponents(Component.ComponentType.ParasolidTopoFace);
if (!subcomponents.empty())
{
if (subcomponents[0].HasComponentType(Component.ComponentType.ParasolidComponentMask))
{
Parasolid.Component parasolid_component = new Parasolid.Component(subcomponents[0]);
PK.ENTITY_t entity = parasolid_component.GetParasolidEntity();
PK.SURF_t surface;
PK.FACE.ask_surf(entity, &surface);
}
}
$fillet_retessellate
Exchange.ImportOptionsKit exchange_import = Exchange.ImportOptionsKit.GetDefault();
exchange_import.SetBRepMode(Exchange.BRepMode.BRepAndTessellation);
Exchange.TranslationOptionsKit translation_options = Exchange.TranslationOptionsKit.GetDefault();
ExchangeParasolid.ImportNotifier notifier = ExchangeParasolid.File.Import(
filename, exchange_import, translation_options,
Parasolid.FacetTessellationKit.GetDefault(), Parasolid.LineTessellationKit.GetDefault());
notifier.Wait();
if (notifier.Status() != IOResult.Success)
{
}
View myView = notifier.GetCADModel().ActivateDefaultCapture();
myCanvas.AttachViewAsLayout(myView);
myView.AttachModel(model);
CADModel cad_model = notifier.GetCADModel();
HPS.Component[] edge_components = cad_model.GetAllSubcomponents(Component.ComponentType.ParasolidTopoEdge);
if (edge_components.empty())
{
}
Parasolid.Component para_edge_component = new Parasolid.Component(edge_components[0]);
PK.EDGE_t[] edge_entity = new PK.EDGE_t[1];
edge_entity[0] = para_edge_component.GetParasolidEntity();
while (owner.GetComponentType() != HPS.Component.ComponentType.ParasolidTopoBody)
owner = owner.GetOwners()[0];
int number_of_edges = 0;
PK.EDGE_t* edges = null;
PK.EDGE.set_blend_constant_o_t blend_options = new PK.EDGE.set_blend_constant_o_t(true);
PK.ERROR.code_t error = PK.EDGE.set_blend_constant(1, edge_entity, 0.005, &blend_options, &number_of_edges, &edges);
if (error != PK.ERROR.code_t.no_errors)
{
}
int number_of_blend_faces = 0;
PK.FACE_t* created_blend_faces = null;
PK.FACE.array_t* underlying_topology = null;
int* replaced_topologies = null;
PK.blend_fault_t status = PK.blend_fault_t.no_fault_c;
PK.EDGE_t faulty_edge = PK.EDGE_t.@null;
PK.ENTITY_t topology_associated_with_fault = PK.EDGE_t.@null;
PK.BODY.fix_blends_o_v fix_blend_options = new PK.BODY.fix_blends_o_v(true);
error = PK.BODY.fix_blends(para_component.GetParasolidEntity(), &fix_blend_options, &number_of_blend_faces, &created_blend_faces, &underlying_topology, &replaced_topologies, &status, &faulty_edge, &topology_associated_with_fault);
if (error != PK.ERROR.code_t.no_errors || (status != PK.blend_fault_t.no_fault_c && status != PK.blend_fault_t.repaired_c))
{
}
para_component.Tessellate(facet_tessellation, HPS.Parasolid.LineTessellationKit.GetDefault());
myCanvas.Update();
$00760_exchange_parasolid_boolean_operator_class
class TestBooleanOperator : HPS.Operator
{
private PK.BODY_t target;
private PK.BODY_t tool;
public TestBooleanOperator(ref Canvas in_canvas, ref CADModel in_cad_model)
{
canvas = in_canvas;
cad_model = in_cad_model;
target = PK.ENTITY_t.@null;
tool = PK.ENTITY_t.@null;
target_style_source = new SegmentKey();
target_highlight = new HighlightOptionsKit();
tool_style_source = new SegmentKey();
tool_highlight = new HighlightOptionsKit();
}
public override string GetName()
{
return "TestBooleanOperator";
}
public override bool OnMouseDown(HPS.MouseState in_state)
{
if (IsMouseTriggered(in_state))
{
click_location = in_state.GetLocation();
}
return false;
}
public override bool OnMouseUp(MouseState in_state)
{
if (!IsMouseTriggered(in_state) && in_state.GetLocation() == click_location)
{
ulong count = canvas.GetWindowKey().GetSelectionControl().SelectByPoint(click_location, selection_options, out results);
if (count == 0)
return false;
while (s_it.IsValid())
{
s_it.GetItem().ShowPath(out selected_path);
foreach (HPS.Component it in components)
{
if (it.GetComponentType() == HPS.Component.ComponentType.ParasolidTopoBody)
{
PK.ENTITY_t selected_parasolid_entity = para_component.GetParasolidEntity();
if (target == selected_parasolid_entity)
{
highlight_control.Unhighlight(selected_path, target_highlight);
canvas.Update();
target = PK.ENTITY_t.@null;
target_component.Reset();
target_path.Reset();
return true;
}
else if (tool == selected_parasolid_entity)
{
highlight_control.Unhighlight(selected_path, tool_highlight);
canvas.Update();
tool = PK.ENTITY_t.@null;
tool_component.Reset();
tool_path.Reset();
return true;
}
else if (target == PK.ENTITY_t.@null)
{
target = selected_parasolid_entity;
target_component = it;
target_path = selected_path;
highlight_control.Highlight(selected_path, target_highlight);
canvas.Update();
return true;
}
else
{
tool = selected_parasolid_entity;
tool_component = it;
tool_path = selected_path;
highlight_control.Highlight(selected_path, tool_highlight);
canvas.Update();
return true;
}
}
}
s_it.Next();
}
return true;
}
return false;
}
public override void OnViewAttached(HPS.View in_attached_view)
{
attached_view = GetAttachedView();
selection_options.SetAlgorithm(HPS.Selection.Algorithm.Visual)
.SetLevel(HPS.Selection.Level.Entity)
.SetScope(sprocket_path.GetKeyPath());
target_style_source = HPS.Database.CreateRootSegment();
highlight_material.SetDiffuse(color_1);
highlight_material.SetSpecular(color_2);
target_style_source.GetMaterialMappingControl()
.SetFaceMaterial(highlight_material)
.SetEdgeColor(color_3)
.SetTextColor(color_3)
.SetLineColor(color_3);
portfolio.DefineNamedStyle("BooleanOperator_TargetStyle", target_style_source);
target_highlight.SetOverlay(HPS.Drawing.Overlay.None).SetStyleName("BooleanOperator_TargetStyle");
tool_style_source = HPS.Database.CreateRootSegment();
highlight_material.SetDiffuse(color_4);
tool_style_source.GetMaterialMappingControl()
.SetFaceMaterial(highlight_material)
.SetEdgeColor(color_4)
.SetTextColor(color_4)
.SetLineColor(color_4);
portfolio.DefineNamedStyle("BooleanOperator_ToolStyle", tool_style_source);
tool_highlight.SetOverlay(HPS.Drawing.Overlay.None).SetStyleName("BooleanOperator_ToolStyle");
}
public override void OnViewDetached(HPS.View in_detached_view)
{
if (canvas.Type() != HPS.Type.None)
{
highlight_control.Unhighlight(target_highlight);
highlight_control.Unhighlight(tool_highlight);
portfolio_key.UndefineNamedStyle("BooleanOperator_TargetStyle");
portfolio_key.UndefineNamedStyle("BooleanOperator_ToolStyle");
target_style_source.Delete();
tool_style_source.Delete();
canvas.Update();
}
}
unsafe public bool ApplyBoolean()
{
canvas.GetWindowKey().GetHighlightControl().UnhighlightEverything();
MatrixKit target_matrix;
target_path.ShowNetModellingMatrix(out target_matrix);
MatrixKit tool_matrix;
tool_path.ShowNetModellingMatrix(out tool_matrix);
MatrixKit transform_matrix = target_matrix.Invert();
transform_matrix.MultiplyAndAssign(tool_matrix);
MatrixKit matrix = new MatrixKit();
if (transform_matrix != matrix)
{
double scale = 0.001;
float[] elements;
transform_matrix.ShowElements(out elements);
PK.TRANSF_sf_t transform_data;
transform_data.matrixI0J0 = elements[0]; transform_data.matrixI1J0 = elements[1]; transform_data.matrixI2J0 = elements[2]; transform_data.matrixI3J0 = elements[3];
transform_data.matrixI0J1 = elements[4]; transform_data.matrixI1J1 = elements[5]; transform_data.matrixI2J1 = elements[6]; transform_data.matrixI3J1 = elements[7];
transform_data.matrixI0J2 = elements[8]; transform_data.matrixI1J2 = elements[9]; transform_data.matrixI2J2 = elements[10]; transform_data.matrixI3J2 = elements[11];
transform_data.matrixI0J3 = elements[12] * scale; transform_data.matrixI1J3 = elements[13] * scale; transform_data.matrixI2J3 = elements[14] * scale; transform_data.matrixI3J3 = elements[15];
PK.TRANSF_t transform;
PK.TRANSF.create(&transform_data, &transform);
PK.BODY.transform_o_t transform_options = new PK.BODY.transform_o_t(true);
PK.TOPOL.track_r_t tracking_1;
PK.TOPOL.local_r_t results;
PK.ERROR.code_t error_1 = PK.BODY.transform_2(tool, transform, 0.001, &transform_options, &tracking_1, &results);
if (error_1 != PK.ERROR.code_t.no_errors)
return false;
else if (results.status != PK.local_status_t.ok_c && results.status != PK.local_status_t.nocheck_c)
return false;
}
bool target_faceted = IsEntityFaceted(target);
bool tool_faceted = IsEntityFaceted(tool);
PK.BODY_t facet_body = PK.ENTITY_t.@null;
PK.TOPOL.track_r_t tracking;
PK.ERROR.code_t error = PK.ERROR.code_t.no_errors;
if (tool_faceted != target_faceted)
{
PK.BODY_t classical_body = PK.ENTITY_t.@null;
if (!tool_faceted)
classical_body = tool;
else if (!target_faceted)
classical_body = target;
PK.BODY.make_facet_body_o_t make_facet_options = new PK.BODY.make_facet_body_o_t(true);
PK.TOPOL.track_r_t redundant_topol;
error = PK.BODY.make_facet_body(classical_body, PK.ENTITY_t.@null, &make_facet_options, &facet_body, &tracking, &redundant_topol);
if (error != PK.ERROR.code_t.no_errors)
return false;
}
PK.BODY.boolean_o_t boolean_options = new PK.BODY.boolean_o_t(true);
boolean_options.function = PK.boolean_function_t.subtract;
PK.boolean_r_t boolean_results;
PK.BODY_t tool_to_use = tool;
PK.BODY_t target_to_use = target;
if (facet_body != PK.ENTITY_t.@null && !tool_faceted)
tool_to_use = facet_body;
else if (facet_body != PK.ENTITY_t.@null && !target_faceted)
target_to_use = facet_body;
error = PK.BODY.boolean_2(target_to_use, 1, &tool_to_use, &boolean_options, &tracking, &boolean_results);
if (error == PK.ERROR.code_t.no_errors
&& boolean_results.result == PK.boolean_result_t.success_c
&& boolean_results.n_bodies > 0)
{
for (int i = 0; i < boolean_results.n_bodies; ++i)
{
if (boolean_results.bodies[i] != target)
return false;
parasolid_target_component.Tessellate(HPS.Parasolid.FacetTessellationKit.GetDefault(), HPS.Parasolid.LineTessellationKit.GetDefault());
}
tool_component.Delete();
return true;
}
else
return false;
}
unsafe private bool IsEntityFaceted(PK.BODY_t body)
{
int number_of_faces = 0;
PK.FACE_t* faces = null;
PK.ERROR.code_t error = PK.BODY.ask_faces(body, &number_of_faces, &faces);
if (error != PK.ERROR.code_t.no_errors || number_of_faces == 0)
{
return false;
}
PK.SURF_t surface;
error = PK.FACE.ask_surf(faces[0], &surface);
if (error != PK.ERROR.code_t.no_errors)
{
return false;
}
PK.GEOM.ask_geom_category_o_t geom_options = new PK.GEOM.ask_geom_category_o_t(true);
PK.GEOM.category_t category;
error = PK.GEOM.ask_geom_category(surface, &geom_options, &category);
if (error != PK.ERROR.code_t.no_errors)
{
return false;
}
if (category == ((PK.GEOM.category_t)25871))
return true;
else if (category == ((PK.GEOM.category_t)25870))
return false;
return false;
}
}
$00760_exchange_parasolid_boolean_setup
bool setUpScene(ref HPS.Canvas myCanvas, string importFileTarget, string importFileTool)
{
Exchange.ImportOptionsKit kit = Exchange.ImportOptionsKit.GetDefault();
kit.SetBRepMode(Exchange.BRepMode.BRepAndTessellation);
ExchangeParasolid.ImportNotifier notifier = ExchangeParasolid.File.Import(importFileTarget, kit,
Exchange.TranslationOptionsKit.GetDefault(),
Parasolid.FacetTessellationKit.GetDefault(),
Parasolid.LineTessellationKit.GetDefault());
notifier.Wait();
if (notifier.Status() != IOResult.Success)
return false;
CADModel cadmodel = notifier.GetCADModel();
Component[] location = { cadmodel };
ComponentPath path = new ComponentPath(location);
kit.SetLocation(path);
notifier = ExchangeParasolid.File.Import(importFileTool, kit,
Exchange.TranslationOptionsKit.GetDefault(),
Parasolid.FacetTessellationKit.GetDefault(),
Parasolid.LineTessellationKit.GetDefault());
notifier.Wait();
if (notifier.Status() != IOResult.Success)
return false;
View view = cadmodel.ActivateDefaultCapture();
myCanvas.AttachViewAsLayout(view);
Point position = new Point(-116.158989f, -2172.083008f, 921.859985f);
Point target = new Point(-0.000153f, -89.000000f, 117.000000f);
Vector up_vector = new Vector(-0.004887f, -0.360171f, -0.932874f);
camera_kit.SetPosition(position)
.SetTarget(target)
.SetUpVector(up_vector)
.SetField(894.474365f, 894.474365f)
.SetNearLimit(0.000000f)
.SetProjection(HPS.Camera.Projection.Orthographic);
view.GetSegmentKey().SetCamera(camera_kit);
Vector distant_light = new Vector(1, 0, 0);
view.GetSegmentKey().InsertDistantLight(distant_light);
myCanvas.Update();
TestBooleanOperator boolean_operator = new TestBooleanOperator(ref myCanvas, ref cadmodel);
view.GetOperatorControl().Push(boolean_operator, HPS.Operator.Priority.Default);
return true;
}
$00760_exchange_parasolid_boolean_instantiate
TestBooleanOperator boolean_operator = new TestBooleanOperator(ref myCanvas, ref cadmodel);
view.GetOperatorControl().Push(boolean_operator, HPS.Operator.Priority.Default);
$00760_exchange_parasolid_boolean_execute
void executeBooleanOperation(ref HPS.Canvas myCanvas)
{
myCanvas.GetFrontView().GetOperatorControl().ShowTop(out myOperator);
if (myOperator.GetName() == "TestBooleanOperator")
{
TestBooleanOperator op = (TestBooleanOperator)myOperator;
op.ApplyBoolean();
myCanvas.UpdateWithNotifier().Wait();
}
}
$00760_exchange_parasolid_boolean_retrieve
myCanvas.GetFrontView().GetOperatorControl().ShowTop(out myOperator);
if (myOperator.GetName() == "TestBooleanOperator")
{
TestBooleanOperator op = (TestBooleanOperator)myOperator;
op.ApplyBoolean();
myCanvas.UpdateWithNotifier().Wait();
}
$00760_exchange_parasolid_boolean_selection_logic
public override bool OnMouseUp(MouseState in_state)
{
if (!IsMouseTriggered(in_state) && in_state.GetLocation() == click_location)
{
ulong count = canvas.GetWindowKey().GetSelectionControl().SelectByPoint(click_location, selection_options, out results);
if (count == 0)
return false;
while (s_it.IsValid())
{
s_it.GetItem().ShowPath(out selected_path);
foreach (HPS.Component it in components)
{
if (it.GetComponentType() == HPS.Component.ComponentType.ParasolidTopoBody)
{
PK.ENTITY_t selected_parasolid_entity = para_component.GetParasolidEntity();
if (target == selected_parasolid_entity)
{
highlight_control.Unhighlight(selected_path, target_highlight);
canvas.Update();
target = PK.ENTITY_t.@null;
target_component.Reset();
target_path.Reset();
return true;
}
else if (tool == selected_parasolid_entity)
{
highlight_control.Unhighlight(selected_path, tool_highlight);
canvas.Update();
tool = PK.ENTITY_t.@null;
tool_component.Reset();
tool_path.Reset();
return true;
}
else if (target == PK.ENTITY_t.@null)
{
target = selected_parasolid_entity;
target_component = it;
target_path = selected_path;
highlight_control.Highlight(selected_path, target_highlight);
canvas.Update();
return true;
}
else
{
tool = selected_parasolid_entity;
tool_component = it;
tool_path = selected_path;
highlight_control.Highlight(selected_path, tool_highlight);
canvas.Update();
return true;
}
}
}
s_it.Next();
}
return true;
}
return false;
}
$relative_tessellation
ftk.SetTessellationLevel(HPS.Parasolid.TessellationLevel.Medium);
$parasolid_subcomponent
iok.SetFormat(HPS.Parasolid.Format.Text);
notifier.Wait();
$parasolid_default_view
HPS.Canvas myCanvas = HPS.Factory.CreateCanvas(myWindowKey);
HPS.View view = notifier.GetCADModel().ActivateDefaultCapture();
myCanvas.AttachViewAsLayout(view);
$parasolid_metadata
String filename_value = stringMetadata.GetValue();
$parasolid_create_cad_model
$parasolid_entity_creation
PK.BODY_t solid_body = PK.ENTITY_t.@null;
PK.BODY.create_solid_block(0.05, 0.05, 0.05, null, &solid_body);
cadModel.AddEntity(solid_body, HPS.Parasolid.FacetTessellationKit.GetDefault(),
HPS.Parasolid.LineTessellationKit.GetDefault());
if (myNewComponent.GetComponentType() != HPS.Component.ComponentType.ParasolidTopoBody)
;
Key[] componentKeys = myNewComponent.GetKeys();
$parasolid_retessellate
ftk.SetFacetPlaneTolerance(7.3, 1.0).SetChordTolerance(5.0, 5.3, 1.0);
ltk = Parasolid.LineTessellationKit.GetDefault();
ltk.SetChordTolerance(0, 0, 1.3);
component.Tessellate(ftk, ltk);
myCanvas.Update();
$parasolid_export
export_options.SetFormat(HPS.Parasolid.Format.Text).SetUserFields(true);
HPS.Parasolid.File.Export(cadModel, outfile, export_options);
$publish_button_kit
buttonKit.SetLabel("This is a page button")
.SetLabelPosition(HPS.Publish.Label.Position.OnTop)
.SetHighlighting(HPS.Publish.Highlighting.Mode.Push)
.SetVisibility(true)
.SetFont(HPS.Publish.Text.Font.Name.TimesRoman)
.SetFontSize(8)
.SetName("execute_button");
$publish_button_javascript
myPageKit.SetJavaScriptActionByField("execute_button", myJavascriptSource,
HPS.Publish.Source.Type.Code);
myPageKit.SetJavaScriptActionByField("execute_button", myJavascriptSource,
HPS.Publish.Source.Type.Code);
$publish_table_source
tableKit.SetHTML(myHTML_source);
tableKit.SetHTMLStyle(myCSS_source);
$publish_table_text
textKit.SetColor(new RGBColor(1, 0, 0))
.SetFont(Publish.Text.Font.Name.Courier)
.SetSize(12)
.SetText("My table text");
tableKit.SetText(1, 1, textKit);
$publish_table_button
buttonKit.SetLabel("button 1").
SetLabelPosition(HPS.Publish.Label.Position.OnTop).
SetVisibility(true).
SetName("b1");
tableKit.SetButton(2, 1, buttonKit);
$publish_export_subtree
HPS.KeyPath[] keyPath = HPS.Component.GetKeyPath(componentModel[0]);
annotationKit.SetSource(keyPath);
HPS.Publish.File.ExportPDF(annotationKit,
output_filename,
$MyEventHandler
class MyEventHandler : HPS.EventHandler
{
public override HandleResult Handle(HPS.Event in_event)
{
return HandleResult.Handled;
}
};
$dispatcher
MyEventHandler myHandler = new MyEventHandler();
dispatcher.Subscribe(myHandler, HPS.Object.ClassID<
HPS.ErrorEvent>());
dispatcher.UnSubscribe(myHandler, HPS.Object.ClassID<
HPS.ErrorEvent>());
$MyEvent
class MyEvent : HPS.Event
{
public MyEvent() : base() { }
public MyEvent(IntPtr type) : base(type) { }
public override Event Clone() { return new MyEvent(GetChannel()); }
};
$dispatch_MyEvent
MyEvent myEvent = new MyEvent(HPS.Object.ClassID<MyEvent>());
dispatcher.InjectEvent(myEvent);
$event_status
if (eventNotifier.Status() == HPS.Event.Status.InProgress)
{
}
if (eventNotifier.Status() == HPS.Event.Status.Completed)
{
}
$wait
$custom_event
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>());
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
$custom_event_full_source
class MyCustomEvent : HPS.Event
{
private int myRandomNumber;
public MyCustomEvent() : base()
{
}
public MyCustomEvent(IntPtr type) : base(type)
{
}
public MyCustomEvent(IntPtr type, int randomNumber) : base(type)
{
myRandomNumber = randomNumber;
}
public override Event Clone()
{
MyCustomEvent new_event = new MyCustomEvent(GetChannel(), myRandomNumber);
return new_event;
}
public override bool Drop(Event in_that_event)
{
bool drop_status = false;
if ((myRandomNumber % 3) == 0)
drop_status = true;
return drop_status;
}
public int getMyRandomNumber()
{
return this.myRandomNumber;
}
};
public class MyEventHandler : HPS.EventHandler
{
~MyEventHandler() { Shutdown(); }
public override HandleResult Handle(HPS.Event in_event)
{
MyCustomEvent myEvent = (MyCustomEvent)in_event;
return HandleResult.Handled;
}
};
void injectSingleEvent(ref HPS.Canvas canvas)
{
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>());
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
}
void injectManyEvents(ref HPS.Canvas canvas)
{
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
Random rand = new Random();
for (int i = 0; i < 100; i++)
{
int randomNumber = rand.Next();
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>(), randomNumber);
dispatcher.InjectEvent(myEvent);
}
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
}
$drop_event
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
Random rand = new Random();
for (int i = 0; i < 100; i++)
{
int randomNumber = rand.Next();
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>(), randomNumber);
dispatcher.InjectEvent(myEvent);
}
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
$merging_events_example
class MyCustomEvent : HPS.Event
{
private int myRandomNumber;
public MyCustomEvent() : base()
{
}
public MyCustomEvent(IntPtr type) : base(type)
{
}
public MyCustomEvent(IntPtr type, int randomNumber) : base(type)
{
myRandomNumber = randomNumber;
}
public override Event Clone()
{
MyCustomEvent new_event = new MyCustomEvent(GetChannel(), myRandomNumber);
return new_event;
}
public override bool Drop(Event in_that_event)
{
bool drop_status = false;
if ((myRandomNumber % 3) == 0)
drop_status = true;
return drop_status;
}
public int getMyRandomNumber()
{
return this.myRandomNumber;
}
};
public class MyEventHandler : HPS.EventHandler
{
~MyEventHandler() { Shutdown(); }
public override HandleResult Handle(HPS.Event in_event)
{
MyCustomEvent myEvent = (MyCustomEvent)in_event;
return HandleResult.Handled;
}
};
void injectSingleEvent(ref HPS.Canvas canvas)
{
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>());
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
}
void injectManyEvents(ref HPS.Canvas canvas)
{
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
Random rand = new Random();
for (int i = 0; i < 100; i++)
{
int randomNumber = rand.Next();
MyCustomEvent myEvent = new MyCustomEvent(HPS.Object.ClassID<MyCustomEvent>(), randomNumber);
dispatcher.InjectEvent(myEvent);
}
dispatcher.UnSubscribe(myEventHandler, HPS.Object.ClassID<MyCustomEvent>());
}
}
$handling_input
class MyEventHandler : HPS.EventHandler
{
{
float x = location.x;
float y = location.y;
float z = location.z;
return HPS.EventHandler.HandleResult.Handled;
}
}
$subscribe
MyEventHandler myEventHandler = new MyEventHandler();
dispatcher.Subscribe(myEventHandler, HPS.Object.ClassID<
HPS.MouseEvent>());
$model_compare
subwindowKit.SetModelCompareMode(true, segment1, segment2);
$operator
class SphereOperator : Operator
{
private bool operatorStarted;
public SphereOperator(Canvas c)
{
canvas = c;
}
public override void OnViewAttached(HPS.View in_attached_view)
{
operatorStarted = false;
HPS.Model model = canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel();
if (model.Type() == HPS.Type.None)
{
model = HPS.Factory.CreateModel();
canvas.GetAttachedLayout().GetAttachedView().AttachModel(model);
}
temporaryGeometry = model.GetSegmentKey().Subsegment();
temporaryGeometry.GetVisibilityControl().
SetLines(true).SetMarkers(true).SetFaces(false).SetEdges(true);
temporaryGeometry.GetMaterialMappingControl().
SetLineColor(new HPS.RGBAColor(0, 0, 1, 1)).
SetMarkerColor(new HPS.RGBAColor(1, 0, 0, 1));
temporaryGeometry.GetMarkerAttributeControl()
.SetSymbol("plus").SetSize(0.3f);
temporaryGeometry.GetCameraControl()
.SetProjection(HPS.Camera.Projection.Stretched)
.SetUpVector(
new HPS.Vector(0, 1, 0)).SetField(2, 2);
temporaryGeometry.GetDrawingAttributeControl()
.SetOverlay(HPS.Drawing.Overlay.Default);
return;
}
public override bool OnMouseDown(HPS.MouseState in_state)
{
if (in_state.GetActiveEvent().CurrentButton.Left())
{
operatorStarted = true;
centerPoint = in_state.GetLocation();
}
return true;
}
public override bool OnMouseMove(HPS.MouseState in_state)
{
if (IsMouseTriggered(in_state) && operatorStarted)
return ConstructSphereOutline(in_state.GetLocation());
return false;
}
public override bool OnMouseUp(MouseState in_state)
{
if (in_state.GetActiveEvent().CurrentButton.Left() && operatorStarted)
{
operatorStarted = false;
if (radiusLine != null)
radiusLine.Delete();
if (centerMarker != null)
centerMarker.Delete();
if (circle != null)
circle.Delete();
temporaryGeometry.Flush(HPS.Search.Type.Geometry, HPS.Search.Space.Subsegments);
HPS.SegmentKey sphere = GetAttachedView().GetAttachedModel().GetSegmentKey().Subsegment();
sphere.GetMaterialMappingControl().SetFaceColor(new RGBAColor(0, 1, 0, 1));
canvas.GetAttachedLayout().GetAttachedView(),
canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel());
path.Append(sphere).Append(tpath);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, centerPoint, HPS.Coordinate.Space.World, out drawPosition0);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, in_state.GetLocation(), HPS.Coordinate.Space.World, out drawPosition1);
sphere.InsertSphere(drawPosition0, ComputeDistance(drawPosition0, drawPosition1));
GetAttachedView().Update();
}
return true;
}
private bool ConstructSphereOutline(Point currentPosition)
{
if (radiusLine != null)
radiusLine.Delete();
if (centerMarker != null)
centerMarker.Delete();
if (circle != null)
circle.Delete();
canvas.GetAttachedLayout().GetAttachedView(),
canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel());
path.Append(temporaryGeometry).Append(tpath);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, centerPoint, HPS.Coordinate.Space.World, out drawPosition0);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, currentPosition, HPS.Coordinate.Space.World, out drawPosition1);
centerMarker = temporaryGeometry.InsertMarker(new Point(drawPosition0));
radiusLine = temporaryGeometry.InsertLine(drawPosition0, drawPosition1);
circle = temporaryGeometry.InsertCircle(drawPosition0, ComputeDistance(drawPosition0, drawPosition1),
new HPS.Vector(0, 0, 1));
GetAttachedView().Update();
return true;
}
private float ComputeDistance(Point p0, Point p1)
{
return (float) Math.Sqrt((p1.x - p0.x) * (p1.x - p0.x) +
(p1.y - p0.y) * (p1.y - p0.y) +
(p1.z - p0.z) * (p1.z - p0.z));
}
}
$touch_operator_ex
class SphereOperator : Operator
{
private bool operatorStarted;
public SphereOperator(Canvas c)
{
canvas = c;
}
public override void OnViewAttached(HPS.View in_attached_view)
{
operatorStarted = false;
HPS.Model model = canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel();
if (model.Type() == HPS.Type.None)
{
model = HPS.Factory.CreateModel();
canvas.GetAttachedLayout().GetAttachedView().AttachModel(model);
}
temporaryGeometry = model.GetSegmentKey().Subsegment();
temporaryGeometry.GetVisibilityControl().
SetLines(true).SetMarkers(true).SetFaces(false).SetEdges(true);
temporaryGeometry.GetMaterialMappingControl().
SetLineColor(new HPS.RGBAColor(0, 0, 1, 1)).
SetMarkerColor(new HPS.RGBAColor(1, 0, 0, 1));
temporaryGeometry.GetMarkerAttributeControl()
.SetSymbol("plus").SetSize(0.3f);
temporaryGeometry.GetCameraControl()
.SetProjection(HPS.Camera.Projection.Stretched)
.SetField(2, 2);
temporaryGeometry.GetDrawingAttributeControl()
.SetOverlay(HPS.Drawing.Overlay.Default);
return;
}
public override bool OnTouchDown(HPS.TouchState in_state)
{
Touch[] touches = in_state.GetActiveEvent().Touches;
if (touches.size() == 1)
{
centerPoint = touches[0].Location;
operatorStarted = true;
}
return true;
}
public override bool OnTouchMove(TouchState in_state)
{
Touch[] touches = in_state.GetActiveEvent().Touches;
if (touches.size() == 1 && operatorStarted)
return ConstructSphereOutline(touches[0].Location);
return false;
}
public override bool OnTouchUp(TouchState in_state)
{
Touch[] upTouches = in_state.GetActiveEvent().Touches;
if(upTouches.Length == 1 && operatorStarted)
{
operatorStarted = false;
radiusLine.Delete();
centerMarker.Delete();
circle.Delete();
temporaryGeometry.Flush(HPS.Search.Type.Geometry, HPS.Search.Space.Subsegments);
SegmentKey sphere = GetAttachedView().GetAttachedModel().GetSegmentKey().Subsegment();
sphere.GetMaterialMappingControl().SetFaceColor(new RGBAColor(0, 1, 0, 1));
SprocketPath sprkPath = new SprocketPath(canvas, canvas.GetAttachedLayout(), canvas.GetAttachedLayout().GetAttachedView(),
canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel());
KeyPath path = sprkPath.GetKeyPath();
path.Append(sphere);
Point drawPosition0, drawPosition1;
path.ConvertCoordinate(HPS.Coordinate.Space.Window, centerPoint, HPS.Coordinate.Space.World, out drawPosition0);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, upTouches[0].Location, HPS.Coordinate.Space.World, out drawPosition1);
sphere.InsertSphere(drawPosition0, ComputeDistance(drawPosition0, drawPosition1));
GetAttachedView().Update();
}
return true;
}
private bool ConstructSphereOutline(Point currentPosition)
{
if (radiusLine != null)
radiusLine.Delete();
if (centerMarker != null)
centerMarker.Delete();
if (circle != null)
circle.Delete();
canvas.GetAttachedLayout().GetAttachedView(),
canvas.GetAttachedLayout().GetAttachedView().GetAttachedModel());
path.Append(temporaryGeometry).Append(tpath);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, centerPoint, HPS.Coordinate.Space.World, out drawPosition0);
path.ConvertCoordinate(HPS.Coordinate.Space.Window, currentPosition, HPS.Coordinate.Space.World, out drawPosition1);
centerMarker = temporaryGeometry.InsertMarker(new Point(drawPosition0));
radiusLine = temporaryGeometry.InsertLine(drawPosition0, drawPosition1);
circle = temporaryGeometry.InsertCircle(drawPosition0, ComputeDistance(drawPosition0, drawPosition1),
new HPS.Vector(0, 0, 1));
GetAttachedView().Update();
return true;
}
private float ComputeDistance(Point p0, Point p1)
{
return (float)Math.Sqrt((p1.x - p0.x) * (p1.x - p0.x) +
(p1.y - p0.y) * (p1.y - p0.y) +
(p1.z - p0.z) * (p1.z - p0.z));
}
}
$define_stream_import_handler
class NoBoldEvent : HPS.Stream.ImportEventHandler
{
public override bool Handle(HPS.Stream.ImportEvent e)
{
{
text_event.text_kit.UnsetBold();
}
{
text_attribute_event.text_attribute_kit.UnsetBold();
}
return true;
}
};
$set_stream_import_handler
NoBoldEvent no_bold_event = new NoBoldEvent();
$define_stream_export_handler
class SpecialExportEvent : HPS.Stream.ExportEventHandler
{
public override void Handle(HPS.Stream.ExportEvent e)
{
string name = seg_event.segment_key.Name();
if (name == "My_Special_Segment")
{
string str = "HOOPS Visualize!";
seg_event.non_db_user_data = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, seg_event.non_db_user_data, 0, seg_event.non_db_user_data.Length);
}
}
};
$set_stream_export_handler
SpecialExportEvent special_export_event = new SpecialExportEvent();
$load_file_example
importKit.SetSegment(importSeg);
handler.SetNotifier(notif);
notif.Wait();
handler.SetNotifier(null);
$export1
$export2
annotationKit.SetSource(cadModel, keyPathArray);
$export3
HPS.Exchange.File.ExportPRC(cadModel, filename, exportPRCOptionsKit);
$exchange_parasolid_import
HPS.Exchange.TranslationOptionsKit.GetDefault(),
HPS.Parasolid.FacetTessellationKit.GetDefault(),
HPS.Parasolid.LineTessellationKit.GetDefault());
notifier.Wait();
HPS.Component[] pmis = cad_model.GetAllSubcomponents(HPS.Component.ComponentType.ExchangePMIMask);
IntPtr exchange_pmi_entity = pmi_component.GetExchangeEntity();
HPS.Component[] faces = cad_model.GetAllSubcomponents(HPS.Component.ComponentType.ParasolidTopoFace);
int parasolid_face_entity = face_component.GetParasolidEntity();
$text_background
textKit.SetPosition(new Point(0, 0.25f, 0));
textKit.SetText("TECH SOFT 3D");
textKit.SetSize(30, HPS.Text.SizeUnits.Pixels);
textKit.SetAlignment(HPS.Text.Alignment.Center);
textKit.SetBackground(true, "oval");
mySegmentKey.GetMaterialMappingControl().SetFaceColor(new RGBAColor(0.5f, 0, 0.5f));
mySegmentKey.InsertText(textKit);
$text_background_named_style
SegmentKey styleSegment = Database.CreateRootSegment();
styleSegment.GetMaterialMappingControl().SetFaceColor(new RGBAColor(1, 1, 0)).SetEdgeColor(new RGBAColor(0, 0, 1));
styleSegment.GetEdgeAttributeControl().SetWeight(5).SetPattern("dashed_pattern");
myPortfolio.DefineNamedStyle("myShapeStyle", styleSegment);
SegmentKey containingSegment = mySegmentKey.Subsegment();
containingSegment.GetTextAttributeControl().SetBackgroundStyle("myShapeStyle");
$custom_text_background
ShapeCoordinate x = new ShapeCoordinate(1, 0);
ShapeCoordinate y = new ShapeCoordinate(0, 1);
ShapeCoordinate neg_x = new ShapeCoordinate(-1, 0);
ShapeCoordinate neg_y = new ShapeCoordinate(0, -1);
ShapeKit clippedShapeKit = new ShapeKit();
ShapePoint [] clipped_points = new ShapePoint[]
{
new ShapePoint(x.SetMargins(1), y),
new ShapePoint(x.SetMargins(0), y.SetMargins(1)),
new ShapePoint(neg_x, y),
new ShapePoint(neg_x.SetMargins(-1), y.SetMargins(0)),
new ShapePoint(neg_x, neg_y),
new ShapePoint(neg_x.SetMargins(0), neg_y.SetMargins(-1)),
new ShapePoint(x, neg_y),
new ShapePoint(x.SetMargins(1), neg_y.SetMargins(0))
};
PolygonShapeElement clipped_element = new PolygonShapeElement(clipped_points);
clippedShapeKit.SetElement(clipped_element);
myPortfolio.DefineShape("clipped background shape", clippedShapeKit);
TextKit textKit = new TextKit();
textKit.SetPosition(new Point(0, 0.25f, 0));
textKit.SetText("TECH SOFT 3D");
textKit.SetSize(30, HPS.Text.SizeUnits.Pixels);
textKit.SetAlignment(HPS.Text.Alignment.Center);
textKit.SetBackground(true, "clipped background shape");
mySegmentKey.InsertText(textKit);
$incremental1
importOptions.SetMode(HPS.Exchange.ImportMode.Incremental);
notifier.Wait();
$incremental2
HPS.Component rootProductOccurrence = cadModel.GetSubcomponents()[0];
HPS.Component componentToLoad = rootProductOccurrence.GetSubcomponents()[0];
HPS.Component [] pathComponents = { componentToLoad, rootProductOccurrence, cadModel };
importOptions.SetIncrementalComponentPath(pathToLoad);
notifier = HPS.Exchange.File.Import(filename, importOptions);
notifier.Wait();
$incremental3
productOccurrence.Unload(HPS.Exchange.UnloadMode.ExchangeAndVisualization);
productOccurrence.Unload();
productOccurrence.Unload(HPS.Exchange.UnloadMode.ExchangeOnly);
$camera_projection
mySegmentKey.GetCameraControl().SetProjection(HPS.Camera.Projection.Orthographic);
$shape_coordinate1
ShapeCoordinate sc1 = new ShapeCoordinate(1.15f, 0);
ShapeCoordinate sc2 = new ShapeCoordinate(0.85f, 1.5f);
ShapePoint sp = new ShapePoint(sc1, sc2);
$shape_coordinate2
ShapeCoordinate sc1 = new ShapeCoordinate(1, 0);
ShapeCoordinate sc2 = new ShapeCoordinate(0, 1);
ShapePoint sp = new ShapePoint(sc1, sc2);
$shape_coordinate3
ShapeCoordinate sc1 = new ShapeCoordinate(1, 0);
ShapeCoordinate sc2 = new ShapeCoordinate(0, 0);
ShapePoint sp = new ShapePoint(sc1, sc2);
$margins
mySegmentKey.GetTextAttributeControl().SetBackgroundMargins(40);
sc1.SetMargins(1, 0, 0, 0);
sc2.SetMargins(0, 3, 2, 0);
sc3.SetMargins(0, 0, -1, 0);
sc4.SetMargins(0, 0, 0, -2.5f);
$non_latin_fonts
SegmentKey modelSegment = _canvas.GetFrontView().GetAttachedModel().GetSegmentKey();
modelSegment.GetVisibilityControl().SetText(true);
String font;
modelSegment.GetTextAttributeControl().SetFont("Microsoft YaHei");
modelSegment.GetTextAttributeControl().ShowFont(out font);
modelSegment.InsertText(new Point(0, 0, 0), (String)"Chinese Char 中国智造");
$publish_html_export_exchange
Exchange.ImportNotifier notifier;
Exchange.ImportOptionsKit importOptions = Exchange.ImportOptionsKit.GetDefault();
importOptions.SetBRepMode(Exchange.BRepMode.BRepAndTessellation);
notifier = Exchange.File.Import(myCADFilePath, importOptions);
notifier.Wait();
if (notifier.Status() != IOResult.Success)
{
}
try
{
Publish.File.ExportHTML(_cadModel, exportedHTMLFilePath, htmlTemplateFilePath, true);
}
catch (IOException)
{
}
$publish_html_export_sprocketkey
SprocketPath path = new SprocketPath(model, view, layout, canvas);
try
{
Publish.File.ExportHTML(path.GetKeyPath(), exportedHTMLFilePath, htmlTemplateFilePath);
}
catch (IOException)
{
}
$sprocket_html_export
SprocketPath sPath = new SprocketPath(canvas, layout, view, model);
try
{
HTML.File.Export(sPath.GetKeyPath(), exportedHTMLFilePath, htmlTemplateFilePath);
}
catch (IOException)
{
}
$ooc_import
HPS.IOResult status = HPS.IOResult.Failure;
string message;
try
{
ioOpts.SetTarget(_model);
notifier = HPS.OOC.File.Import(myPointCloudFilePath, ioOpts);
notifier.Wait();
status = notifier.Status();
_view.FitWorld();
_canvas.UpdateWithNotifier(HPS.Window.UpdateType.Exhaustive).Wait();
}
catch (HPS.IOException ex)
{
status = ex.result;
message = ex.what();
}
$ooc_filter_class
public class CountAll : OOC.QueryFilter
{
public CountAll()
{
point_count = 0;
}
public CountAll(ulong in_point_count = 0)
{
point_count = in_point_count;
}
public override bool RejectPointsInMemory()
{
return false;
}
public override bool RejectPointsOnDisk()
{
return false;
}
public override bool RejectNode(OOC.NodeHandle node_handle)
{
return false;
}
public override bool RejectBounding(Point min_bound, Point max_bound)
{
return false;
}
public override bool AcceptPoint(Point point, ulong point_index)
{
++point_count;
return true;
}
ulong point_count;
}
\htmlonly
$ooc_filter_half
public class AcceptHalf : OOC.QueryFilter {
public AcceptHalf()
{
point_count = 0;
}
public AcceptHalf(ulong in_point_count = 0)
{
point_count = in_point_count;
}
public override bool AcceptPoint(Point point, ulong point_index)
{
if (point_index % 2 == 0)
{
++point_count;
return true;
}
else return false;
}
ulong point_count;
}
\htmlonly
$ooc_query_all
ulong num_points = 0;
OOC.PointCloud point_cloud = new OOC.PointCloud(_model);
if (point_cloud.Empty())
{
}
CountAll filter = new CountAll();
OOC.QueryIterator it = point_cloud.QueryPoints(filter);
while (true)
{
if (status != HPS.OOC.QueryIterator.Status.Alive)
{
break;
}
++num_points;
it.Next();
}
$ooc_query_half
ulong num_points_half = 0;
AcceptHalf filter_half = new AcceptHalf();
OOC.QueryIterator it_half = point_cloud.QueryPoints(filter_half);
while (true)
{
if (status != HPS.OOC.QueryIterator.Status.Alive)
{
break;
}
++num_points_half;
it_half.Next();
}
$ooc_vertex_functions
SegmentKey mySegment = _canvas.GetFrontView().GetSegmentKey();
mySegment.GetDrawingAttributeControl().SetVertexDecimation(0.05f);
mySegment.GetDrawingAttributeControl().SetVertexRandomization(true);
_canvas.Update(HPS.Window.UpdateType.Refresh);
$find_highlights
hsok.SetOverlay(Drawing.Overlay.WithZValues);
ulong numHighlights = myWindowKey.FindHighlights(hsok, out hsr);
HighlightSearchResultsIterator it = hsr.GetIterator();
while (it.IsValid())
{
string style_name = it.GetStyleName();
Drawing.Overlay overlay = it.GetOverlay();
it.Next();
}
$highlight_state
hsok.SetStyleName("highlight_style");
myHighlightControl.ShowHighlightState(myKeyPath, hsok, out myHighlightState);
bool inheritsHighlight = myHighlightState.GetInheritsHighlight();
bool containsHighlightedSubentities = myHighlightState.GetSubentityHighlighted();
bool isDirectlyHighlighted = myHighlightState.GetDirectlyHighlighted();
bool isOnHighlightPath = myHighlightState.GetOnHighlightPath();
$obj_export
SprocketPath path = new SprocketPath(canvas, canvas.GetAttachedLayout(), view, model);
string output_file = my_export_directory + "/obj_export_1.obj";
OBJ.ExportNotifier export_notifier = OBJ.File.Export(output_file, path.GetKeyPath());