Create Rectangle DetailLine

Create Rectangle DetailLine

SimonaQQ
Advocate Advocate
2,380 Views
3 Replies
Message 1 of 4

Create Rectangle DetailLine

SimonaQQ
Advocate
Advocate

I want to use revitapi to realize the function of creating rectangular detailline in Revit.
The final rectangle detailline is very simple, but the important thing is the dynamic process in the middle. After selecting a point, follow the mouse to draw a rectangle dynamically.
My idea is,
1. Get the coordinates of the mouse, just like the MouseMoveEvent in WinForm.
2. The draw () method is necessary.
3. You may need API in "user32. DLL".
Do you have a demo like this? The demo of drawing line or line segment is the best.
thank you

q1.gif

0 Likes
Accepted solutions (1)
2,381 Views
3 Replies
Replies (3)
Message 2 of 4

rbarreiros.eng
Enthusiast
Enthusiast

I think it would help if you are more clear about your purpose, because if the goal is to "observe the creation of the rectangle", why not just do it using the UI? If you need the use of the mouse to create the rectangle, then you need the UI. I don't see the point in using the API

rbarreiroseng_0-1625737873982.png

 

Message 3 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

They call this a Jig (perhaps Jigging is the verb I don't know), believe it comes from similar functionality in AutoCAD API  that doesn't inherently exist in Revit API.

 

People have used DirectContext API to create them in Revit.

 

https://thebuildingcoder.typepad.com/blog/2020/10/onbox-directcontext-jig-and-no-cdn.html

https://thebuildingcoder.typepad.com/files/kd_revitjigsample.zip

 

 

Message 4 of 4

sragan
Collaborator
Collaborator
I know this is an old post, but I found this by searching for "draw a rectangle with Revit API".

Revit doesn't provide the ability to add direct keyboard shortcuts to draw model or detail rectangles. (Or circles, or ellipses, or splines, or any shape other than a simple line.)

So one obvious workaround would be to create a macro to draw a rectangle, and use a keyboard shortcut to run the macro.

But every time I think about doing that, I realize using the API isn't going to use the dynamic mouse input, or show the "jigging" like the UI would.
0 Likes