Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Hull and Outfitting

View Functions

  • Last UpdatedNov 27, 2023
  • 6 minute read

This chapter describes functions to create and handle views in the current drawing.

view_new(ViewName, <Uvect>, <Vvect>)

The function creates a new view in the current drawing. The projection plane is defined by two non-parallel 3D vectors. The cross product of these vectors defines the direction towards the viewer.

Input Parameters:

ViewName

String

The name of the view (max 25 characters). An empty string is accepted. If view name is not empty and there is another view with such name exception will be raised.

Uvect

Vector3D

The u-vector defining the projection plane (optional; default the x-axis)

Vvect

Vector3D

The v-vector defining the projection plane (optional; default the y-axis)

Returned value:

[0]

ElementHandle

Handle to the created view.

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_NameOccupied

There is already view with specified name.

view_move(ViewHandle, DeltaVec)

The function moves a view by a delta vector.

Input Parameters:

ViewHandle

integer

Handle to the view

DeltaVec

Vector2D

The delta vector

Returned value:

None

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_HandleInvalid

Invalid handle to given view

view_reflect(ViewHandle, Reflect, Centre)

The function reflects a view in a given line.

Input Parameters:

ViewHandle

integer

Handle to the view

Reflect

integer

The reflection line:

1 = the u-axis through given center

2 = the v-axis through given center

Centre

Point2D

Center of reflection (optional; default the center of the circumscribed rectangle of the view)

Returned value:

None

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_HandleInvalid

Invalid handle to given view

view_rotate(ViewHandle, RotAngle, Centre)

The function rotates a view around a given center.

Input Parameters:

ViewHandle

integer

Handle to the view

RotAngle

real

The rotation angle, in degrees

Centre

Point2D

Center of rotation (optional; default the center of the circumscribed rectangle of the view)

Returned value:

None

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_HandleInvalid

Invalid handle to given view

view_scale(ViewHandle, ScaleFac, Centre)

The function scales a view around a given center.

Input Parameters:

ViewHandle

integer

Handle to the view

ScaleFac

real

The scale factor (relative)

Centre

Point2D

Centre of scaling (optional; default the center of the circumscribed rectangle of the view)

Returned value:

None

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_HandleInvalid

Invalid handle to given view

view_identify(ViewName, <PictWinExt>)

view_identify(IdPnt, <PictWinExt>)

The function returns a handle to a view, identified by name or closest to a given point in the current drawing.

Input Parameters:

ViewName

string

The name of the view

IdPnt

Point2D

The identification point

<PictWinExt>

KcsPictWinExt.PictWinExt

Picture element window extension.

Returned value:

[0]

integer

Handle to the view.

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_ViewNotFound

No view was found

view_identify_by_padd_dbref (DbRef)

The function returns a handle to the view in the current drawing, referring to a given element in PADD.

Input Parameters:

DbRef

string

Reference to Db Element in PADD

Returned value:

[0]

KcsElementHandle

Handle to the view

Exceptions:

kcs_ValueError

Invalid parameter value

kcs_DrawingNotCurrent

No drawing was current

kcs_ViewNotFound

The view was not found in the drawing

view_hl_remove(ViewHandle)

The function removes hidden lines from a view.

Input Parameters:

ViewHandle

integer

Handle to the view

Returned value:

None

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_HandleInvalid

Invalid handle to given view

point_transform(ViewHandle, ModelPnt, DwgPnt)

The function transforms a 3D point to a 2D point in a given view.

Input Parameters:

ViewHandle

integer

Handle to the view

ModelPnt

Point3D

The 3D point

Output Parameters:

DwgPnt

Point2D

The resulting 2D point

Returned value:

[0]

Point2D

The resulting 2D point

Exceptions:

kcs_DrawingNotCurrent

No drawing was current

kcs_ValueError

Invalid parameter value

kcs_HandleInvalid

Invalid handle to given view

view_symbolic_new(ViewName, LocPoint, Uvect, Vvect, Forward, Backward, box)
view_symbolic_new(SymbolicView)

The function creates a new symbolic view in the current drawing. The projection plane is defined by two non-parallel 3D vectors. The cross product of these vectors defines the direction towards the viewer. An instance of the KcsInterpretationObject.SymbolicView class can also be used.

Input Parameters:

ViewName

string

The name of the view (max 25 characters). An empty string is accepted. If view name is not empty and there is another view with such name exception will be raised.

LocPoint

Point3D

Location (origin) of view projection.

Uvect

Vector3D

The u-vector defining the projection plane.

Vvect

Vector3D

The v-vector defining the projection plane.

Forward

real

Forward depth of slice for projection in relation to plane defined by location.

Backward

real

Backward depth of slice for projection in relation to plane defined by location and vectors.

box

Box

Axis parallel restriction box for display of models. Any model items or parts of model items outside this box will not be drawn when using the model_draw function.

Returned value:

[0]

ElementHandle

Handle to the created view.

Exceptions:

kcs_DrawingNotCurrent

