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: 

Remove segment from CurtainGridLine

1 REPLY 1
Reply
Message 1 of 2
gigabite
394 Views, 1 Reply

Remove segment from CurtainGridLine

I am trying to remove some of the CurtainGridLine segments that are above the westGateHeight like this:

 

01  XYZ lseg = new XYZ(BasePoints[0][0].X, pointUGateLines[2].Y, westGateHeight);

02
03  CurtainGridLine fLeft = gGeomFront.ActiveGrid.AddGridLine(false, lseg, false);
04
05  CurveArray curvarLeft = fLeft.AllSegmentCurves;
06  CurveArrayIterator citer = curvarLeft.ForwardIterator();
07  citer.Reset();
08  while (citer.MoveNext())
09  {
10      Curve cr = citer.Current as Curve;
11
12      XYZ e0 = cr.get_EndPoint(0);
13      XYZ e1 = cr.get_EndPoint(1);
14
15      fLeft.Lock = false;

16
17      if (e0.Z > westGateHeight)
18            fLeft.RemoveSegment(cr);
19   } 

 

 but in line 18 throws an exception "InvalidOperationException was unhandled by user code"

 this is topmost segment of the line segments which are below him - correctly deleted 

 

 what am I doing wrong? and how to remove the segments? 

1 REPLY 1
Message 2 of 2
mikako_harada
in reply to: gigabite

Hello,

 

Would you like to post a minimum, ready-to-build sample project to reproduce the problem?  It will be easier to take a look. 


Mikako Harada
Developer Technical Services

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