Please enable JavaScript to view this site.

Knowledge Bridge Documentation

Help version: 3.3.8

Navigation: Reference  > K4 Rule Objects > Classes > R

Global R Object

Scroll Prev Top Next More

 

Purpose

When writing rules, it is important to have a convenient access to a library of methods and states that aren’t found on any particular object. While Javascript supports many features and functions, such as those in the Math library, things that are specific to kBridge need their own place.

For this reason, the R (pronounced "big R") object was created. It is one letter because it needs to be brief; it is R because it represents the "Rule" environment. Note that it is case-sensitive (there is no such thing as little "r"), and does not require a this. in front of it.

R is secure.  You cannot add a method or property directly to R, and you cannot replace R.

There are still a few functions which are pre-defined for use in rules, such as the frequently used p() and v() functions.  These appear to be global, but are actually just imported into every rule, method, or supplied parameter body.  We don’t plan to create any more of these, and some lesser-used ones will move to R.

What is on R?

The current content of R can be found in the automated documentation generated from its definition. This content grows with every release. [These documents are linked live (dynamically) in this help file in the subtopics under K4 BaseLibrary Designs and K4 Rule Objects; specific link: R ]

Because R is a normal Javascript object, all of its methods and property names are case-sensitive.

Most content can be categorized as follows (but note that these categories do not appear per se in R, or on the methods of R):

"Missing" Math Content

These are functions that should really be in Javascript, but aren’t.

oradians

odegrees

Geometry Support Content

These are functions that take and return geometry data types, such as Point and Vector.

oAAA – An arbitrary axis algorithm implementation.  See Wikipedia.

omakeBBox – Creates a BBox geometry primitive

omakePlane – Create a Plane geometry primitive

oplaneOfPoints – Finds the plane implied in a set of Points

otransformPoints – Convenience function to use when applying a single transform to a large number of Points

omakeLine – Creates a Line geometry primitive

System Control Content

These functions are used by the system, usually for low-level actions in the BaseLibrary.

oasleep – Determines whether all Required parameters have been supplied to a child.

oerror – Allows the rule author to throw an exception.

onha – Returns the next higher assembly model, skipping over any Group level.

onextHigherInstance – Returns the next higher instance of a particular design.  

Object Reflection Content

These methods allow the rule author to obtain information from the system about objects.

ogetRuleDescriptor – Returns a RuleDescriptor object which contains information about a Rule. Note that this does not return the source of the rule.

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