C# Get location point of schedule on sheet in Revit

I cannot seem to get the location point of a schedule on a sheet.
I’ve put the origin in as a catch… and all the schedules are going to that point.

  XYZ position = new XYZ(0, 0, 0);  // Default position 

  // HOW do I get the location point of the schedule on the sheet???
  LocationPoint locationPoint = scheduleInstance.Location as LocationPoint;
  if (locationPoint != null)
  {
      position = locationPoint.Point;  // XYZ coordinates of the schedule on the sheet
  }

Are you sure you’re providing a ScheduleSheetInstance and not just a ScheduleView? It’s easy to grab the ScheduleView and forget about the placed instance.

4 Likes

No, I am not sure.

I assumed because it was making a copy it was getting the instance… But now you’ve said that I realise it doesn’t follow.

Thanks, I’ll have another look tomorrow. :slight_smile:

Yay!

I was trying this:

LocationPoint locationPoint = scheduleInstance.Location as LocationPoint;
if (locationPoint != null)
{
    position = locationPoint.Point;
}

Which I thought was getting the instance (apparently it wasn’t) …

Now doing this:

// Let's try a bounding box :D 
BoundingBoxXYZ boundingBox = scheduleInstance.get_BoundingBox(originalSheet);
if (boundingBox != null)
{
    // min point of bounding box
     position = boundingBox.Min;
}

Which has, in my single test so far, worked. Yay!!!

Now the question is, do I allow people to copy draughting views or should I discourage their use :smiley:

4 Likes