Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NewDimension in family document - Invalid number of references

35 REPLIES 35
Reply
Message 1 of 36
juhanak
3331 Views, 35 Replies

NewDimension in family document - Invalid number of references

Hi,
NewDimension method gives "Invalid number of references" error from Revit 2023 API when using it in Family document. Previous versions of API didn't give this error. Reference array contains 2 valid items. View is active view of family document. View parameter is changed in this API version a little bit so I tried to use also null value with SketchEditScope but I hit to another problem. SketchEditScope is allowed only in project document - not in family document. 

 

Is there any workaround or tips how to add dimension line between 2 Model lines in family document by using Revit 2023 API?

 

I added ZIP file where is a family document and CS source file with AddDimToModelLines method for testing purpose. 

35 REPLIES 35
Message 2 of 36
naveen.kumar.t
in reply to: juhanak

Hi @juhanak ,

 

Could you please try using this below code in Revit 2023?

 

doc.FamilyCreate.NewLinearDimension(doc.ActiveView, line, refArr);

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 36
naveen.kumar.t
in reply to: juhanak

Hi @juhanak ,

 

I tested it and I am able to reproduce the issue at my end.

I have submitted the issue(REVIT-192288) to the Revit Engineering team.

For now, you can use the workaround I shared in my previous response.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 36
juhanak
in reply to: juhanak

Hi,

Thanks for submitting this forward.

 

NewLinearDimension seems to work but only in simple cases.

 

When there is at least two Types used and size of hexagon extrusion is depending of parameter value Revit will give more errors. Just to be clear: API won't give any error in this workaround but application is giving errors when using RFA which is created via API:

 

juhanak_2-1653565480148.png

 

juhanak_1-1653565398061.png

And these gray dimension lines are not editable on UI any more.

 

Maybe this is totally different case but this worked earlier with NewDimension on Revit 2022 and older versions.

Message 5 of 36
naveen.kumar.t
in reply to: juhanak

Hi @juhanak ,

 

