DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Expand ModelsModels
Expand DG Kernel ComponentsDG Kernel Components
Expand API ReferenceAPI Reference
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > Deprecated > Deprecated API Reference > Model > Section > ISection2 Search Documentation


ISection2 Interface

GetFrameVisibleFlag
SetFrameVisible
Show
SetColor
Detach
RemoveAll
RemoveChild
Relocate
SaveAs

ISection2 interface has two methods, which control visibility of the local frame of the object (ShowLocalFrame property)

See also: Interface List


HRESULT GetFrameVisibleFlag(VARIANT_BOOL *pbVisible)

Parameters

pbVisible - [out, retval] reference to a Boolean variable, which will receive the current value of the frame visibility flag.


HRESULT SetFrameVisible(VARIANT_BOOL bVisible)

Parameters

bVisible - [in] new value for the frame visibility flag.


HRESULT Show(VARIANT_BOOL show, VARIANT_BOOL includeChildren, VARIANT_BOOL childrenOnly)

Parameters

show - [in] new value for the object's visibility property.

includeChildren - [in] True if all children and descendants of the object are to be included in the operation

childrenOnly - [in] If true the object implementing this interface will not be included in the operation. (useful only if includeChildren is true)

Remarks

The method allows changing visibility property for an object and its descendants in a single call.

HRESULT SetColor(float fRed, float fGreen, float fBlue

Parameters

fRed, fGreen, fBlue - [in] Components of the color.

Remarks

The method a quick shortcut for changing color of the object

HRESULT Detach()

Remarks

Detaches the object from its parent. The object will remain alive and can be used for background calculations, can be added to any model, etc. as long as the application holds at least one reference to it


HRESULT RemoveAll()

Remarks

Deletes all children and their descendants


HRESULT RemoveChild(IItem *item))

Remarks

Removes the item child, which can actually be a entity, and all its descendants


HRESULT Relocate(IFrame* newLocationOrientation)

Remarks

Changes location and orientation of the object without moving children or parent.

The method only copies coordinates from newLocationOrientation without any changes and does not store or use it otherwise. So newLocationOrientation is a read-only (constant) parameter. As the result of that the local frame of the entity will geometrically coinside with newLocationOrientation.

newLocationOrientation normally can be created with IDIObjGenerator.Create((int)EObjectType.eObjTypeFrame)

This method is equivalent to detaching this object from its parent and children from this object, copying newLocationOrientation to the local frame and reattaching the object to the parent and children to this object

Example: The code below expects a model with a cylinder as the first top level object and a cone as its child

VB.NET

Dim iMod As IModel = AxKernCADnet1.GetModel
Dim iSectCylinder As ISection = iMod.GetEntity(0)
Dim iSectCone As ISection = iSectCylinder.GetChild(0)
Dim iSect2Cone As ISection2 = iSectCone Dim iGenerator As IDIObjGenerator = iMod

' Create a standalone frame. A frame defines location and orientation. By default it coinsides with the global axes
Dim iFrm As IFrame = iGenerator.Create(EObjectType.eObjTypeFrame)
'Query other IFrame* iterfaces here like IFrame3 = iFrm to get more functionality like rotation around local axes
iFrm.Rotate(10, 0, 0, 0, 0, 1, 0)
iFrm.SetOrigin(0.3, 0, 0)

iSect2Cone.Relocate(iFrm)

AxKernCADnet1.UpdateView()

C#

IModel iMod = axKernCADnet1.GetModel();
ISection iSectCylinder = iMod.GetEntity(0);
ISection iSectCone = iSectCylinder.GetChild(0);
ISection2 iSect2Cone = (ISection2)iSectCone;

IDIObjGenerator iGenerator = (IDIObjGenerator)iMod;
IFrame iFrm = (IFrame)iGenerator.Create(EObjectType.eObjTypeFrame);
//iFrm created coinsiding with global axes
iFrm.Rotate(10, 0, 0, 0, 0, 1, 0);
iFrm.SetOrigin(0.3, 0, 0);

iSect2Cone.Relocate(iFrm);

axKernCADnet1.UpdateView();

HRESULT SaveAs(char* filePath, IDictionary_KC* options, VARIANT_BOOL* success)

Parameters

filePath- [in] full path. Can have any of the supported extensions

options- [in] Additional options. Can be null

success- [out,retval] The result code.

Remarks

The method allows saving individual objects.

In case filePath has a VRML extension (.wrl or .vrml):

If options is not null and contains string named "TextureImagePath" and its value is a valid file path, it is considered as location of the image for texture of the object (if the object has it). If this path is not specified the image will be saved next to the vrml file.

If the TextureImagePath is provided, it is considered relative to location of the vrml file. Path with ellipses like "..\Image\MyTextureImage.png" is acceptable