03-18-2019
07:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-18-2019
07:45 AM
Fair enough; can you share a drawing with the same geometry that is failing as in your example? (Autodesk will ask for it anyway when they see/reply to this post)
Also, have you seen this example:
public void CreateBalloon()
{
// Set a reference to the drawing document.
// This assumes a drawing document is active.
DrawingDocument oDrawDoc = (DrawingDocument)_InvApplication.ActiveDocument;
// Set a reference to the active sheet.
Sheet oActiveSheet = oDrawDoc.ActiveSheet;
// Set a reference to the drawing curve segment.
// This assumes that a drwaing curve is selected.
DrawingCurveSegment oDrawingCurveSegment = oDrawDoc.SelectSet[1];
// Set a reference to the drawing curve.
DrawingCurve oDrawingCurve = oDrawingCurveSegment.Parent;
// Get the mid point of the selected curve
// assuming that the selection curve is linear
Point2d oMidPoint = oDrawingCurve.MidPoint;
// Set a reference to the TransientGeometry object.
TransientGeometry oTG = _InvApplication.TransientGeometry;
ObjectCollection oLeaderPoints = _InvApplication.TransientObjects.CreateObjectCollection();
// Create a couple of leader points.
oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 10));
oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5));
// Add the GeometryIntent to the leader points collection.
// This is the geometry that the balloon will attach to.
GeometryIntent oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve);
oLeaderPoints.Add(oGeometryIntent);
// Set a reference to the parent drawing view of the selected curve
DrawingView oDrawingView = oDrawingCurve.Parent;
// Set a reference to the referenced model document
Document oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument;
// Check if a partslist or a balloon has already been created for this model
bool IsDrawingBOMDefined = false;
IsDrawingBOMDefined = oDrawDoc.DrawingBOMs.IsDrawingBOMDefined(oModelDoc.FullFileName);
Balloon oBalloon = null;
if (IsDrawingBOMDefined) {
// Just create the balloon with the leader points
// All other arguments can be ignored
oBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints);
} else {
// First check if the 'structured' BOM view has been enabled in the model
// Set a reference to the model's BOM object
AssemblyDocument oAssDoc = (AssemblyDocument)oModelDoc;
AssemblyComponentDefinition oComDef = oAssDoc.ComponentDefinition;
BOM oBOM = oComDef.BOM;
if (oBOM.StructuredViewEnabled) {
// Level needs to be specified
// Numbering options have already been defined
// Get the Level ('All levels' or 'First level only')
// from the model BOM view - must use the same here
PartsListLevelEnum Level = default(PartsListLevelEnum);
if (oBOM.StructuredViewFirstLevelOnly) {
Level = PartsListLevelEnum.kStructured;
} else {
Level = PartsListLevelEnum.kStructuredAllLevels;
}
// Create the balloon by specifying just the level
oBalloon = oActiveSheet.Balloons.Add(oLeaderPoints,null , Level);
} else {
// Level and numbering options must be specified
// The corresponding model BOM view will automatically be enabled
NameValueMap oNumberingScheme = _InvApplication.TransientObjects.CreateNameValueMap();
// Add the option for a comma delimiter
oNumberingScheme.Add("Delimiter", ",");
// Create the balloon by specifying the level and numbering scheme
oBalloon = oActiveSheet.Balloons.Add(oLeaderPoints,null , PartsListLevelEnum.kStructuredAllLevels, oNumberingScheme);
}
}
}
(I assume this ^ is similar to the API Example? - I haven't checked it yet)
![]()
----------------------------------------------------------------
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example