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 create Property Line by using API

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
2171 Views, 6 Replies

How to create Property Line by using API

Hello All,

 

I'm creating an addin, that will ask the user to enter XYZ z coordinate points values. Based on those values property line will be created. So far, I'm able to draw the line by using the following code.

 

        private static void CreateLine(Document doc, XYZ startingPoint, XYZ endingPoint)
        {
            Line line = Line.CreateBound(startingPoint, endingPoint);
            using (Transaction lineTransaction = new Transaction(doc, "Creating the line"))
            {
                lineTransaction.Start();
                
                doc.Create.NewDetailCurve(doc.ActiveView, line);
                lineTransaction.Commit();
            }
        }

But the add-in requirement is to create property-lines, which I'm not able to find the proper method in the API that will help me to create property-line. I've come across this thread too [Create Property Line Programatically] but it didn't share the exact solution that I'm looking for. Can anyone share how one can create property lines using API?

6 REPLIES 6
Message 2 of 7
jeremytammik
in reply to: Anonymous

Dear Ali,

 

Have you installed RevitLookup?

 

If not, please do so now, before reading a single word more.

 

With RevitLookup installed, please create the element you require manually through the user interface.

 

Then use RevitLookup to explore the results looking at the Revit database from the API point of view.

 

Here are more ideas on How to Research to Find a Revit API Solution:

 

http://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontol...

 

Cheers,

 

Jeremy



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

Message 3 of 7
Anonymous
in reply to: jeremytammik

I heard about RevitLookup but never used it, thanks to you now I've installed it. RevitLookup is quite an interesting and powerful tool, I wonder why I've waited too long to use it. I'm now investigating it, hope it will be helpful to solve any future problem. Are there any best practices to use RevitLookup?

Message 4 of 7
Anonymous
in reply to: jeremytammik

Dear @jeremytammik

 

I've created the property line on the user interface of revit manually. Then tried to use RevitLookup tool to read values. I'm not sure if i'm missing something, I was not able to find any clue that will help me creating property-line via revit api. 

I checked the RevitDocs, there has one class PropertyLine but that either don't have any method to create a propertyLine. Do you know any way to create propertyLine via API? Thank you for looking into this case.

 

 

Untitled.png

 

 

 

Message 5 of 7
jeremytammik
in reply to: Anonymous

Aha.

 

Either the PropertyLine class exposes a static Create method (new API) , or the creation document class exposes a NewPropertyLine method.

 

Neither of theses is the case, so I do not believe this can be created programmatically.

 

Looking deeper, I see that I discussed this very question already here in the forum:

 

https://forums.autodesk.com/t5/revit-api-forum/create-property-line-programmatically/td-p/5600736

 

A wish list item was raised for it:

 

CF-1612 [Creating and editing Property Line using API].

 

Would you like to add a business case to underline its importance for you and raise the priority with the development team?

 

Please also add a wish to the Revit Idea Station and collect many votes for this functionality, if it is important to you.

 

Alternatively, follow Rudi's advice in the existing thread and see whether you can create copies of existing property lines and modify those to suit your needs:

 

  • Make a copy of an existing PropertyLine.
  • Modify the Location property of the copy, assigning a newly created Line to it.

 

Cheers,

 

Jeremy



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

Message 6 of 7
Anonymous
in reply to: jeremytammik

Thanks @jeremytammik for giving a brief on PropertyLine feature. I'd definitely raise a wish list item for it.  Thanks

Message 7 of 7
kuribaw
in reply to: Anonymous

Posted by mistake.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community