Message 1 of 5
Trouble creating dimension from EdgeProxy (C#)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a dimension in a drawing off of a named edge in the part and I keep getting an error when I try to get the DrawingCurveEnumerator. Everything prior to that seems to work fine. I get the proper proxy which shows up in my debugger. If I don't filter the DrawingCurve property and just pick the first curve the dimension places correctly. It is exclusively when I try to filter the DrawingCurve property that I get an error.
for(int i = uniqueBaffles; i > 0; i--)
{
Point2d sideViewPoint = DrawingFuncts.LERPBox(usableBox, 0.75, 1 - (i * availableHeight) + (availableHeight * 0.5));
ComponentOccurrence componentOccurrence = assemblyDefinition.Occurrences[i];
Document baffleDocument = componentOccurrence.ReferencedDocumentDescriptor.ReferencedDocument;
DrawingView sideView = drawingViews.AddBaseView((_Document)baffleDocument, sideViewPoint, scale, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle);
if (firstBaffle)
{
DrawingFuncts.ScaleViewByPercentage(sideView, 0.4, availableHeight);
scale = sideView.Scale;
firstBaffle = false;
double dimensionGap = 3;
ObjectCollection topEdgeCollection = baffleDocument.AttributeManager.FindObjects("iLogicEntityNameSet", "iLogicEntityName", "Top Edge");
Edge topEdge = (Edge)topEdgeCollection[1];
object topEdgeProxy;
componentOccurrence.CreateGeometryProxy(topEdge, out topEdgeProxy);
//Invalid Argument error thrown here
DrawingCurvesEnumerator drawingCurveEnumerator = sideView.DrawingCurves[topEdgeProxy];
DrawingCurve topEdgeCurve = drawingCurveEnumerator[1];
GeometryIntent topEdgeIntent = firstSheet.CreateGeometryIntent(topEdgeCurve);
Point2d dimensionPoint = transientGeometry.CreatePoint2d(sideView.Center.X, sideView.Top + dimensionGap);
firstSheet.DrawingDimensions.GeneralDimensions.AddLinear(dimensionPoint, topEdgeIntent);
}
}