Moving end points of the slanted column

By Katsuaki Takamizawa

If a column’s “Column Style” parameter is “Slanted”, Location property is a curve defined by LocationCurve class. (it is defined by LocationPoint class if “Vertical”) You can then move the column and/or change the slope by modifying the end points of the curve.

Here is the code extracted from Command.cs in MoveLinear SDK sample.You can do the same thing to change end points of the slanted column.

if( element != null )
{
  Autodesk.Revit.DB.
LocationCurve
lineLoc;
  lineLoc = element.Location
as LocationCurve
;
 
if (null
== lineLoc)
  {
    MessageBox.Show(
     
"Please select an element which based on a Line"

     
"MoveLinear"
);
   
return
res;
  }
                 
  Autodesk.Revit.DB.
Line
line;
 
//get start point via "get_EndPoint(0)"
  Autodesk.Revit.DB.XYZ newStart = new XYZ
(
    lineLoc.Curve.get_EndPoint(0).X + 100,
    lineLoc.Curve.get_EndPoint(0).Y,
    lineLoc.Curve.get_EndPoint(0).Z);
 
//get end point via "get_EndPoint(1)"
  Autodesk.Revit.DB.XYZ newEnd = new XYZ
(
    lineLoc.Curve.get_EndPoint(1).X,
    lineLoc.Curve.get_EndPoint(1).Y + 100,
    lineLoc.Curve.get_EndPoint(1).Z);

  //get a new line and use it to move current element
  //with property "Autodesk.Revit.DB.LocationCurve.Curve"
  line = cmdData.Application.Application.
    Create.NewLineBound(newStart, newEnd);
  lineLoc.Curve = line;
}


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading