////////////////////////////////////////////////////////////////////////////////////////////// // Description: Displays a PointGraphics using custom bitmap image. // ////////////////////////////////////////////////////////////////////////////////////////////// static public void PointGraphicsDemo() { PartDocument doc = AdnInventorUtilities.InvApplication.ActiveDocument as PartDocument; string clientId = "{Add-in Guid}"; ClientGraphics graphics = null; GraphicsDataSets dataSets = null; try { graphics = doc.ComponentDefinition.ClientGraphicsCollection[clientId]; dataSets = doc.GraphicsDataSetsCollection[clientId]; } catch { graphics = doc.ComponentDefinition.ClientGraphicsCollection.Add(clientId); dataSets = doc.GraphicsDataSetsCollection.Add(clientId); } GraphicsNode node = graphics.AddNode(graphics.Count + 1); GraphicsCoordinateSet coordSet = dataSets.CreateCoordinateSet(dataSets.Count + 1); double[] coords = new double[] { 5.0, 0.0, 0.0 }; coordSet.PutCoordinates(ref coords); GraphicsImageSet imageSet = dataSets.CreateImageSet(dataSets.Count + 1); stdole.IPictureDisp image = PictureDispConverter.ToIPictureDisp(Resources.PointImage); imageSet.Add(1, image, null, -1, -1); PointGraphics pointGraphPrimitive = node.AddPointGraphics(); pointGraphPrimitive.CoordinateSet = coordSet; pointGraphPrimitive.SetCustomImage(imageSet, 1); doc.Views[1].Update(); }