Does Revit2015 Platform API Developers Guidelines exists?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
To coding for revit2014 i used Revit2014 Platform API Developers Guidelines.
A few weeks ago I upgrade to revit2015 and discover that some examples from pointed above guidelines don’t work and parameters of some methods were changed.
For example (Code Region 29-14: Adjusting the analytical model in relation to another element) don't work in revit2015 exeption - “An internal error has occurred.”
public Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,ref string message,ElementSet elements)
{
m_application = commandData.Application;
m_document = m_application.ActiveUIDocument;
try
{
Selection sel = m_document.Selection;
Reference refAnalytical = sel.PickObject(ObjectType.Element,"Please Pick the source analytical line to adjust to");
Element el = m_document.Document.GetElement(refAnalytical);
AnalyticalModel aModel = el.GetAnalyticalModel ();
// in original example wasAnalyticalModel aModel = doc.GetElement(refAnalytical) as AnalyticalModel;
Curve aCurve = aModel.GetCurve();
// Get the reference of the start point
AnalyticalModelSelector aSelector =new AnalyticalModelSelector(aCurve);
aSelector.CurveSelector =AnalyticalCurveSelector.StartPoint;
Reference refSource = aModel.GetReference(aSelector);
// Pick the source analytical line to be adjusted
Reference refAnalytical2 = sel.PickObject(ObjectType.Element,"Please pick the source analytical line to be adjusted");
el = m_document.Document.GetElement(refAnalytical2);
AnalyticalModel aModel2 = el.GetAnalyticalModel();
// in original example wasAnalyticalModel aModel2 = doc.GetElement(refAnalytical2) as AnalyticalModel;
// Get the reference of the start point
Curve aCurve2 = aModel2.GetCurve();
AnalyticalModelSelector aSelector2 =new AnalyticalModelSelector(aCurve2);
// aSelector2.CurveSelector = AnalyticalCurveSelector.StartPoint;
// Can be adjusted to the middle of the line if WholeCurve is used
aSelector2.CurveSelector =AnalyticalCurveSelector.WholeCurve;
Reference refTarget = aModel2.GetReference(aSelector2);
// Adjust the analytical line
bool res=aModel.ManuallyAdjust(refSource, refTarget);
//in original example aModel.ManuallyAdjust(refSource, refTarget, true);
return Result.Succeeded;
}
catch (Exceptions.OperationCanceledException)
{
// Selection Cancelled.
return Result.Cancelled;
}
catch (Exception ex)
{
// If any error, give error information and return failed
message = ex.Message;
return Result.Failed;
}
}
}
I try to find Revit2015 Platform API Developers Guidelines without success, Does it exist anywhere?