Message 1 of 8
Angular dimensions in family document.

Not applicable
12-14-2020
02:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello! I trying create family with parametrization via API. And i found some problem with angular dimension.
When i create angular dimension via api and set family label for them. It's not working (got error "Constraint are not satisfied" and parametrization lost).
For information all different that property OwnerView in dimension from UI is null, from api not.
Is there are any chance to solve this problem?
In attached file you can find macros and test it.
Macro code:
public void AngDimTest(){
var ui_doc=this.Application.ActiveUIDocument;
var doc=ui_doc.Document;
var ref1 = ui_doc.Selection.PickObject(ObjectType.Element);
var ref2 = ui_doc.Selection.PickObject(ObjectType.Element);
var modelLn = (doc.GetElement(new ElementId(4703)) as ModelArc);
var arc = modelLn.GeometryCurve as Arc;
var view = doc.GetElement(new ElementId(31)) as View;
using (var t=new Transaction(doc,"Create ang dim")) {
t.Start();
var dim = doc.FamilyCreate.NewAngularDimension(view, arc, ref1, ref2);
dim.FamilyLabel = doc.FamilyManager.get_Parameter("TestAngDimFromAPI");
t.Commit();
}
}