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 delete unbound curve ?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
1673 Views, 7 Replies

How to delete unbound curve ?

Line line1= Line.CreateUnbound(startPoint, lineDirection);

DetailCurve dc = Document.Create.NewDetailCurve(Document.ActiveView, line1);

Document.Delete(dc.Id);

I added above code in my program. But it is throwing error. Snapshot of error is shown below.

I wanted to delete an unbound line or unbound detail curve. 

Thanks in advance.unbound.PNG

7 REPLIES 7
Message 2 of 8
recepagah12
in reply to: Anonymous

As I know, detail lines have to be bound. You can't create an unbound curve. I tried myself too and the result is the same. You need a bound curve to create a detail line. 

 

I hope this helps,

Recep.

Message 3 of 8
Anonymous
in reply to: recepagah12

OK. If it wont allow then its fine.

But what if I wanted to delete an unbounded 'Line' using API? Or the same logic of Detail Curve also applies to Line ?

Thank you.

Message 4 of 8
recepagah12
in reply to: Anonymous

If you want to delete an object, you can use directly doc.Delete() method. Previous error's source was detail lines can't have an unbounded curve. You can create an unbounded line and Revit won't throw an error. Some Revit objects need specific boundaries so that's why you got an error before. You can create an unbounded line and delete it as you wish.

 

I hope this helps,

Recep.

Tags (2)
Message 5 of 8
Anonymous
in reply to: recepagah12

Thanks for the explanation.

Could you please provide snippet for deleting unbound line.

Document.Delete(ElementId);

As API requires ElementId to pass, I am unable to get same for the line.

Thank you.

Message 6 of 8
recepagah12
in reply to: Anonymous

Do you mean the Line Class in Revit API? If so, you can't delete it because it is not a Revit Element. It is a place holder.

If you look, there is no Id property for Line Class. It is an only geometric representation, you can't see it in Revit Views. If you mean detail or model lines you can take their Id via Element. Id property and delete it.  I hope that clarifies. If you didn't mean that please correct me.

 

Have a nice day,

Recep.

Message 7 of 8
Anonymous
in reply to: recepagah12

I meant Line class only. If Revit API doesn't support this, I should go for some workaround then.

Thank you for all answers and clarifying things.

Have a great day to you also.

 

Gautam

Message 8 of 8
jangohemmes
in reply to: Anonymous

It's not that Revit doesn't support it, it's that a Line instance is not an actual Element in Revit, and therefore does not have an ElementId. It's just a geometric representation of the line between 2 XYZ points. (XYZ objects are also not Elements, and therefore also don't have an ElementId)

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

Post to forums  

Autodesk Design & Make Report