No drawing was current.

kcs_ValueError

Invalid U and V vectors.

kcs_NameOccupied

There is already view with specified name.

kcs_ArgumentError

Invalid arguments list.

kcs_Error

General error. View can not be created.

kcs_ObjectNotFound

Can't create interpretation object.

kcs_ViewNotFound

View can't be created.

view_projection_get (ViewHandle, Transf3D)

The function retrieves the defined projection for a given view.

Input Parameters:

ViewHandle

ElementHandle

Handle to view

Transf3D

Transformation3D

Instance of KcsTransformation3D.Transformation3D class

Returned value:

[0]

Transf3D

Instance of KcsTransformation3D.Transformation3D class

Exceptions:

kcs_ArgumentError

Invalid parameter type.

kcs_DrawingNotCurrent

No drawing was current.

kcs_HandleInvalid

Given handle is invalid. (for example, doesn't point to view)

kcs_Error

General error

kcs_PythonMethodNotFound

Method in Transformation3D python class not found.

view_projection_set(ViewHandle, uVector, vVector, <DefaultDrawCode>)

The function sets the projection of a given view.

Input Parameters:

ViewHandle

ElementHandle

Handle to view

uVector

Vector3D

U-Vector

vVector

Vector3D

V-Vector

<DefaultDrawCode>

integer

If DefaultDrawCode==, the draw codes stored in the model subview are used. If DefaultDrawCode=1 (default), the default draw codes are used.

Returned value:

None

Exceptions:

kcs_ArgumentError

Invalid parameter type.

kcs_DrawingNotCurrent

No drawing was current.

kcs_HandleInvalid

Given handle is invalid. (for example, doesn't point to view)

kcs_Error

General error

kcs_ModelViewNotFound

View given by handle is not a model view.

view_slicedepth_get (ViewHandle)

The function retrieves the defined forward and backward distance for slice planes in relation to the view plane for a given view. The view can either be a symbolic view or a sliced model view. For a symbolic view forward and backward slice depth from the projection plane is returned. For a sliced model view, a single depth is returned.

Input Parameters:

ViewHandle

ElementHandle

Handle to view

Returned value:

[0]

integer

Return code:

0 - no slice depth returned, view is not sliced

1 - slice depth returned for model view

2 - forward and backward slice depth returned

[1]

real

Slice depth for model view or forward slice depth for symbolic view

[2]

real

Backward slice depth for symbolic view

Exceptions:

kcs_ArgumentError

Invalid parameter type.

kcs_DrawingNotCurrent

No drawing was current.

kcs_HandleInvalid

Given handle is invalid. (for example, doesn't point to view)

kcs_Error

General error

kcs_ModelViewNotFound

Given handle doesn't point to model view

view_slice_planes_get(handle)

This function returns slice planes for symbolic view.

Input Parameters:

handle

ElementHandle

Symbolic view handle.

Returned value:

[0]

Plane3D

Tuple with slice planes represented by 2 instances of Plane3D class.

[1]

Plane3D

Exceptions:

kcs_ArgumentError

Argument Error

kcs_DrawingNotCurrent

Drawing not current

kcs_HandleInvalid

Handle invalid

kcs_ModelViewNotFound

Given handle doesn't specify model view

kcs_GeneralError

Given handle doesn't specify symbolic view

view_symbolic_model_tra(ViewHandle,Transf3D)

The function retrieves the model transformation matrix for a given symbolic view.

Input Parameters:

View Handle

ElementHandle

Handle to symbolic view.

Transf3D

Transformation3D

Instance of KcsTransformation3D.Transformationd3D class

Returned value:

[0]

Transf3D

Instance of KcsTransformation3D.Transformation3D class

Exceptions:

kcs_ArgumentError

Invalid parameter type.

kcs_DrawingNotCurrent

No drawing was current.

kcs_HandleInvalid

Given handle is invalid. (for example, doesn’t point to view)

kcs_Error

General error.

kcs_PythonMethodNotFound

Method in Transformation3D python class not found.

view_restriction_area_get(ViewHandle)

This function returns area that has been defined for a view in a modelling drawing form.

Input Parameters:

ViewHandle

ElementHandle

Handle to the view.

Returned value:

[0]

KcsRectangle2D

Defined area of view.

Exceptions:

kcs_ArgumentError

Invalid parameter value.

kcs_HandleInvalid

Given handle is not valid.

kcs_DrawingNotCurrent

No drawing was current.

kcs_PythonLibraryNotFound

Python library KcsRectangle2D not found.

kcs_PythonMethodNotFound

Error in python definition of KcsRectangle class.

kcs_DoesNotExist

Restriction area for specified view is not defined.

Example:

# Example: kcs_ex_draft17.py

# Example: kcs_ex_draft16.py

# Example: kcs_ex_draft34.py

# Example: kcs_ex_draft30.py

# Example: kcs_ex_draft31.py

Related Links
TitleResults for “How to create a CRG?”Also Available in