Re: Revit 2025 - Macro Manager and Visual Studio 2022
Re: Problem using Python script in Dynamo to change multiple family files
Dear Chris,
Welcome to the Revit API and congratulations on getting all your bits and pieces to work individually.
Your script looks fine to me.
However, unfortunately, it is hard for me to say anything about why it might not work, since I am not conversant in Python or Dynamo. This forum is dedicated to the pure .NET Revit API. Dynamo provides a wrapper around that. To discuss Dynamo-specific questions, you will probably be better of raising this in the Dynamo forum:
Constraint Error When Placing Couplers Between Rebars in Revit API
"I'm encountering a constraint error while using the Revit API to join rebars with couplers. I have three rebars of the same diameter, and they are lapped. I can successfully place a coupler between the first two rebars, but when trying to place a coupler between the second and third, I receive a constraint error.
The first two rebars are hosted by different elements, while the second and third share the same host. I’ve attempted to change the host to resolve the issue, but it hasn't worked. Could you please help me understand why this error occurs and how to fix it? I’ve attached a document and video for further details."
https://forums.autodesk.com/t5/revit-structure-forum/quot-constraint-error-when-placing-couplers-between-rebars-in/td-p/13083374
We tried out with manual approach there we have to align the rebar twice as explained in above but still programmatically we are not able to do it .
Re: 4K DPI scaling for winforms support 2019
Have you looked at The Building Coder article on this from September 2019? Does that help?
Re: Constraint Error When Placing Couplers Between Rebars in Revit API
In the answers to your post in the structural forum, some contributors point out that they need to add constraints, possibly several times over. Have you checked whether these constraints are observable in the Revit database, e.g., by checking the state before and after with RevitLookup or some other database exploration tool?
Re: How to execute BooleanOperations on Revit-Solid by AutoCAD?
UPD: 16.10.2024
Atthemoment, I have managedto union 100% of 1717solids(screenshotbelow)
byuploadingtooff-filesandunion themusingCGAL.Theresultis an outputoff-file(it is in thescreenshotbelow)
P.S: When trying to combine the Solids data through Revit, several dozens exceptions occurred about the inability to perform a Boolean operation on solid.
IcheckedinCGALthat the resultingmeshiscorrect,i.e. it does nothave self-intersections,limits the positivevolume, is correctlyoriented,andisalsoatriangular,not a polygonal mesh.
ThenIdecided to create a Solidbased on the offfileusing the followingmethods:
And:
But I came acrossthefactthatwithanycombinationsandvariants of the
methodwhencheckingin
at the end will be trueonlyin the caseof
In the case of
-alwaysreturnsfalse
I decided that the data was too complex for Revit, and then I created an off-file containing a regular cube:
In this case, I received the correct filled Solid (despite the instruction to create OpenShell).
Based on this, I believe that the main problem lies in the verification:
With such a check, of course, instead of Solid, we will get an Open Shell, as can be seen in the screenshot below:
If you make a check of at least0.1
-alwaysreturnsfalse
Dear @jeremy_tammik can I ask you or someone from the development team to clarify in more detail what the introductory conditions are for the grid source data? Minimum edge lengths, minimum face area, etc? Because at the moment it seems to me that such an accurate geometry in Revit simply cannot be built from such constraints.
Thanks!
Changing the copied element
hi,mytask is to create a legend by copyinganother one anddeletingall the objects from there (since there are noways to create a legendin the revitapiyet).
Ialsoneed to findall the windowsin the legend;then,Ineed to copyanyelement of anylegend;pasteitinto the newlycreatedlegend;changeitstypeso that thiselementbecomes a windowfrom the list;andchangeitsothatitappears in front of us with a frontview.Andso you need to repeat as manytimesas there are windowsin the list. The resultshouldbe a newlegendwithall the windowsfrom the documentrepresented by the frontview.
Unfortunately,I'm stuckhalfwaythrough.Icopied the foundelementinto a newlegendand do notknowhowtochange it,I have been doing this for literallyseveralweeksnowand have not made anyprogress.I am asking for yourhelpinthisseeminglyeasytask.I will attachmycodebelow, I will begrateful for anyhintandhelp,thank you in advance.I am notanativeEnglishspeaker, so I canmakevarioustypes of mistakes,forwhich I apologize.
Re: Changing the copied element
Have you verified you can do this manually? I was not aware you could show modeled elements in a Legend, but then i don't use Legends very often. Second, is it a code failure, or is it just not changing the element type?
Re: Changing the copied element
As the specific parameters (attached to elements) used to do internal Revits "Stuff" isn't well documented use RevitLookup to inspect the elements and which parameters it that that (might) does what you need.
Looking into a LegendComponent, it's not a specific class, so no direct properties on the Class to use. (see: https://www.revitapidocs.com )
So inspecting a placed LegendComponent reveals the following builtin parameters:
BuiltinParameter.LEGEND_COMPONENT, which is of the ElementId datatype and takes the Id of a Type (wall type etc..) to determine which family type to show
BuiltinParameter.LEGEND_COMPONENT_VIEW, seems to be the one to determine the viewdirection, it's a integer type so change some Legendcomponents and see which value belongs to which direction (seems -5 = Section)
BuiltinParameter.LEGEND_COMPONENT_LENGTH, looks like this one controls the length of the component and is a double (length type).
- Michel
Re: 4K DPI scaling for winforms support 2019
Without reading Jeremy's article (because i'm feeling rather lazy) rather than a programmatic solution, have you tried messing with the Compatibility settings within your Revit icon?
Re: RevitID to Sheet
There is no direct correlation between element in a view and the sheet element. Rather you need to grab all sheets, filtering as necessary, grab all placed views, make each view active, then grab all elements in the view. Heres some Pseudo code to maybe help:
'
Py Revit Json checkmark
I am creating a pop up where a user can save category, instance parameter, and type parameter. I save the selections with the values in a json. I then prompt the user to name their selection so that next time they can see what they saved and load it in if they like. The issue is that when a user selects the previous saved selections it does not check mark off the selections made, even though it reads in the json. The following is my code and I believe the issue is from function select_manual_check:
Revit 2025 and Visual Studio Code DocumentOpened event
I'm very green with C# and am testing some code but am encountering an error when building the solution, I have a variant of this code running under Revit 2022.
The error I'm getting is
C:\ProgramData\Autodesk\Revit\Macros\2025\Revit\AppHookup\Project_FilePath\Source\Project_FilePath\
ThisApplication.cs(36,5): error CS0127: Since 'ThisApplication.DocumentOpenedHandler(object?, Docum
entOpenedEventArgs)' returns void, a return keyword must not be followed by an object expression [C
:\ProgramData\Autodesk\Revit\Macros\2025\Revit\AppHookup\Project_FilePath\Source\Project_FilePath\P
roject_FilePath.csproj]
.
Seeking Advice
Problem statement:
We have developed a plugin for dimensioning and tagging. Please see the queries below.
1) We are having difficulty identifying the nearest elements based on their category.
2) In tagging, we need to obtain the extents of the tag text.
3) We need to identify any overlapping tags. Is there a solution to this?
4) In tagging, is it possible to have the tag leader or leader as a curve?
5) Is it possible to identify the connected elements of structural framing?
6) We are unable to obtain the center reference of the shaft opening. Is there a solution for this?
Autodesk Revit : 2022 version.
Re: Py Revit Json checkmark
So, your question has nothing to do with the Revit API, does it? Maybe it would be better to raise this in a forum discussing Python, or the UI functionality that you are using?
Also, I do not see any function in your code named select_manual_check...
Re: Revit 2025 and Visual Studio Code DocumentOpened event
Hi @Eduardo.SaezDRTV4 ,
It looks like the error you're seeing is due to a return statement in a method that is declared to return void
.
Re: Revit 2025 and Visual Studio Code DocumentOpened event
Welcome to C# and the Revit API.
Actually, the error message says exactly what the problem is. If I pare it down and reformulate it a bit, it says, "your method DocumentOpenedHandler is a void function, so the return keyword must not be followed by an object expression". In other words, you cannot write return Result.Succeeded;
; you have to leave out the Result.Succeeded
and write just return;
However, I would also suggest that if you are running into issues like this, it might make sense to play around a bit more with just pure C# in tutorials or online courses before starting to address things in the Revit API, where you will be confronted and confused by the combination of Revit API quirks and C# issues.
This forum is (mostly) dedicated to discussing the Revit API, and not C# beginner issues.
Good luck and have fun!
Re: I would like to know the version of a rvt file before opening the file in revit
You can have simple solution by using Revit Extractor : https://github.com/chuongmep/revit-extractor
Make sure you installed package and us right command :
Re: I would like to know the version of a rvt file before opening the file in revit
Another way for you in case you don't need to use python, and just want to use it, let's download this msi installer :
https://www.mediafire.com/file/3urx5nj46wfc80y/RevitCheckerVer1.0.0.msi/file
This is step to see it :
- Go to your revit file
- Right click in to file and choose revit version
- Bump, you will see version of file in popup.
Re: Seeking Advice
Dear Timu,
Congratulations for having already developed your add-in. Mos of the quesrtions you raise have been discussed here in the past, some of them quite often. I would suggest searching for existing answers one by one and adding to those threads if anything remains unclear. Here are some quick takes:
- Use a filtered element collector in combination with a category and a bounding box intersection filter.
- Discussed previously many times.
- Ditto.
- Can you achieve this manually in the UI? How? If not, the API will hardly add any functionality beyond the UI possibilities.
- Yes. Discussed previously.
- Yes, certainly. Well, the centre point, anyway. Does it necessarily have a reference?