S3D.graphics


The S3D.graphics namespace is where you can interact with the rendered model in the viewport.


S3D.graphics.highlightElement#

Description: Allows highlighting of model elements.

Operation Type: Synchronous

Params: S3D.graphics.highlightElement(elementType, elementId, null?, addToSelection?)

KeyTypeAccepts
elementTypestringnode, member, plate, etc.
elementIdinteger, integer[]An element ID or an array of IDs.
addToSelectionbooleantrue to add to the current selection.

Sample:

highlightElement.js
S3D.graphics.highlightElement('member', 12); // Highlight member 12
S3D.graphics.highlightElement('member', [2, 13]); // Highlight member 2 and 13 - this will unselect 12
S3D.graphics.highlightElement('member', 12, null, true); // Add 12 to the current selection

S3D.structure.getSelectedItems#

Description: Returns all selected items. This is a fast and useful way to identify selected member IDs and access the GUI to identify parts of the model.

Operation Type: Synchronous

Params: (No arguments)

Sample:

highlightElement.js
S3D.structure.getSelectedItems();
//returns an object of the highlighted items:
{
"nodes": [
1,
3,
5,
],
"members": [
2,
3,
4,
],
"plates": [],
"supports": [
1,
3
],
"distributedLoads": [
1,
2,
3,
],
"pointLoads": [],
"moments": [],
"area_loads": [],
"pressures": []
}

S3D.graphics.locator#

Description: Displays an animation to locate a model element.

Operation Type: Synchronous

Params: S3D.graphics.locator(elementType, elementId)

KeyTypeAccepts
elementTypestringnode, member, plate, etc.
elementIdintegerAn element ID.

Sample:

graphicLocator.js
S3D.graphics.locator('node', 6);

S3D.graphics.refreshAllCanvas#

Description: Offers a fast, lightweight redraw function. Useful for highlighting any non-model changes that need re-rendering.

Operation Type: Asynchronous

Params: S3D.graphics.refreshAllCanvas(callback?)

Sample:

refreshCanvas.js
function callback() {
// Do something when finished.
}
S3D.graphics.refreshAllCanvas(callback);

S3D.graphics.screenshot#

Description: Take a screenshot of the model.

Operation Type: Asynchronous

Params: S3D.graphics.screenshot(callback?)

Sample:

screenshot.js
function callback(screenshotData) {
// The screenshot data will be in base64 format.
// This string can be added to the src property of an HTML img element to display the image.
console.info(screenshotData);
}
S3D.graphics.screenshot(callback);

S3D.graphics.setCameraView#

important

This is for the modeling renderer. To get this functionality with the 3D renderer see S3D.renderer.setView

Description: Set the camera angle for the detailed render.

Operation Type: Synchronous

Params: S3D.graphics.setCameraView(view: string, no_redraw: boolean = false)

view: top, side, front, iso

Sample:

setCameraView.js
// Set the camera and redraw
S3D.graphics.setCameraView('top');
// Set the camera and don't redraw
S3D.graphics.setCameraView('top', true);