how can i imagine this line of code sel_comp.definition.bounds.width * Math.cos(sel_comp.transformation.rotz.degrees)
.
here sel_comp is the selected component…
I want to know the clear explanation of this code…
sel_comp
the selected component instance link
.definition
the definition of above instance link
.bounds
the bounds of definition link
.width
the width of bound link
*
multiplication link
Math.cos()
Standard Ruby Math library method to get cos of angle
sel_comp
the selected component instance (as above)
.transformation
the transformation of above instance link
.rotz
not defined in standard SU Ruby API it should be a #def rotz
method in the code somewhere else I guess it will retrieve the rotation angle about Z axis from the instance transformation matrix
.degrees
to convert from degrees to radians. link
Yes correct. But it is actually the Trimble Dynamic Components extension that “monkey patches” the Geom::Transformation
class (as well as many other API classes.)
Certainly you’re right!
Don’t be embarrassed. All those “monkey patches” are still undocumented.