NewDimension-between pipe and wallface in RevitLinkInstance

NewDimension-between pipe and wallface in RevitLinkInstance

SimonaQQ
Advocate Advocate
1,178 Views
3 Replies
Message 1 of 4

NewDimension-between pipe and wallface in RevitLinkInstance

SimonaQQ
Advocate
Advocate

Hello,

I newdimension between the pipe and the face of the wall, and I can create it correctly.
However, when the wall is in revitlinkinstance, an exception "invalid number of references" will be thrown. I understand that the reference of wallface should be converted, so I use reference. Createlinkreference, but it has the same effect, and I used newmodelcurve to create the edgecurve of wallface to ensure that wallface is correct.
So, how should I handle the reference of wallface?

thank you

 ReferenceArray arr = new ReferenceArray();
                                        if (wallInfo.RevitLinkInstance is null)
                                        {
                                            arr.Append(wallInfo.Face.Reference);
                                        }
                                        else
                                        {
                                            var xxx = wallInfo.Face.Reference.CreateLinkReference(wallInfo.RevitLinkInstance);
                                            arr.Append(xxx);
                                        }
                                        arr.Append(new Reference(t));
                                        var dimension = doc.Create.NewDimension(doc.ActiveView, dimensionLine, arr, dimensionTypeList.FirstOrDefault());
0 Likes
Accepted solutions (1)
1,179 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni
Accepted solution

One generic approach to fix the error message that you mention was discussed in 

 

https://thebuildingcoder.typepad.com/blog/2016/04/stable-reference-string-magic-voodoo.html

 

Reformat Stable Representation String for Dimensioning

Joshua Lumley added an important note on using the stable references to create dimensioning in his comment below:

   

When creating dimensions based on objects from linked files, you may see an error message saying Invalid number of references.

   

To resolve that, all you do is rearrange the string a little...

  

Many successful uses of this 'magic voodoo' have been discussed here in the forum since then, so that may help resolve your issue as well.

   

Good luck and Happy New Year!

 

Jeremy

  

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

SimonaQQ
Advocate
Advocate

thank you.
I tried to adjust the string of reference to the format of "fb332d47-8286-4829-bd40-46c26de8ebac-000258d5:0: rvtlink: 2796184:1: surface / 5", which is effective. No exceptions will be thrown, but it is not displayed in the view. I tracked the code and found that the dimension was created successfully, but it is not displayed in the view, and it is not found according to the ID, Moreover, it is not available in the Revit lookup. It is expected that the dimension line exceeds the view range, but it still cannot be displayed and understood after adjusting the position of the dimension line.
Can you help solve the following problem? thank you.

https://forums.autodesk.com/t5/revit-api-forum/how-to-hide-the-boundary-line-of-the-model/m-p/108494... 

0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

Good to hear that the voodoo does its job once again. There are some existing threads on newly created dimensioning remaining invisible. I have nothing to add to Richard's take on the individual edge visibility.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open