Set Normal to create rebar

Set Normal to create rebar

Anonymous
Not applicable
1,063 Views
8 Replies
Message 1 of 9

Set Normal to create rebar

Anonymous
Not applicable

Hi! I'm using the function Rebar, but I have problems when my lines aren't liying in the normal 1,0,0 : 0,1,0 and 0,0,1

 

How to get the normal from this set of coordinates:

 

23.73542   0.65550   2.67900   
23.73542   0.65550   2.15279
23.65644   1.55819   1.55100    ---PA
23.25398   6.15835   1.55100    ---PB
23.17501   7.06104   2.15279
23.17501   7.06104   2.67900

 

I guess that I must be use PA - PB for it but it doesn't work..

 

Any idea about it?

 

Thanks in advance.

 

Luis.

0 Likes
1,064 Views
8 Replies
Replies (8)
Message 2 of 9

jeremytammik
Autodesk
Autodesk

Dear Louis,

 

I suggest that you search the Revit SDK samples globally for the NewRebar function calls and see how they handle it there.

 

Have you done that yet?

 

Cheers,

 

Jeremy



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

0 Likes
Message 3 of 9

Anonymous
Not applicable

Hi Jeremy! ... I'm followong that and my problem is to get the vector (normal).... 

 

 rebar = Rebar.CreateFromCurves(doc, RebarStyle.Standard, RT, null, null, el, setHook.SetNormal, GetCurves(item), RebarHookOrientation.Right, RebarHookOrientation.Right, true, true);

 

 

and It's working when the coordinates set to the plane: 

BasisX

BasisY

BasisZ

 

but when it'not doesn't work!

 

Thanks to answer!

 

Luis.

 

 

0 Likes
Message 4 of 9

Mustafa.Salaheldin
Collaborator
Collaborator

What is "setHook.SetNormal"? and What are you exactly want to do?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 5 of 9

Anonymous
Not applicable

Hi!

setHook.SetNormal is a class that I've créate to evaluate the normal from a set of coordinates..... and another functions.

my function evaluate y the coordinates have a common axis, and return a xyz normal.... I've already created rebars when all coordinates were liying on an axis for example:

 

set of coordinates 1: the normal is new XYZ(0, 1, 0);

3.92706 1.92077 -0.76725
3.92706 1.92077 -0.04750
0.24606 1.92077 -0.04750
0.24606 1.92077 -0.76725 

 

set of coordinates 2: the normal is new XYZ(1, 0, 0);

3.74456 0.01327 -0.76930
3.74456 0.01327 -0.07000
3.74456 7.70327 -0.07000
3.74456 7.70327 -0.76930

 

set of coordinates 3: the normal is new XYZ(0, 0, 1);

3.56151 -0.00073 -0.20350
3.94556 -0.00073 -0.20350
3.94556 7.71727 -0.20350
3.56151 7.71727 -0.20350

 

and so far so good.... I was creating rebars without problema in the element in Revit

 

here is the hardest part

 

-16.28757 7.02486 1.89219
-16.29806 7.08438 1.93684
-16.29806 7.08438 3.31943
-16.27909 6.97681 3.42700
-16.26392 6.89074 3.42700

 

How to get the normal?

 

and about your question! a rebar

 

Thanks!

 

Luis!

 

 

 

 

0 Likes
Message 6 of 9

Mustafa.Salaheldin
Collaborator
Collaborator

Do you calculate the Normal vector from a Surface, Line or manually? Please provide your code and Revit sample project so I may can help.


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes
Message 7 of 9

Anonymous
Not applicable

Hi,

 

About Normal, i set for all case as:

 

normal = new XYZ(1, (-(x2 - x1) / (y2 - y1)), 0);

 

 

0 Likes
Message 8 of 9

FAIR59
Advisor
Advisor

You need 3 points to define a plane (and a normal)

Given 3 distinct points a,b, and c, you can find the normal as the crossproduct between b-a and c-a.

 

XYZ normal = b.Subtract(a).CrossProduct(c.Subtract(a));

 

0 Likes
Message 9 of 9

Anonymous
Not applicable

My Plane set by cordinate

Examble for rebar Beam

 

P1: the first Beam (x1,y1,z1)

P2: the end beam (x2,y2,z2)

 

I set P3 in plane Oxy => P3 (x1,y1,0) or (x2,y2,0)

 

=> my plane (P1,P2,P3)

=> Normar as above for all case

=> Similar column

 

 

 

0 Likes