Angular dimensions in family document.

Angular dimensions in family document.

Anonymous
Not applicable
1,020 Views
7 Replies
Message 1 of 8

Angular dimensions in family document.

Anonymous
Not applicable

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();
            }

           
		}



0 Likes
1,021 Views
7 Replies
Replies (7)
Message 2 of 8

RPTHOMAS108
Mentor
Mentor

I've encountered the same issue. Excellent observation regarding OwnerViewId.

 

So we are saying: if you create an angular dimension via the API it forces us to associate the dimension with a view (view argument required). This shouldn't be a problem but for some reason if you then try in the UI to set the label of this API created dimension to a parameter it posts this 'constraints not satisfied' failure.

 

Whilst the angular dimension which is wholly created in the UI with exactly the same references (noted in RevitLookup) does not.

 

Incidentally I tried breaking the Owner View relationship by moving dim and using a 3D view but the first did nothing and the second created an invisible dimension (even unseen in the 3D view specified).

Message 3 of 8

jeremytammik
Autodesk
Autodesk

Oh dear, that sounds problematic.

 

Thank you very much, Richard, for the confirmation and further details.

 

Could you please submit a minimal reproducible case that we can share with the development team for analysis and possible rectification:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 8

net.k.kiselev
Contributor
Contributor
Hello Jeremi, and sorry for long response. I provided all required information with macros in attached revit file.
0 Likes
Message 5 of 8

jeremy_tammik
Alumni
Alumni

Thank you for the update and no problem with the delay. However, unfortunately, I see no attachments, no Revit file nor anything else. 

 

Update: Oh sorry, I guess I misunderstood. You mean in the original attachment, of course. Fine, brilliant, I'll take a look at that then.

 

Cheers,

 

Jeremy

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 8

jeremy_tammik
Alumni
Alumni

OK. This is apparently a known issue, reported in 2017 in 

 

http://forums.autodesk.com/t5/revit-api/api-constraint-management/m-p/6021191

 

The development ticket number is REVIT-87238 [[API] [AngularDim] Versus manual difference defining angular dimension constraint in family -- 11486046].

 

I added notes of your observations to it and asked the development team to take a fresh look at it.

 

Thank you both very much for your reports, Kirill and Richard.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 8

FAIR59
Advisor
Advisor

there is a workaround: Just "copy / paste" the newly created dimension to the same view using the ElementTransformUtils. This gives you a non-viewspecific dimension .

using (var t=new Transaction(doc,"Create ang dim")) {
            	t.Start();
            	var dim = doc.FamilyCreate.NewAngularDimension(view, arc, ref1, ref2);
            	var copies = ElementTransformUtils.CopyElements(view,new List<ElementId>(){dim.Id},view,Transform.Identity,new CopyPasteOptions()).ToList();
            	doc.Delete(dim.Id);
            	var dim2 = doc.GetElement(copies.FirstOrDefault()) as Dimension;
            	                                                
            	dim2.FamilyLabel = doc.FamilyManager.get_Parameter("TestAngDimFromAPI");
            	
            	t.Commit();
            }
0 Likes
Message 8 of 8

Kisli89
Enthusiast
Enthusiast
Thanks for this solution! It's helped cover some cases.
But this workaround not worked for profile families.