transform reference plane

transform reference plane

Yonas89
Collaborator Collaborator
2,011 Views
4 Replies
Message 1 of 5

transform reference plane

Yonas89
Collaborator
Collaborator

Hello, 

I am trying to transform "Top" reference plane  in metric curtain wall panel family template. The default value of plane origin is (0,0,4000) (units are millimeters) my goal is to change this value according user input. 

this code snippet gives me an error that FreeEnd vector  is not perpendicular to normal vector  which is (0,0,-1).

 

 XYZ hBubbleEnd = new XYZ(refPlane.BubbleEnd.X, refPlane.BubbleEnd.Y, 2000/304.8));
refPlane.BubbleEnd = hBubbleEnd;
RvtDoc.revdoc.Regenerate();
XYZ hfreeEnd = new XYZ(0, 0, 2000/304.8);
planeEl.FreeEnd = hfreeEnd; 

this snippet moves the reference plane in my desired height, however it moves it's origin in y value also.

 XYZ hBubbleEnd = new XYZ(refPlane.BubbleEnd.X, refPlane.BubbleEnd.Y, 2000/304.8));
refPlane.BubbleEnd = hBubbleEnd;
RvtDoc.revdoc.Regenerate();
XYZ hfreeEnd = new XYZ(0, refPlane.FreeEnd.Y, 2000/304.8));
planeEl.FreeEnd = hfreeEnd; 

 

any suggestions how to move reference plane only in z axis?

0 Likes
Accepted solutions (1)
2,012 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

Dear Yonas89,

 

Thank you for your query.

 

Sorry, I have studied your two code snippets for a while now, and they do not make much sense to me.

 

It would be safer to define a single constant for 2000/304.8, for better legibility and in order to eliminate possible rounding issues.

 

So, let h = 2000/304.8.

 

You refer to the FreeEnd vector. Is that the vector between hBubbleEnd and hfreeEnd?

 

If so, then:

 

In the first case, it is (0, 0, h) - (refPlane.BubbleEnd.X, refPlane.BubbleEnd.Y, h), which is perpendicular to Z.

 

In the second case, it is (0, refPlane.FreeEnd.Y, h) - (refPlane.BubbleEnd.X, refPlane.BubbleEnd.Y, h), which is not perpendicular to Z unless refPlane.FreeEnd.Y equals refPlane.BubbleEnd.Y.

 

Maybe a simple sketch would help understand better what the situation is, what you are trying to achieve, and how.

 

By the way, to simply answer the question you hint at in the query title:

 

To transform a reference plane, the simplest approach may well be to set up the parameters you require for it and create a new one using the NewReferencePlane method:

 

http://www.revitapidocs.com/2018/1c618038-3801-0f60-9c12-a5923dc87a2c.htm

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

Yonas89
Collaborator
Collaborator

Jeremy, 

thank you for your reply. To answer your first question :  Yes I tried to use single constant  in this case 2000 (mm),  but somehow in Revit my input is scaled by 304.8 . I think it's related with metric template, because I believe Revit is written  in imperial units from ground up.  In the picture I added below, you can see a snapshot in which  freeEnd property value is something not related with metric system.

img.PNG

 

Also, I've read that freeEnd coordinates is a plane origin coordinates. Thus, I assume that if I change z value of freeEnd I should move my reference plane in z, and get what I wanted.

I have no problems with creating new reference plane, but this time I want to modify it and each time I face the problem. In case1 (refPlane.freeEnd =newXYZ (0, 0, h)) I get an error that my freeEnd vector is not perpendicular to reference plane normal or in case2 which is refPlane.freeEnd =newXYZ (0, refPlane.FreeEnd.Y, h), I am able to achieve my desired results in z axis, but it also moves plane in y axis, which I do not want. 

0 Likes
Message 4 of 5

FAIR59
Advisor
Advisor
Accepted solution

you are complicating things too much. To move an element simply use one of these statements:

//refplane.Location.Move(new XYZ(0,0,-2000/304.8));
//ElementTransformUtils.MoveElement(doc,refplane.Id,new XYZ(0,0,-2000/304.8));
Message 5 of 5

Yonas89
Collaborator
Collaborator

@FAIR59

 

thank you! Yes indeed, my initial thoughts was too complicated. 

0 Likes