Please enable JavaScript to view this site.

Knowledge Bridge Documentation

Help version: 3.3.8

Navigation: Reference  > Geometric Modeling Topics

Using Profiles and Extrusions in kBridge

Scroll Prev Top Next More

 

The notes that follow are details around how profiles and extrusions are handled in kBridge.  These features are available in R.version 0.22.24 and later.

 

Profile

A Profile is a planar region surrounded by an outer boundary and optionally containing inner "hole" boundaries.  It is not legal for holes to intersect each other or the outer boundary.  A boundary is a closed set of curves.

A Profile can be used as a planar region by itself, or it can be used as an input to other objects, similar to Extrusion, which uses it as the defining geometry to be extruded.

A Profile can be created by defining "CurveTo" path operations, or by polygons.  The boundary and holes parameters accept CurveTo lists, and the boundaryPolygon and holePolygons accept Point lists.  You must provide one of boundary or boundaryPolygon; if both are provided, then boundary takes precedence. Similarly, for holes and holePolygons. It is strongly recommended that the outer boundary be described in a counter-clockwise order, and holes are described in a clockwise order.

When using CurveTo operations, the defining geometry must be described in the XY plane, as the CurveTo operations have only an X and Y value for each controlling point.  The resulting Profile will, by default, be created in the local XY plane of its parent.  It can then be positioned via normal positioning rules anywhere from there.

When using the *polygon parameters, the points should be coplanar, but can be defined in any orientation; the resulting profile will exactly match the original orientation.  It can then be positioned via normal positioning rules anywhere from there.

CurveTo Operations

A CurveTo operation is an object consisting of an operator op and a series of X, Y pairs that define 2-dimensional coordinates in the profile plane. These operations all use the concept of a ‘current point’, which is the last point provided, and 0,0 for the first operation. The table below describes the supported operations.

A boundary (or hole) is defined by an array of CurveTo objects of the following form:

{ op: "<operation>" <args> }

Where <operation> is one of moveTo, lineTo, bezierCurveTo, and quadraticCurveTo.  These are not case-sensitive.  The <args> are a function of the operation, shown in the table below.  Like everything in Javascript objects, order is not important.  The names of the args (‘x1’ etc.), as well as "op" are case-sensitive.

Operation

Arguments

moveTo

x1

y1





lineTo

x1

y1





bezierCurveTo

x1

y1

x2

y2

x3

y3

quadracticCurveTo

x1

y1

x2

y2



 

The idea of the curveTo operations is sequential "drawing" of a curve in the plane using the notion of a "current point", which starts at 0,0 and can be changed by the moveTo operation.  Because the current point is known, each operation takes the current point as its first point, and thus a linear segment is specified by only its end point.  The current point then becomes the last point drawn.  This naturally creates an end-to-end chain of curves.  The list for a square with the lower-left corner at the origin is specified as follows.

[{op: "moveTo", x1:0, y1:0},
 {op: "lineTo", x1:1, y1:0},
 {op: "lineTo", x1:1, y1:1},
 {op: "lineTo", x1:0, y1:1},
 {op: "lineTo", x1:0, y1:0}]

 

The arguments do not use kBridge Points; they supply individual coordinates in the imaginary profile plane.

Profiles appear as closed planar "filled" shapes, and can be colored, textured, positioned and so on.

Note that there is no "arcTo" operation.  Arcs can be approximated by quadraticCurveTo.

The Bezier and quadratic operations create a smooth curve using "polar form".  The curve begins and ends at the endpoints, but the curve does not pass through the interior points. Note that the "interior" points of these two curves start at the first argument, because the first point is actually the current point. Note that the quadratic curve is really just a quadratic Bezier curve, and the Bezier is a cubic. See Wikipedia entry at https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Quadratic_curves. The quadratic curve cannot by itself create a curve that turns 180 degrees. You can use multiples if necessary. The cubic (Bezier) form can create a curve that turns more than 180, but not 360 (actually, it can technically do 360, but it generates a very odd line).

Polygons

Polygons are simply arrays of Points.  A Polygon used for a Profile must be closed; that is, the first and last point must be the same.  Polygons can only simulate curves, by using many points to describe the curvature.  Polygons used in Profiles are assumed to be planar; even if they are not, they are "flattened" to be so as part of the process.  Points may not be duplicated, otherwise a "Vertices overlap" error will be generated.  In addition, Polygons must not self-intersect, and holes must be fully inside of the boundary, also not self-intersect, and not intersect each other.

Extrusion

An Extrusion is a linear sweep of a profile along the axis perpendicular to the profile plane. Extrusions form a solid, with the end caps being copies of the profile.

An Extrusion takes a profile which should be of Design Profile, and is the profile to be extruded. It also takes a height.

Extrusions can be colored, textured, positioned as any other object.  The origin of the extrusion is the 0,0 position of the profile, not the center of the object (like Block, Cylinder, Sphere, etc). Note that the Profile is not "consumed" by the extrusion, and will appear as a rendered object unless its rendering is turned off.  In addition, the Extrusion only uses the profile it is given as a reference; the profile model can be positioned anywhere, and the extrusion object will not change.

 

Knowledge Bridge from Engingeering Intent is a full-featured engineering and sales automation environment