Highlighting a Work Point in Model View

Highlighting a Work Point in Model View

chuck_yocum
Contributor Contributor
534 Views
0 Replies
Message 1 of 1

Highlighting a Work Point in Model View

chuck_yocum
Contributor
Contributor

I am trying to highlight a work point in model view

 

public static void HighlightWorkPoint(WorkPoint wp,ComponentOccurrence componentOccurrence)
{
ComponentOccurrence oAssyOcc = componentOccurrence;
ComponentOccurrence parentOcc = ivGlobal.GetTopLevelAssemblyComponentOccurrence();
InteractionGraphics oIntGraphics = ivGlobal.oIvApp.CommandManager.CreateInteractionEvents().InteractionGraphics;
//Vector glbZ = SDGlobal.GetLocalDirOfGlobalZ(ref oAssyOcc);
//glbZ.Normalize();
//glbZ.ScaleBy(-1.0);
var workPointPoint = wp.Point;// ivGlobal.GetLocalPointFromGlobalPoint(wp.Point, ref oAssyOcc);
//Point workPointPoint = wp.Point;
//SDGlobal.GetLocalPoint(ref workPointPoint, ref parentOcc);// ivGlobal.TestGetOccPointFromLocalPoint(ref oAssyOcc, wp);
//return;
//FixedWorkPointDef oWPDef;

//Inventor.Point oProjectedPoint = default(Point);
//ProjectPoint(ModelPosition, oWPDef.Point, ref oProjectedPoint);
//ProjectPoint(wp.Point, oWPDef.Point, ref oProjectedPoint);

// Set a reference to the transient geometry object for user later.
TransientGeometry oTransGeom;
oTransGeom = ivGlobal.oIvApp.TransientGeometry;

// Create a graphics data set object. This object contains all of the
// information used to define the graphics.
GraphicsDataSets oDataSets;
oDataSets = oIntGraphics.GraphicsDataSets;

if (oDataSets.Count != 0)
{
oDataSets[1].Delete();
}

// Create a coordinate set.
GraphicsCoordinateSet oCoordSet;
oCoordSet = oDataSets.CreateCoordinateSet(1);

// Create an array that contains coordinates that define a set
// of outwardly spiraling points.
Double[] oPointCoords = new Double[3];
// Define the X, Y, and Z components of the point.
oPointCoords[0] = workPointPoint.X;
oPointCoords[1] = workPointPoint.Y;
oPointCoords[2] = workPointPoint.Z;

// Assign the points into the coordinate set.
oCoordSet.PutCoordinates(oPointCoords);

// Create the ClientGraphics object.
ClientGraphics oClientGraphics;
oClientGraphics = oIntGraphics.PreviewClientGraphics;

if (oClientGraphics.Count != 0)
{
oClientGraphics[1].Delete();
}

// Create a new graphics node within the client graphics objects.
GraphicsNode oPtNode;
oPtNode = oClientGraphics.AddNode(1);

// Create a PointGraphics object within the node.
PointGraphics oPtGraphics;
oPtGraphics = oPtNode.AddPointGraphics();

// Assign the coordinate set to the line graphics.
oPtGraphics.CoordinateSet = oCoordSet;
oPtGraphics.PointRenderStyle = PointRenderStyleEnum.kCrossPointStyle;
ivGlobal.oIvApp.ActiveView.Update();
}

 

As you can in the graphic it is drawing from the model 0,0 instead of the fitting relative to the Model View.  The Fitting is highlighting properly.

 

 

0 Likes
535 Views
0 Replies
Replies (0)