Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to dimension Edge with centerline?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
248 Views, 1 Reply

How to dimension Edge with centerline?

Hi,
How to dimension Edge with Centerline? I tried as below but not generating.

Edge Edge1;
object obj1;
Inventor.ObjectCollection Obj;
Obj = invApp.TransientObjects.CreateObjectCollection();
Obj = oPartDoc.AttributeManager.FindObjects("iLogicEntityNameSet", "iLogicEntityName", EdgeName1);
Edge1 = (Edge)Obj[1];
Inventor.Point2d Point1, Point2;
DrawingCurvesEnumerator DrgCurveEnum;
DrawingCurve DrgCurve1 = null;
GeometryIntent wInt1 = null, wInt2 = null;

try
{
if (boolAssembly == true)
{
CompOcc.CreateGeometryProxy(Edge1, out obj1);
DrgCurveEnum = CurrView.DrawingCurves[obj1];
DrgCurve1 = DrgCurveEnum[1];
}
else
{
DrgCurveEnum = CurrView.DrawingCurves[Edge1];
DrgCurve1 = DrgCurveEnum[1];
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


Inventor.Point2d InsPt;
InsPt = invApp.TransientGeometry.CreatePoint2d(CurrView.Position.X + 1, CurrView.Position.Y + 1);

GeneralDimensions oGeneralDims;
oGeneralDims = oSheet.DrawingDimensions.GeneralDimensions;

GeneralDimension oDim;

oDim = (GeneralDimension)oGeneralDims.AddLinear(InsPt, oSheet.CreateGeometryIntent(DrgCurve1), Clines, DimType);

Tags (1)
Labels (3)
1 REPLY 1
Message 2 of 2
Michael.Navara
in reply to: Anonymous

Try this simple code for beginning. ThisApplication is instance of Inventor.Application

Selected curve and centerline must belong to one drawing view

 

var pick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select drawing curve");
var drawingCurve = (pick as DrawingCurveSegment)?.Parent;


pick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCenterlineFilter, "Select centerline");
var centerline = pick as Centerline;

if (drawingCurve == null || centerline == null)
{
    MessageBox.Show("Invalid selection");
    return;
}

var drawingView = drawingCurve.Parent;
var sheet = drawingView.Parent;


var textOrigin = drawingView.Position;
var intentOne = sheet.CreateGeometryIntent(drawingCurve);
var intentTwo = sheet.CreateGeometryIntent(centerline);

var linearGeneralDimension = sheet.DrawingDimensions.GeneralDimensions.AddLinear(textOrigin, intentOne, intentTwo);

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report