Hi community! Lately, i’ve been working on C# script that using the wall from linked model gets the dependencies from the wall (doors and windows) and gets the reference plane from the linked family instance as references to use these as an input to create new dimension. However the creation of dimension using family references in link fails. If the family instance is located in current model everything works perfectly, so i guess its the issue of how the references from link are defined in current model. I switched to RiR to test it out, and I’ve got the same results:
1.Creating dimensions from references of family instance in current model works perfectly.
2. Creating dimensions from references of family instance in linked model fails with error “Invalid number of references”
My end goal is to achieve a solution in C#, but I would also like to understand if there is a workaround using RiR, since the logic should be the same.
In attachment I share the Revit sample files (current model and linked model), grasshopper sample file showing the issue, visual studio solution in C# in current state where I’m trying to retrieve the references from linked family instance (reference planes: Left/CenterLR/Right) to add to referenceArray to use as input to Create.NewDimension.
CurrentModel.rvt (5.2 MB)
LinkedModel.rvt (5.2 MB)
LinkFamilyInstanceReferences.gh (19.9 KB)
C# external command
LinkedWallDimensionByDependentFamilyInstanceReferences.zip (117.3 KB)
Here is the way I tried to create dimensions for wall (with dependent elements) in link using C# external command:
And the error I get:
I’ve searched through the different autodesk forums for a solution but nothing seem to help me out with that. Below I will leave some resources i find useful:
https://thebuildingcoder.typepad.com/blog/2016/04/stable-reference-string-magic-voodoo.html
https://thebuildingcoder.typepad.com/blog/2014/07/createlinkreference-sample-code.html
So I think in this topic is devided to 2 parts:
- Finding the solution in RiR way.
- Finding the solution using C# way
I would really appreciate any help on this topic, since I’ve just started learning C# sorry if you find the code messy, I’ve been mostly working in RiR for automations, but would like to understand the logics behind the linked family instance references in C#. Thank you!