Sorry, I don't understand what you are trying to do and what your issue is.
Could you please record a short video explaining your issue and share it with us?
For recording the video you can use Autodesk screencast(it's free).
https://knowledge.autodesk.com/community/screencast 

You mentioned that the gray dimension lines are not editable on UI anymore. I would suggest you check with the Revit product experts. Because if you can't edit in UI, then most probably you will not be able to edit in API too.
Here is the link to the Revit product forum
https://forums.autodesk.com/t5/revit-architecture-forum/bd-p/133 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 6 of 36
nihal
in reply to: juhanak

Further to Juha's comments,

Way we parameterize a nut is having 3 reference lines parallel to profile lines and add dimensions between them with NewDimension() method, then set Label parameter to them. 

2022 video shows model done with 2022 API works correctly. 2023 API done one fails .

In 2023 API NewDimension() method fails and no dimensions are created. So, we used NewLinearDimension()

in 2023 API and dimensions between reference lines and sketch lines are created. But shape cannot be successfully

change with  parameters.

Source Geometry data and code set are identical ( except in 2023 we used NewLinearDimension()).

 

Message 7 of 36
naveen.kumar.t
in reply to: nihal

Hi @nihal ,

 

Thank you for the videos that explain your problem.

I have submitted the videos to the Revit Engineering team.
I will come back to you as soon as I receive a response from them.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 8 of 36
naveen.kumar.t
in reply to: juhanak

Hi @juhanak ,

 

Autodesk Jira can only be accessed internally by Autodesk company people.

REVIT-192288(NewDimension in family document - Invalid number of references)

It looks like the fix will be available in Revit 2024.

As far as I know, you can expect a fix in Revit 2024, but right now I can not 100% guarantee that it will be available in Revit 2024.

I hope this explains.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 9 of 36

Hi,

are you kidding me? That the fix will only be in Revit 2024? This should be fixed in Revit 2023.1!!!

Message 10 of 36

Any update? When will there be a fix!

Message 11 of 36
phn
Explorer
in reply to: naveen.kumar.t

I think I represent more than 100 Revit customers (companies) when I say that a fix is vital and very important!

New projects cannot/will not be started in Revit 2023 because of this - as long as applications cannot work properly. Should be fixed ASAP.

Message 12 of 36

Hi,

Sorry, I have not received any new feedback from the engineering team.
Once again I have asked the engineering team for a response.
I have also asked the engineering team to look into this issue as soon as possible.
I am also checking whether they have any workaround to solve this issue.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 13 of 36
Jan_Back
in reply to: juhanak

We can't use MagiCAD 2023 for Revit 2023 because of this problem. Then we cant upgrade to Revit 2023

Message 14 of 36

Dear Naveen

As acknowledged in this forum we have a VERY fatal bug concerning the API.

However, it seems like the people analysing the reported problems hasn’t understood the seriousness nor the impact with this case, so I will try to explain why this is so important and how it can impact to so many users and companies.

We at MagiCAD Group are developing MagiCAD MEP, an application on-top of Revit. One major benefit for our users is the content libraries that is a main part of our software. The content libraries are used both in MagiCAD for Revit as well as in MagiCAD for AutoCAD. To make that happen we are using platform neutral databases as a storage, and then the actual content/product is generated on-the-fly to the requested format when the user needs it.

Unfortunately, this bug in the Revit API prevents us from generating content without multiple geometrical fatal errors. Errors that are so fatal that they prevent us from releasing MagiCAD for Revit 2023 to our users.

If we are not able to release MagiCAD for Revit 2023, there will be thousands of companies with several thousand daily active users that cannot take Revit 2023 into use. This will have a dramatical impact to the Revit transition from AutoCAD to Revit, especially in the Nordic countries, but also in the Baltic states as well as in Germany, Italy and UK and other countries.

Hopefully this information will make you (Autodesk) understand the severity and the fatal impact of this API bug, so that you will reconsider your decision about this bug and release an immediate fix for the error, this is super URGENT!  Thanks in advance for your understanding.

Message 15 of 36

Dear Autodesk, as Mikael stated above - if you want your make it possible for your customer base in the Nordic/Scandinavian countries to adopt Revit 2023 this must be fixed asap.
As an architectural engineer, we are often the first discipline to initiate the first Revit models in the projects. If this is not fixed asap our MEP engineers cant use or link our Revit 2023 models. We will not initiate a broad roll out of Revit 2023 to new projects for our architects until this is properly fixed. 

Message 16 of 36

Hi,

Sorry for the delay in responding.

I asked the engineering team to look into this issue as soon as possible.

Today, I got a response from the engineering team.

The engineering team is doing their best to resolve this issue in Revit 2023.1

I will come back to you as soon as I receive a response from the Revit Engineering team.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 17 of 36

Thanks a lot for this Naveen, we really appreciate your effort! Looking forward to 2023.1

Message 18 of 36
juhanak
in reply to: naveen.kumar.t

That is a very good news. I am more than happy to test possible pre-release of 2023.1 if you like me to verify the fix.

Message 19 of 36
phn
Explorer
in reply to: naveen.kumar.t

P E R F E C T!
Thanks a lot

Message 20 of 36
mariya_petrova
in reply to: juhanak

Hi Everyone,

 

I am responding on behalf of the engineering team, we have discovered what the cause of the issue is and are working on a fix for 2023.1. First of all, our apologies for this frustration and inconvenience!

 

In short, the problem was introduced due to extra validation added to the Document.FamilyCreate.NewDimension method. That validation makes sure that you should not be able to dimension to curves in sketches, unless the sketch is being edited, which is consistent with how the UI works.

However, this validation was not well coordinated in families. We'll make sure to re-test the new validation fix for both project and families in 2023.1

 

Luckily, there is a workaround, as the method Document.FamilyCreate.NewLinearDimension is not affected and can be used successfully. Please use this interim solution until the fix is available.

 

Let us know if there are issues with the workaround, or any other related problems.

 

Thank you,

Mariya

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community