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: 

How to display XYZ points in Revit doc

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
3777 Views, 9 Replies

How to display XYZ points in Revit doc

Hello everyone

 

I have a List of XYZ points which I want to display inside my document.

 

I have found out that I need to start a Transaction for this but I don't know what to do inside this Transaction.

 

It should be something like doc.Create.XXX but I don't know what exactly.

 

Can anyone help ?

9 REPLIES 9
Message 2 of 10
jeremytammik
in reply to: Anonymous

Dear vassoulatheo,

 

Yes, sure.

 

Look at the Revit API getting started material:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

Best regards,

 

Jeremy



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

Message 3 of 10
Revitalizer
in reply to: Anonymous

Dear vassoulatheo,

 

a XYZ is an internal geometric object.

It cannot be displayed directly in a Document.

 

To do so, you could create a point-like Revit Family.

If you place a FamilyInstance of your Family on your XYZ's coordinates, your point will be visible in your document.

 

Similarly, this is like the difference between AutoCAD's AcGe versus its AcDb classes.

Some classes are made for calculation, other ones are made for displaying purposes.

 

 

Best regards,

Revitalizer

 




Rudolf Honke
Software Developer
Mensch und Maschine





Message 4 of 10
jeremytammik
in reply to: Revitalizer
Message 5 of 10
Revitalizer
in reply to: jeremytammik

Hi Jeremy,

 

using one's own point based Family would have an advantage over both ModelLines and AVF.

The Family could have a Parameter to store the LocationPoint value of each Instance.

 

Once placed, the "Point" coordinates could be written to the Parameter and thus be read in the properties panel easily.

 

Of course this could be combined with an IUpdater to refresh the displayed Point's coords when moved.

 

 

Best regards,

Revitalizer/Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 10
jeremytammik
in reply to: Revitalizer

Dear Rudi,

 

I fully agree.

 

This approach is also demonstrated by the AnalysisVisualizationFramework DistanceToSurfaces Revit SDK sample.

 

Cheers,

 

Jeremy



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

Message 7 of 10
Revitalizer
in reply to: jeremytammik

Hi Jeremy,

 

I just thought of something like this:

 

Coords.png

 

Just displaying the Coords as a Parameter at the Point object itself.

 

In the SDK sample, values are displayed on copies of the Walls' Faces but not at the Sphere itself.

 

So imagine a situation where you need coords of more than one Point.

In such a case, it would be better to store information at the Point objects themselves.

(Additonally, this way coords are displayed view-independing.)

 

 

Cheers,

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





Message 8 of 10
sam.z
in reply to: Revitalizer

Not sure if this is the best way to do it but this is how I display points in Revit. I have a family that is simply a sphere (a revolve extrusion) and I load this into the project at the XYZ point. I use a FamilyInstance(the sphere) instead of a ModelCurve because its easier, the resulting FamilyInstance is 3d and I dont need to create many unnecessary SketchPlanes.

 

Heres the code:

public class XYZElement : FamilyInstance {

        private static FamilySymbol symbol = null;
        private FamilyInstance thisInstance = null;
private static bool loadRevitFamily(Document doc, string familyFilePath, string symbolName, out FamilySymbol symbol) { bool res = false; symbol = null; try { if (!doc.LoadFamilySymbol(familyFilePath, symbolName, out symbol)) return false; // throw new Exception("Load Family failed: Unable to load " + familyFilePath); res = true; } catch (Exception e) { // Do nothing } return res; } public XYZElement(Document doc, XYZ vertex) { if (symbol == null) loadRevitFamily(doc, "PATH TO FAMILY.rfa", "XYZElement", out symbol); thisInstance = doc.Create.NewFamilyInstance(vertex, symbol, StructuralType.NonStructural); }
}

 

Message 9 of 10
mastjaso
in reply to: Revitalizer

Hi I know this is an old thread but I was wondering if anything has changed since the last time this was posted? I'm in a similar boat where I'm going to have 3D points (XYZ) that I'd like to display to the user. Ideally I'd just like to display these temporarily as I do not want them showing up in other views or cluttering up the model.

 

I mainly ask if anything has changed because i know that Dynamo has a method for doing this but I'm not even sure where to begin looking through the Dynamo source code to find it. In Dynamo if you're in in a python node and you output Point.Create(XYZ).ToProtoType() it will display it in your plan views as well as within the dynamo interface. This behaviour of temporarily showing the point in any open Revit views is ideally what I'd like to emulate, I'm just wondering if anyone can point me in the right direction as to what API methods are used to accomplish this?

Message 10 of 10
mastjaso
in reply to: jeremytammik

This is what I'm talking about with Dynamo. It's clearly found a way to do it. I just can't figure out where in the Dynamo source code it's actually accomplishing this:

DynamoTempPoint.png

 

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