PromptForFamilyInstancePlacement - "Encountered an improper argument"

PromptForFamilyInstancePlacement - "Encountered an improper argument"

harrymattison
Advocate Advocate
1,478 Views
9 Replies
Message 1 of 10

PromptForFamilyInstancePlacement - "Encountered an improper argument"

harrymattison
Advocate
Advocate

When I call uidoc.PromptForFamilyInstancePlacement(fs); and the user clicks in the Project Browser, Revit shows a Task Dialog with the message "Encountered an improper argument". This is not helpful. Please do not give this message 

0 Likes
1,479 Views
9 Replies
Replies (9)
Message 2 of 10

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @harrymattison ,

When your code hits the line uidoc.PromptForFamilyInstancePlacement(fs) then it asks the user to place instances of the specified FamilySymbol at a particular location.

During this process, your Project Browser is greyed out which means you can't select the level and when you click on the project browser you will get this error message.

Since your Revit expects the location to place the family symbol you can place the element at a particular location or you can cancel the process.

 

I hope this helps.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 10

harrymattison
Advocate
Advocate

Hi Naveen

 

Thanks for your reply. But the wording of the message is terrible and probably no message is needed. Maybe a bug could be filed to reword or remove it?

Message 4 of 10

stever66
Advisor
Advisor

You can trap error statements like this yourself with a try-catch statement.

 

programmers should always be thinking about ways that a user can cause errors, and if possible, prevent them from terminating the program with a confusing error message.

0 Likes
Message 5 of 10

harrymattison
Advocate
Advocate

This is not an exception that can be caught with a try/catch

Yes, it might be possible to automatically dismiss it with the DialogBoxShowing event.

But the point of my post was to ask Autodesk to fix this.

0 Likes
Message 6 of 10

jeremytammik
Autodesk
Autodesk

Dear Harry,

 

Thank you for your report and sorry for the long delay in picking it up.

 

I totally agree with you that this message is not helpful in the least.

 

I logged the issue REVIT-167892 [PromptForFamilyInstancePlacement plus Project Browser displays "Encountered an improper argument" -- 16974831] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

I hope this helps.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 7 of 10

jeremytammik
Autodesk
Autodesk

Dear Harry,

 

The development team working on the issue REVIT-167892 [PromptForFamilyInstancePlacement plus Project Browser displays "Encountered an improper argument" -- 16974831] ask:

 

Is it possible that we can get a code sample or a macro so that we can easily reproduce the issue on our end?

 

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

 

Thank you!

 

Cheers,

 

Jeremy

 



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

0 Likes
Message 8 of 10

RPTHOMAS108
Mentor
Mentor

Hello @jeremytammik 

 

I've also looked at this issue and it is hard to replicate however I finally managed with the macro attached.

 

If you Run the 'Run' macro and then immediately click and drag over a tree view item in the tabbed Project Browser (not sure why you would willingly do this) then you will get the message noted above.

 

201005a.png

 

However another problem for me at least is that once you prompt for placement you can't cancel to stop placement with esc or cancel (as is noted you should be able to in the RevitAPI.chm). Instead you get this below message and all the items you've placed disappear. You can only get around it by putting it in a structured exception handler (Run_ExceptionHandler). This however doesn't fix or is related to the initial problem above.

 

201005.png

 

 

0 Likes
Message 9 of 10

jeremytammik
Autodesk
Autodesk

Dear Harry,

 

The development team working on the issue REVIT-167892 [PromptForFamilyInstancePlacement plus Project Browser displays "Encountered an improper argument" -- 16974831] determined the need for a code fix and created a new ticket for that:

 

  • REVIT-168667 [PromptForFamilyInstancePlacement plus Project Browser displays "Encountered an improper argument" -- 16974831]

 

Please make a note of this number for future reference.

 

Thank you!

 

Cheers,

 

Jeremy

 



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

0 Likes
Message 10 of 10

jeremytammik
Autodesk
Autodesk

Dear Richard,

 

Thank you very much for your careful research and reproducible case.

 

I added it to the new development ticket REVIT-168667 [PromptForFamilyInstancePlacement plus Project Browser displays "Encountered an improper argument" -- 16974831].

 

Cheers,

 

Jeremy

 



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

0 Likes