Face Tilt
-
i'am new to Sketchup C/C++ SDK. I am creating a C/C++ program which gives me the geometry of a house model in Sketchup.I want to get the orientation of all the faces in the model and their Tilt. When I say the word 'Orientation' I mean to get the direction of every face relative to the N direction using the Axes in Sketchup and when i say Tilt i mean the degree of each face' tilt in the grey roof in this example.
Can anyone come up with a solution or a method to do that?
Thanks in advance
-
Welcome
Seems you have missed the Develpors section!
http://sketchucation.com/forums/viewforum.php?f=180 -
Welcome
Seems you have missed the Develops forum section! -
@maryamr said:
i'am new to Sketchup C/C++ SDK. I am creating a C/C++ program which gives me the geometry of a house model in Sketchup.I want to get the orientation of all the faces in the model and their Tilt. When I say the word 'Orientation' I mean to get the direction of every face relative to the N direction using the Axes in Sketchup and when i say Tilt i mean the degree of each face' tilt in the grey roof in this example.
Can anyone come up with a solution or a method to do that?
Thanks in advance
For direction, are we talking about the clockwise or counter clockwise angle from North?
Is tilt to be measured from vertical or horizontal.
-
the tilt is to be measured from vertical i want to find the angle between the vertical line and the roof.
'Orientation' I mean to get the direction of every face relative to the Red Axe, for example a face will have orientation of 90 degrees as it is perpendicular to the red axis.
thank you
-
@maryamr said:
the tilt is to be measured from vertical i want to find the angle between the vertical line and the roof.
'Orientation' I mean to get the direction of every face relative to the Red Axe, for example a face will have orientation of 90 degrees as it is perpendicular to the red axis.
thank you
In Sketchup, the red axis is East not North.
That said, here is code that will give you the angles.
mod = Sketchup.active_model ent = mod.active_entities sel = mod.selection faces = sel.grep(Sketchup;;Face) faces.each{|f| if f.normal.z==0.0 ang=X_AXIS.angle_between(f.normal) else ang=Z_AXIS.angle_between(f.normal) end ent.add_text(Sketchup.format_angle(ang),f.bounds.center,f.normal) }
-
thank you so much for your answer, this code works for C/C++ SDK in a C/C++ program or in Ruby ?
as i was all day finding just examples in Ruby and i've never used it before.thnx
-
@maryamr said:
thank you so much for your answer, this code works for C/C++ SDK in a C/C++ program or in Ruby ?
as i was all day finding just examples in Ruby and i've never used it before.thnx
Ruby only inside Sketchup I would guess.
-
i meant the code u suggested is it for Ruby or C/C++ SDK ?
-
Advertisement