Happy New Year!

Welcome back after the break and

Happy New Year!

I have already been busily answering cases for the past few days.

Here are two of the topics that came up:

Before getting to those, let me present a photo and an interesting syntactic challenge from my non-technical activities in the past ten days.

I spent some time after Christmas in the hills in Toggenburg, and we had some very fine weather and views:

Winter scene in Toggenburg

The syntactic challenge is perfectly normal English, and simply consists in understanding the following valid sentence:
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.

For a few hints, please refer to this interesting

explanation on Wikipedia
.

Back to the Revit API…

Access to Model Arc Centre Point Reference

Question: How can I obtain a valid reference to a model arc centre point?

Given an extrusion element in a family file, you can access its sketch and individual geometric sketch curve elements like this in managed C++:


Extrusion ^ext = createExtrusion(...)
CurveArrArray ^sketchCvArrArr = ext->Sketch->Profile;
for each( CurveArray ^oneCvLoop in sketchCvArrArr )
{
for each( Curve ^oneSketchCv in oneCvLoop )
{
// ...
}
}

The curve end point references are provided by the Curve::EndPointReference property and can be used to constrain profile curves to reference planes, for example.

However, we could not find a way to obtain a centre point reference for arc sketch curves.

The ModelArc class provides a CenterPointReference property.

However, attempting to cast a geometric curve to a model curve obviously returns a null result.

Our goal is to lock the arc centre to the intersection point of two reference planes.

Can you suggest any way to achieve this?

Answer: Looking at the Model Curve and Curve class hierarchy shows that the direct conversion is not possible.

The CenterPointReference property is declared at CurveElement, so ModelCurve will also have it.
You can create a ModelArc with a geometric arc (Curve), but it will appear in the project (be added to the database).

The Curve itself is in-memory only.
From a Curve, you can call Document.Create.NewModelCurve, which will add a new model curve and modify the document.
However, that will still not provide the reference that you are after.

On the other hand, the geometric sketch curve itself also provides a Reference property, and that can be used to access the existing model curve in the sketch.
From that, you can obtain the centre point reference, in case of an arc element.

Here is a snapshot of the debugger showing code that retrieves the sketch model curve in order to get the model arc centre point reference that can be used to create a radial dimension:

Getting element by reference

This method is perfectly reliable, since Document::GetElement(Reference) always returns the actual model curve element itself.

<!–

The CenterPointReference of the geometry arc eliminates the need of getting sketch model curves from the document as geometry curves already contains Reference and End Point References.

–>

API-generated Schedules on Sheets Lack Title

Question: I am working on a project that involves building schedules and placing them on sheets programmatically.
The ones I create with the API don’t include a title.

The issue can be illustrated with the Revit SDK ScheduleCreation sample project.

Here is a snapshot of a manually created schedule:

Schedule created manually

The programmatically generated one looks like this:

Schedule created through API

Answer: Let’s start by reiterating the history of this feature:
the Schedule API was initially introduced in

Revit 2013
,
enabling an add-in to create schedules and add or remove fields and filters, control sorting and grouping, add, read, place a schedule on a sheet or modify its placement, and access all the schedule data, e.g. to export to a text file.

In

Revit 2014
(fourth
bullet item), it was enhanced to provide formatting control and read-write access to individual data items.
More details on the feature are provided there by the Revit 2014 DevDays presentation, recording and sample code.

It is also discussed in the overview of the ‘ViewSchedule changes’ in

What’s New in the Revit 2014
.

The Schedule API functionality is illustrated by the Revit 2013 ScheduleCreation that you tested and the Revit 2014 ScheduleAutomaticFormatter and ScheduleToHTML SDK samples.

Now, to address your actual question:

The issue you encountered is known and was resolved in

Revit 2014 update release 1
:

  • Creates the default schedule header automatically when schedules are created by ViewSchedule.Create methods.
  • Allows ViewSchedule.GroupHeaders to succeed even if the schedule is not active.

Have you installed the update release 1, or, better still, 2?

I would recommend installing each update release as soon as it becomes available, if you can.

Response: Applying the Update Release 2 patch fixed the title problem.

Thank you, and I will add keeping up on these to my New Year’s resolutions!

Raring to go on towards new challenges in the New Year


Comments

6 responses to “Happy New Year!”

  1. hello Jeremy good year
    I honestly enjoyed the class.
    I can not seem to download the class cp333-1 to test
    thank you for giving me a link to download it

  2. Dear Ahssi,
    Do you mean the class CP333-1 ‘Leveraging the Tail End of the BIM Life Cycle with APIs’ by Don Rudder from the Revit API Track at Autodesk University 2010?
    Wow.
    That is a long time ago.
    I would suggest to forget it.
    Instead, how about simply searching for Don Rudder’s more up-to-date classes at AU?
    http://au.autodesk.com/au-online/classes-on-demand/search?full-text=don+rudder
    This returns CP1749 ‘Taking the Revit API to the Next Level as a Beginner’ by Don Rudder from 2012:
    http://au.autodesk.com/au-online/classes-on-demand/class-catalog/2012/autodesk-revit-for-architects/taking-the-autodesk-revit-api-to-the-next-level-as-a-beginner
    Learn how to simplify your life and get quicker results when you use the Autodesk Revit API to automate or extend the functionality of Revit software. There are obvious cost savings associated with automation, but there’s an even larger ROI when even automation can be automated.
    Cheers, Jeremy.

  3. hello
    thank you to answer me.
    the class cp 333-1 2010 api uses dwf sharing plan.

  4. hello
    you is it possible to find this class in your archive.
    you will be a great help for me
    thank You

  5. Dear Ahssi,
    I do not have a copy, sorry.
    I would suggest writing to Don Rudder and asking him.
    Cheers, Jeremy.

  6. hello
    I contacted autodesk no trace of this class.
    thank you

Leave a Reply to ahssiCancel reply

Discover more from Autodesk Developer Blog

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

Continue reading