Temporary Graphics of a Line

Temporary Graphics of a Line

atiefenbach
Advocate Advocate
1,479 Views
2 Replies
Message 1 of 3

Temporary Graphics of a Line

atiefenbach
Advocate
Advocate

I've trying to temporarily display a line staring from a PickPoint to the cursor, while the user is selecting their second PickPoint.  I saw this post: Temporary Graphics like GRDRAW o GRVECS  Which is similar to what I'm looking for and I saw mention of the Analysis Framework to create some temporary graphics, but I didn't see anything about lines.  Is there some sample code or another way to do this?

 

Thanks!

Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
0 Likes
1,480 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

Dear Anthony,

Thank you for your query.

Basically, I cannot add anything beyond what was said in the previous post that you pointed to by Joe Ye, Arnošt Löbel and Revitalizer.

http://forums.autodesk.com/t5/Revit-API/Temporary-Graphics-like-GRDRAW-or-GRVECS/m-p/3743360

Revit does not expose any API to create transient graphics, except the Analysis Visualisation Framework AVF.

Its purpose is to display analysis results, e.g. by colouring faces.

I do not believe you can use it to display single lines.

You could use it to display a thin coloured cylinder to approximate a line, if you like.

Here are some meaningful usage examples:

http://thebuildingcoder.typepad.com/blog/2011/12/using-avf-to-display-intersections-and-highlight-ro...

I do not believe you could hook it up to display a dynamic line to the cursor, though.

It could be used to display the thin cylinder once, but probably not to redisplay it dynamically as the cursor moves around.

The only way to achieve that right now would probably be through inofficial unsupported use of the Windows API.

I hope this helps.

Best regards,

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

atiefenbach
Advocate
Advocate

Thanks for your reply!  I'm kinda bummed that I don't have access to that API, because I feel like i woule be a great help for the user to see what I'm going to draw, before I draw it.

 

I was thinking abou it more, and it's probably what you were leading to with the Windows API, but I would think I would be able to generate a new form with the Revit Window's dimensions, have a PictureBox with the same dimensions as the form, set it's BackgroundImage to a screencapture of the Revit window.  Then draw the line in the PictureBox with the MouseMove.  But, you'd have to take into account the coordinates of the form vs. Revit, and the zooming and panning the user might want to do.  That's too much work for what I'm looking to do, but, I feel like this could be a workaround, if someone needed to.

 

Thanks again for the feedback!! 

Anthony Tiefenbach
BIM Manager
HuntonBrady Architects
0 Likes