How to delete unbound curve ?

Anonymous

How to delete unbound curve ?

Anonymous
Not applicable
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

0 Likes
Reply
Accepted solutions (1)
1,675 Views
7 Replies
Replies (7)

recepagah12
Advocate
Advocate

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.

Anonymous
Not applicable

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.

0 Likes

recepagah12
Advocate
Advocate

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.

Anonymous
Not applicable

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.

recepagah12
Advocate
Advocate
Accepted solution

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.

0 Likes

Anonymous
Not applicable

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

0 Likes

jangohemmes
Participant
Participant
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)
0 Likes