QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
library.js File Reference

Functions

void activateFont (void fontComboBox, void fontName)
void addActionsToWidgets ()
void addDirtyFlag (void title)
void coordinateToString (void coordinate, void decimals, void relative, void polar)
 Formats the given coordinate (RVector) into a locale aware string.
void copyDirectory (void sourceDirPath, void destDirPath)
 Copies a directory recursively.
void deepCopy (void obj)
 Clones the given object (deep copy).
void deg2rad (void val)
 Converts degrees to radiant.
void entityTypeToString (void type, void plural)
 Converts the given entity type enum to a human readable, translated string.
void findFile (void dirPath, void fileName, void ignoreDirs)
 Finds a file recursively.
void fixSymbolTableName (void name)
 Fixes the given symbol table name (e.g.
void getAbsolutePathForArg (void file)
void getClipboard ()
void getCurrentDateTime (void format)
void getEntityTypeProperties (void type)
void getInBlockEasyDragAndDrop (void entity)
void getInBlockTextEdit (void entity)
void getMainWindow ()
void getTypeOf (void v)
 Check the real type of the given object.
void getVersionNumber (void major, void minor, void revision, void build)
void getWidgetPath (void widget)
 Gets the widget path for the given widget.
void getWidgets (void widget, void ca)
 Gets all child widgets and stores them in an array.
void hasPlugin (void name)
void initFontComboBox (void comboBox)
 Insert CAD fonts at the top into the given font combo box.
void isArcEntity (void obj)
 Checks if the given object is an arc entity.
void isArcShape (void obj)
 Checks if the given object is an arc shape.
void isArray (void obj)
 Checks the type of the given object.
void isAttributeDefinitionEntity (void obj)
 Checks if the given object is an attribute definition entity.
void isAttributeEntity (void obj)
 Checks if the given object is an attribute entity.
void isBlockReferenceEntity (void obj)
 Checks if the given object is a block reference entity.
void isBoolean (void obj)
 Checks if the given object is a valid boolean value.
void isCircleEntity (void obj)
 Checks if the given object is a circle entity.
void isCircleShape (void obj)
 Checks if the given object is a circle shape.
void isComboBox (void obj)
 Checks the type of the given object.
void isDimAlignedEntity (void obj)
 Checks if the given object is an aligned dimension entity.
void isDimAngularEntity (void obj)
 Checks if the given object is an angular dimension entity.
void isDimDiametricEntity (void obj)
 Checks if the given object is a diametric dimension entity.
void isDimensionEntity (void obj)
 Checks if the given object is a dimension entity of any kind.
void isDimLinearEntity (void obj)
 Checks if the given object is a linear dimension entity.
void isDimOrdinateEntity (void obj)
 Checks if the given object is an ordinate dimension entity.
void isDimRadialEntity (void obj)
 Checks if the given object is a radial dimension entity.
void isDimRotatedEntity (void obj)
 Checks if the given object is a rotated dimension entity.
void isDirectedShape (void obj)
 Checks if the given object is a directed shape.
void isEllipseArcShape (void obj)
 Checks if the given object is an ellipse arc shape.
void isEllipseEntity (void obj)
 Checks if the given object is an ellipse entity.
void isEllipseShape (void obj)
 Checks if the given object is an ellipse shape.
void isEntity (void obj)
 Checks if the given object is a graphics entity.
void isEntityType (void obj, void type)
 Checks if the given object is an entity of the given type.
void isFullEllipseEntity (void obj)
 Checks if the given object is an ellipse entity and represents a full ellipse.
void isFullEllipseShape (void obj)
 Checks if the given object is a full ellipse shape.
void isFunction (void obj)
 Checks if the given object is a valid function.
void isHatchEntity (void obj)
 Checks if the given object is a hatch entity.
void isImageEntity (void obj)
 Checks if the given object is an image entity.
void isLeaderEntity (void obj)
 Checks if the given object is a leader entity.
void isLineBasedEntity (void obj)
 Checks if the given object is a line, xline or ray entity.
void isLineBasedShape (void obj)
 Checks if the given object is a line based shape.
void isLineEntity (void obj)
 Checks if the given object is a line entity.
void isLineShape (void obj)
 Checks if the given object is a line shape.
void isNull (void obj)
 Checks if the given object is undefined or null.
void isNumber (void obj)
 Checks if the given object is a valid number.
void isOfType (void obj, void type)
 Checks if the given object is of the given type.
void isPointEntity (void obj)
 Checks if the given object is a point entity.
void isPointShape (void obj)
 Checks if the given object is a point shape.
void isPolylineEntity (void obj)
 Checks if the given object is a polyline entity.
void isPolylineShape (void obj)
 Checks if the given object is a polyline shape.
void isQObject (void obj)
 Checks if the given object is a valid QObject.
void isQWidget (void obj)
 Checks if the given object is a valid QWidget.
void isRayEntity (void obj)
 Checks if the given object is a ray entity.
void isRayShape (void obj)
 Checks if the given object is a ray shape.
void isShape (void obj)
 Checks if the given object is a shape.
void isSolidEntity (void obj)
 Checks if the given object is a solid entity.
void isSplineEntity (void obj)
 Checks if the given object is a spline entity.
void isSplineShape (void obj)
 Checks if the given object is a spline shape.
void isString (void obj)
 Checks if the given object is a string.
void isTextBasedEntity (void obj)
 Checks if the given object is a text, attribute or attribute definition entity.
void isTextEntity (void obj)
 Checks if the given object is a text entity.
void isTraceEntity (void obj)
 Checks if the given object is a trace entity.
void isTriangleShape (void obj)
 Checks if the given object is a triangle shape.
void isValidVector (void obj)
 Checks if the given object is a valid vector.
void isVector (void obj)
 Checks if the given object is of type RVector.
void isViewportEntity (void obj)
 Checks if the given object is a viewport entity.
void isXLineEntity (void obj)
 Checks if the given object is an xline entity.
void isXLineShape (void obj)
 Checks if the given object is an xline shape.
void mergeProperties (void obj1, void obj2)
void modifyEntity (void op, void entity, void shape)
void numberToString (void num, void decimals)
 Formats the given number into a locale aware string.
void objectFromPath (void path)
 Gets an object from its object path.
void rad2deg (void val)
 Converts radiant to degrees.
void rayToLine (void ray)
void removeDirectory (void dirPath)
 Removes a directory recursively.
void requiresFramework (void minVersion, void maxVersion)
 Checks if the QCAD Application Framework is at least of version minVersion and not newer than maxVersion.
void restoreOverrideCursor ()
void roundDouble (void num, void dec)
void roundVector (void v, void dec)
void setInBlockEasyDragAndDrop (void entity, void v)
 Enable / disable easy drag and drop for the given entity.
void setInBlockTextEdit (void entity, void v)
 Enable / disable in block text editing for the given entity.
void setMainWindow (void w)
void setOverrideCursor (void cursor)
void shapeToEntity (void document, void shape)
 Creates and returns a new entity based on the given shape.
void sleep (void msec)
 Sleeps for the given milliseconds.
void stringToCoordinate (void relativeZero, void str)
 Parses the given string as coordinate.
void stringToDirectDistanceEntry (void relativeZero, void cursorPosition, void str)
 Parses the given string as direct distance entry.
void stripDirtyFlag (void title)
void trimEndPoint (void shape, void p)
void trimStartPoint (void shape, void p)
void xLineToRay (void xline)

Function Documentation

void activateFont ( void  fontComboBox,
void  fontName 
)
void addActionsToWidgets ( )
void addDirtyFlag ( void  title)
void coordinateToString ( void  coordinate,
void  decimals,
void  relative,
void  polar 
)

Formats the given coordinate (RVector) into a locale aware string.

void copyDirectory ( void  sourceDirPath,
void  destDirPath 
)

Copies a directory recursively.

Existing files are not overridden.

Parameters:
sourceDirPathThe source directory.
destDirPathThe destination directory.
Returns:
true, if the directory was deleted successfully
void deepCopy ( void  obj)

Clones the given object (deep copy).

void deg2rad ( void  val)

Converts degrees to radiant.

Parameters:
valthe value in degrees
Returns:
the value in radiant
void entityTypeToString ( void  type,
void  plural 
)

Converts the given entity type enum to a human readable, translated string.

Returns:
A translated string for the given entity type.
Parameters:
typeEntity type (RS::EntityType)
pluralTrue to return plural, false (default) to return singular.
void findFile ( void  dirPath,
void  fileName,
void  ignoreDirs 
)

Finds a file recursively.

Parameters:
dirPathThe directory to search.
fileNameFile name.
Returns:
Path of the file or undefined.
void fixSymbolTableName ( void  name)

Fixes the given symbol table name (e.g.

block or layer name).

Parameters:
nameSuggested name, for example coming from a file base name.
Returns:
Fixed name or undefined if the name cannot be fixed (i.e. contains invalid characters).
void getAbsolutePathForArg ( void  file)
void getClipboard ( )
void getCurrentDateTime ( void  format)
void getEntityTypeProperties ( void  type)
void getInBlockEasyDragAndDrop ( void  entity)
void getInBlockTextEdit ( void  entity)
void getMainWindow ( )
void getTypeOf ( void  v)

Check the real type of the given object.

Standard ECMAScript typeof returns "string" for a string literal but "object" for a string object constructed with new. Same goes for arrays, etc. This function provides a workaround.

void getVersionNumber ( void  major,
void  minor,
void  revision,
void  build 
)
void getWidgetPath ( void  widget)

Gets the widget path for the given widget.

The widgets in the path are separated with ::, e.g. MainWindow::LayerListDock::LayerWidget::btAdd

Parameters:
widgetthe widget
Returns:
the widget path
void getWidgets ( void  widget,
void  ca 
)

Gets all child widgets and stores them in an array.

All child widgets are retrieved (recursively).

Use of this function as shown in the example below (formWidget is the parent widget). var widgets = getWidgets(formWidget); widgets["FindText"].text = text;

Parameters:
widgetthe parent widget
cathe initial array which holds some child widgets for recursive calls
Returns:
Array of child widgets.
void hasPlugin ( void  name)
void initFontComboBox ( void  comboBox)

Insert CAD fonts at the top into the given font combo box.

void isArcEntity ( void  obj)

Checks if the given object is an arc entity.

Returns:
true if the given object is an arc entity (RArcEntity).
void isArcShape ( void  obj)

Checks if the given object is an arc shape.

Returns:
true if the given object is an arc shape (RArc).
void isArray ( void  obj)

Checks the type of the given object.

Returns:
true if the given object is an array.
void isAttributeDefinitionEntity ( void  obj)

Checks if the given object is an attribute definition entity.

Returns:
true if the given object is an attribute definition entity (RAttributeDefinitionEntity).
void isAttributeEntity ( void  obj)

Checks if the given object is an attribute entity.

Returns:
true if the given object is an attribute entity (RAttributeEntity).
void isBlockReferenceEntity ( void  obj)

Checks if the given object is a block reference entity.

Returns:
true if the given object is a block reference entity (RBlockReferenceEntity).
void isBoolean ( void  obj)

Checks if the given object is a valid boolean value.

Returns:
true if the given object is a boolean and not NULL or undefined.
void isCircleEntity ( void  obj)

Checks if the given object is a circle entity.

Returns:
true if the given object is a line entity (RCircleEntity).
void isCircleShape ( void  obj)

Checks if the given object is a circle shape.

Returns:
true if the given object is a circle shape (RCircle).
void isComboBox ( void  obj)

Checks the type of the given object.

Returns:
true if the given object is a combo box.
void isDimAlignedEntity ( void  obj)

Checks if the given object is an aligned dimension entity.

Returns:
true if the given object is an aligned dimension entity (RDimAlignedEntity).
void isDimAngularEntity ( void  obj)

Checks if the given object is an angular dimension entity.

Returns:
true if the given object is an angular dimension entity (RDimAngularEntity).
void isDimDiametricEntity ( void  obj)

Checks if the given object is a diametric dimension entity.

Returns:
true if the given object is a diametric dimension entity (RDimDiametricEntity).
void isDimensionEntity ( void  obj)

Checks if the given object is a dimension entity of any kind.

Returns:
true if the given object is a dimension entity (RDimensionEntity).
void isDimLinearEntity ( void  obj)

Checks if the given object is a linear dimension entity.

Returns:
true if the given object is a linear dimension entity (RDimLinearEntity).
void isDimOrdinateEntity ( void  obj)

Checks if the given object is an ordinate dimension entity.

Returns:
true if the given object is an ordinate dimension entity (RDimOrdinateEntity).
void isDimRadialEntity ( void  obj)

Checks if the given object is a radial dimension entity.

Returns:
true if the given object is a radial dimension entity (RDimRadialEntity).
void isDimRotatedEntity ( void  obj)

Checks if the given object is a rotated dimension entity.

Returns:
true if the given object is a rotated dimension entity (RDimRotatedEntity).
void isDirectedShape ( void  obj)

Checks if the given object is a directed shape.

Returns:
true if the given object is a directed shape (derived from RShape and RDirected).
void isEllipseArcShape ( void  obj)

Checks if the given object is an ellipse arc shape.

Returns:
true if the given object is an ellipse arc shape (REllipse).
void isEllipseEntity ( void  obj)

Checks if the given object is an ellipse entity.

Returns:
true if the given object is an ellipse entity (REllipseEntity).
void isEllipseShape ( void  obj)

Checks if the given object is an ellipse shape.

Returns:
true if the given object is an ellipse shape (REllipse).
void isEntity ( void  obj)

Checks if the given object is a graphics entity.

Returns:
true if the given object is an entity (derived from REntity).
void isEntityType ( void  obj,
void  type 
)

Checks if the given object is an entity of the given type.

void isFullEllipseEntity ( void  obj)

Checks if the given object is an ellipse entity and represents a full ellipse.

Returns:
true if the given object is an ellipse entity (REllipseEntity).
void isFullEllipseShape ( void  obj)

Checks if the given object is a full ellipse shape.

Returns:
true if the given object is a full ellipse shape (REllipse).
void isFunction ( void  obj)

Checks if the given object is a valid function.

Returns:
true if the given object is a function.
void isHatchEntity ( void  obj)

Checks if the given object is a hatch entity.

Returns:
true if the given object is an arc entity (RHatchEntity).
void isImageEntity ( void  obj)

Checks if the given object is an image entity.

Returns:
true if the given object is an image entity (RImageEntity).
void isLeaderEntity ( void  obj)

Checks if the given object is a leader entity.

Returns:
true if the given object is a leader entity (RLeaderEntity).
void isLineBasedEntity ( void  obj)

Checks if the given object is a line, xline or ray entity.

Returns:
true if the given object is a line based entity (RLineEntity, RXLineEntity, RRayEntity).
void isLineBasedShape ( void  obj)

Checks if the given object is a line based shape.

Returns:
true if the given object is a line based shape (RLine, RXline, RRay).
void isLineEntity ( void  obj)

Checks if the given object is a line entity.

Returns:
true if the given object is a line entity (RLineEntity).
void isLineShape ( void  obj)

Checks if the given object is a line shape.

Returns:
true if the given object is a line shape (RLine).
void isNull ( void  obj)

Checks if the given object is undefined or null.

Returns:
true if the given object is defined and not null. This method also supports shared pointers, i.e. obj.isNull()==true.
void isNumber ( void  obj)

Checks if the given object is a valid number.

Returns:
true if the given object is a number and not NaN or +/-Infinity or NULL or undefined.
void isOfType ( void  obj,
void  type 
)

Checks if the given object is of the given type.

E.g. isOfType(myObject, QLabel) returns true if myObject is a QLabel. Note that isOfType(myObject, QWidget) returns false even though QLabel is derived from QWidget.

void isPointEntity ( void  obj)

Checks if the given object is a point entity.

Returns:
true if the given object is a point entity (RPointEntity).
void isPointShape ( void  obj)

Checks if the given object is a point shape.

Returns:
true if the given object is a point shape (RPoint).
void isPolylineEntity ( void  obj)

Checks if the given object is a polyline entity.

Returns:
true if the given object is a spline entity (RPolylineEntity).
void isPolylineShape ( void  obj)

Checks if the given object is a polyline shape.

Returns:
true if the given object is a polyline shape (RPolyline).
void isQObject ( void  obj)

Checks if the given object is a valid QObject.

Returns:
true if the given object is a QObject.
void isQWidget ( void  obj)

Checks if the given object is a valid QWidget.

Returns:
true if the given object is a QWidget.
void isRayEntity ( void  obj)

Checks if the given object is a ray entity.

Returns:
true if the given object is a ray entity (RRayEntity).
void isRayShape ( void  obj)

Checks if the given object is a ray shape.

Returns:
true if the given object is a ray shape (RRay).
void isShape ( void  obj)

Checks if the given object is a shape.

Returns:
true if the given object is a shape (derived from RShape).
void isSolidEntity ( void  obj)

Checks if the given object is a solid entity.

Returns:
true if the given object is a solid entity (RSolidEntity).
void isSplineEntity ( void  obj)

Checks if the given object is a spline entity.

Returns:
true if the given object is a spline entity (RSplineEntity).
void isSplineShape ( void  obj)

Checks if the given object is a spline shape.

Returns:
true if the given object is a spline shape (RSpline).
void isString ( void  obj)

Checks if the given object is a string.

Returns:
true if the given object is a string
void isTextBasedEntity ( void  obj)

Checks if the given object is a text, attribute or attribute definition entity.

Returns:
true if the given object is a text based entity (RTextBasedEntity).
void isTextEntity ( void  obj)

Checks if the given object is a text entity.

Returns:
true if the given object is a text entity (RTextEntity).
void isTraceEntity ( void  obj)

Checks if the given object is a trace entity.

Returns:
true if the given object is a trace entity (RTraceEntity).
void isTriangleShape ( void  obj)

Checks if the given object is a triangle shape.

Returns:
true if the given object is a triangle shape (RTriangle).
void isValidVector ( void  obj)

Checks if the given object is a valid vector.

Returns:
true if the given object is a valid RVector object.
void isVector ( void  obj)

Checks if the given object is of type RVector.

Returns:
true if the given object is an RVector object.
void isViewportEntity ( void  obj)

Checks if the given object is a viewport entity.

Returns:
true if the given object is a viewport entity (RViewportEntity).
void isXLineEntity ( void  obj)

Checks if the given object is an xline entity.

Returns:
true if the given object is an xline entity (RXLineEntity).
void isXLineShape ( void  obj)

Checks if the given object is an xline shape.

Returns:
true if the given object is an xline shape (RXLine).
void mergeProperties ( void  obj1,
void  obj2 
)
void modifyEntity ( void  op,
void  entity,
void  shape 
)
void numberToString ( void  num,
void  decimals 
)

Formats the given number into a locale aware string.

void objectFromPath ( void  path)

Gets an object from its object path.

Object paths are separated by ::.

Parameters:
paththe object path
widgetthe widget [optional, used for the recursive call], obsolete
Returns:
Object or undefined
void rad2deg ( void  val)

Converts radiant to degrees.

Parameters:
valthe value in radiant
Returns:
the value in degrees
void rayToLine ( void  ray)
void removeDirectory ( void  dirPath)

Removes a directory recursively.

Parameters:
dirPathThe directory to remove.
Returns:
true, if no errors occurs
void requiresFramework ( void  minVersion,
void  maxVersion 
)

Checks if the QCAD Application Framework is at least of version minVersion and not newer than maxVersion.

Parameters:
minVersionarray in the format [major,minor,revision,build]
maxVersionarray in the format [major,minor,revision,build]
void restoreOverrideCursor ( )
void roundDouble ( void  num,
void  dec 
)
void roundVector ( void  v,
void  dec 
)
void setInBlockEasyDragAndDrop ( void  entity,
void  v 
)

Enable / disable easy drag and drop for the given entity.

Entities tagged for easy drag and drop can be moved by dragging them while a block reference is selected.

void setInBlockTextEdit ( void  entity,
void  v 
)

Enable / disable in block text editing for the given entity.

void setMainWindow ( void  w)
void setOverrideCursor ( void  cursor)
void shapeToEntity ( void  document,
void  shape 
)

Creates and returns a new entity based on the given shape.

void sleep ( void  msec)

Sleeps for the given milliseconds.

Parameters:
msecthe time to sleep
void stringToCoordinate ( void  relativeZero,
void  str 
)

Parses the given string as coordinate.

Parameters:
relativeZeroRVector position of relative zero point.
strString to parse (e.g. "34,15.6" or "@10,30" or "50<60", ...)
Returns:
undefined if the string is not a coordinate, an invalid RVector if str is an invalid coordinate or the RVector result.
void stringToDirectDistanceEntry ( void  relativeZero,
void  cursorPosition,
void  str 
)

Parses the given string as direct distance entry.

Author:
Robert S
Parameters:
relativeZeroRVector position of relative zero point.
cursorPositionRVector position of cursor.
strString to parse (e.g. "34" or "15.123", ...)
Returns:
Invalid RVector if str is an invalid dde or return the dde point.
void stripDirtyFlag ( void  title)
void trimEndPoint ( void  shape,
void  p 
)
void trimStartPoint ( void  shape,
void  p 
)
void xLineToRay ( void  xline)