Home Page > KernelCAD Models > Scene Items
SScene Items
Scene Items
A part of the model which can be rendered in the 3D/2D view is called Scene Item. Items are the common base type for Sections
( Objects) ),
Labels, View Points,
Measurements etc. Items keep Name, Visibility, and Parent
properties, which are managed by IItem
interface. Items, which are not sections (Labels, View Points,,
etc) do not have surface or lines,
i.e. they do not have geometry.
An item can be indepenendent (top-level) or be a child of a section. Items do not
have children.Top-level scene items can be accessed via
IModel.GetItem(). Child items can be
accessed via ISection.GetItem()
Array of all top-level items of any type can also be accessed via query: KernelCAD >GetModel
> IModel >
IPropertyArray2
> GetProperty("ItemArray") >
IArray2..Cast the obejct returned by IArray2.GetAt()
to IItem. Query a specific interface
from IItem to determine the actual type of the interface. For example labels
implement
IText
interface and view points implement
IViewPoint.
Use ISection >
IPropertyArray2
> GetProperty("ItemArray") >
IArray2 query to obtain array of child items of a section
Localized Items
Localized Items are Items, that also
support an enhanced set of properties: "Location", which managed by
ILocation interface, "Frame Type" and "Depth
Position Type", which managed by ILocationEx
interface. 3D Labels are the main example of Localized Items.
Possible Frame Type values are enumerated by
EModelViewFrame. With Frame Type
set to eModelViewFrameGlobal (default) the item is positioned relatively
either the global frame of the model when the item is a top-level one or
relative to the local frame of its parent. Coordinates of the item set via
ILocation
are normal Cartesian coordinates in the above frame.
When Frame Type is set to eModelViewFrameEye the item is positioned
relatively either to the box of the
Viewing Volume, when the
item is a top-level one, or relative to the Bounding Box of the parent
object. The Bounding Box here is the minimal 3D box in
Eye Frame containing the parent object.
Coordinates of the item set via ILocation
are normalized coordinates of the above box: For all coordinates range
[-1,1] is mapped to dimension of the relevant box. Point (0,0,0) corresponds to the center of the box. Point (-1, -1, -1)
is the left bottom back corner of the box. Point (1,1,1) is the right top front
corner and (0.5, 0.5, 1) is the center of the front side of the box. Values
outside the [-1,1] range are valid too and it is the common case. The item will
be located outside the box in this situation.
Depth Position Type describes what
additional, if any, positioning in z direction relative to the viewing plane
(screen) is required. Depth Position Type values are enumerated by
EModelEntity.
When Depth Position Type is eModelEntityUnknown (default) the depth is
determined by coordinates of the item set via ILocation
and no additional action is performed.
When Depth Position Type is eModelEntityObject the item will be
translated in z direction to position it on the top of its parent object. In
this case the item can be obscured by other objects in the model, but will
always appear on the top of its parent. If the item does not have a parent
(top-level item) no z translation is performed.
When Depth Position Type is eModelEntityModel the item will be
translated in z direction to position it on the top of all objects in the model,
so it is never obscured.
See also: LabelEx Sample,
Objects, Labels, IItem, ILocationEx
|