« Creating a Non-rectangular Slab | Main | Elevation and Section Views »

September 02, 2009

Comments

Hi Jeremy,

How are you?
I've got a question for you.
I've searched but...no idea...

I'd like to change de view with API. For exemple, passing floor plan level0 to the floor plan level1 with the API.
I rode that it could be possible using ShowElement..but how??

Cheers.

Dear Pierre,

Thank you, I am fine, I hope you are as well. I am sorry to say that there is currently no possibility in the API to change a view. A wish list item for this functionality has been recorded. One developer found a really horrible workaround which does actually change the view, but it is only usable for internal debugging and development purposes: if you pass the view back to Revit in the set of elements to highlight in case of an error in an external command and then return 'Failed', the view is displayed together with the error message. Obviously this is not usable for production purposes, but it does constitute a funny and surprising workaround.

Cheers, Jeremy.

Hi, Jeremy, how are you?

Thanks you answer my questions before.

I get questions for you.

The first one is an error called "Expected two different points.". I think this error comes from two model line on superposition. And how can I make two model line on superposiontion without error?

The second one is how to change the color of model line.

Thanks, have a good day.

Dear Owen,

Thank you, I am fine, I hope you are as well. Glad I could answer your questions. I don't know either how to reproduce or how to avoid the error you mention. You might want to have a look at this post on the minimal length of model lines in Revit, though:

http://thebuildingcoder.typepad.com/blog/2009/07/think-big-in-revit.html

Regarding the colour settings, I do not know how to set line colour completely freely. In Revit, things are generally managed in a systematic and parametric manner, which ensures that the model remains well structured. In this case, you can modify model line colours by changing line style settings. I did the following to test this:

- Create a couple of model lines

- For each one of these, right click for the context menu and select Element Properties... > Line style and pick a different line style.

- Right click somewhere in empty space in the current view to bring up the view context menu, and select View Properties... > Visibility/Graphics Overrides > Edit... > Model Categories > Visibility and search for the Lines entry. Click on the little plus sign to display the lines subcategories.

- For each of the line styles you selected above, find the corresponding subcategory and change the colour displayed in its Projection/Surface Lines column.

There are probably other methods as well.

Cheers, Jeremy.

Jeremy,

I am using
Document document = application.NewProjectDocument(string templateFile)

Revit shows that it is loading the template as it does usually when it creates a new document; however, it does not really create the new document.

any idea why?

Regards,
Nadim

Dear Nadim,

I implemented a sample external command CmdNewProjectDoc to test it for you and it works fine for me. Please refer to

http://thebuildingcoder.typepad.com/blog/2009/11/new-project-document.html

Cheers, Jeremy.

Jeremy,

Thank you again for you response.

I guess the NewProjectDocument() method only creates a document but it does not open it.
So it works so far, I got the doucment saved.

I tried to use the app.OpenDocumentFile(doc.PathName) to open it, it does not display the document. Even though it shows it does.

To verify, I subscribed a simple event handler to the app.OnDocumentOpen event (I am using Revit 2009), it did not execute.

It sounds very simple to implement, but I just can’t find what I am missing.

Regards,
Nadim

Dear Nadim,

Yes, correct, NewProjectDocument only creates a document and does not open it.

There is currently no API method at all to make a document current in the Revit user interface. The only workaround I ever heard about is to use Process.Start as described in the comments

http://thebuildingcoder.typepad.com/blog/2008/09/debugging-a-rev.html?cid=6a00e553e16897883301156fc1fed8970b#comment-6a00e553e16897883301156fc1fed8970b

Sorry for the bad news.

Cheers, Jeremy.

Thanks again Jeremy,
It works.

nothing is bad news as long as the RevitAPI developers are planning on fixing it

So basically, the app.OpenDocumentFile() method will open the file but it would not display it :)

Regards,
Nadim

Dear Nadim,

Yes, exactly.

Cheers, Jeremy.

I try to implement a macro in VSTA but cannot get this built. The compiler keeps complaining about an abstract class XYZ. 'Cannot create an instance of the abstract class or interface 'Autodesk.Revit.Geometry.XYZ''
It seems like the XYZ class is defined as an abstract class in the VSTA environment and as a public class in the visual studio environment. One can check this by means of the object browser.
What' the reason for the difference? Can I port it somehow to VSTA?

Dear Wim,

One thing that you need to pay attention to in VSTA is that you cannot use the XYZ class default constructor. You have to use the creation application NewXYZ method instead to create new instances of XYZ objects.

Cheers, Jeremy.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource