« Family Instance Materials | Main | Converting between VB and C#, and .NET Decompilation »

October 23, 2008

Comments

Which vector corresponds to north? Is it (0, 1, 0)?

According to a picture in the "Revit 2010 API Developer Guide", the y-Axis represents North/South and the x-Axis represents East/West - alas, it is not quite clear which way...

Dear Daren,

Yes, (0,1,0) is probably right. You can also use the XYZ.BasisY property instead of creating your own new XYZ instance for it.

Cheers, Jeremy.

Hi Jeremy,
Thank you for very useful blog. I create my application with VB VSTA borrowing ideas how to manage Revit objects from your site. One of the lines of your code doesn't work for me.

XYZ v = q - p;

gives en error:
"Operator '-' is not defined for types 'Autodesk.Revit.Geometry.XYZ' and 'Autodesk.Revit.Geometry.XYZ'."

What the reason could be for the issue?

Thanks in advance.
EK

Hm... I found that the error appears when there is a reference to Revit.proxy. But when the RevitAPI is referenced the code is OK. But I can't use the RevitAPI for VSTA, because errors occure in other places of code.

Can you suggest something to get points subtraction?
Thanks,
EK.

Dear EK,

I know nothing of VSTA, I just use the real API. I suspect that 'new XYZ()' does not work in VSTA; you have to use the Application.NewXYZ method instead of the default constructor.

Cheers, Jeremy.

Jeremy,
I was able to resolve the problem, using the Subtract method:

Dim v As XYZ = p2.Subtract(p1)

Sorry for the VB code. I believe you get the idea. This line works fine for me and it looks more reliable then "-" operator, which doesn't work, although it is defined for XYZ object.

Sorry for false alarm and thank you for your great blog.
Regards,
EK

Dear Evgeny,

Congratulations on solving the issue and thank you for sharing the solution.

So is the final result of your experience that you need to use explicit method calls in VSTA instead of built-in operators, e.g. Application.NewXYZ instead of 'new' for creating and Subtract instead of '-' for subtracting?

Cheers, Jeremy.

Hi Jeremy,

I am able to draw the model lines in Revit file using c# code. But the problem ariseing is that when i draw the model line it intersect the walls.
Will u please provide me some tips that How to check the elements collapse with the model lines and change the direction of model line from that position to other side??

Thanks in Advance.
Ritish

Dear Ritish,

One approach that you can use is to determine the intersections of the model line with building elements using the FindReferencesByDirection method, as discussed in a number of posts:

http://thebuildingcoder.typepad.com/blog/2010/06/intersection-between-elements.html

http://thebuildingcoder.typepad.com/blog/2010/06/devcamp-session-on-whats-new.html

http://thebuildingcoder.typepad.com/blog/2010/01/findreferencesbydirection.html

Since I will be going on holiday now, I will not be able to answer any updates for while, so please be patient ... Thank you!

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