FVS 3D Component API

  • Last update:June 27, 2025
  • This document is applicable to users who have installed the FineVis Data Visualization plugin to learn plugin functions.

    Version

    Report Server VersionPlugin VersionFunctional Change
    11.0

    V1.0.0

    Added the lowest version requirement.

    11.0.16

    V1.18.1

    Added APIs related to 3D component roaming animation:

    getRoamAnimations, playRoamAnimations, and updateRoamAnimationAction.

    11.0.22

    V2.10.0

    Added a 3D component model animation API: getAnimationByName.

    V3.0.0

    Added 3D component view angle rotation control APIs: camera.playAutoRotation(), camera.pauseAutoRotation(), and camera.stopAutoRotation().

    V3.1.0

    Added APIs for getting/setting 3D scene view angle parameters information: camera.getState(), and camera.setState().

    V3.4.0

    Added an API for getting camera view angle parameters of the 3D component: getCameraPerspectiveByName.

    Click to view historical version updates.
    Report Server  Version
    Plugin VersionFunctional Change
    11.0.9V1.13.0Added the animateSceneTime API.
    11.0.9V.1.14.0

    Added a model retrieval API: getMeshByName.

    Added model controlling APIs: setVisible, setScaling, setRotation, setPosition, and focus.

    11.0.16V1.15.0

    Added camera control parameters (distance, center point, and array) to focus.
    Added an API for controlling model trajectory motion. 

    11.0.16V1.16.0

    Added the API refreshDate.

    11.0.16V1.16.1Added APIs subscribeMarkerData, and updateMarkerData

    getDataLayers

    API

    getDataLayers()

    To get all data layers of the 3D component.

    Parameter

    /

    /

    Returned Value

    DataLayer[]

    interface DataLayer {

      /**

      * To display the layer or not.

      */

     visible: boolean

     /**

      * To set the layer to be visible or hidden.

      */

     setVisible: (visible: boolean) => void;

    }

    Example

    You can get all data layers of a 3D component by using this API.

    duchamp.getWidgetByName("3D Component Name").getSeries();
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    getDataLayerByName

    API

    getDataLayerByName()

    To get a specific data layer of a 3D component.

    Parameter

    name: string

    Data layer name, string

    Returned Value


    DataLayer

    interface DataLayer {

      /**

       * To display the current layer or not.

       */

     visible: boolean

     /**

      * To set the layer to be visible or hidden.

      */

     setVisible: (visible: boolean) => void;

    }

    Example


    You can get the specific data layer of Layer 1 of a 3D component by using this API.

    duchamp.getWidgetByName("3D Component Name").getDataLayerByName("Layer 1");

    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    animateSceneTime

    API

    animateSceneTime(

    {

    from:number,(

    to:number,

    duration:number,

    })

    To set dynamic change of the scene time for custom model components.

    iconNote:

    This API is supported in FVS Custom Model Components only.

    Parameter

    from:number

    to:number

    duration:number

    from: the start time of the scene change, an integer starting from 0 and with no upper limit.

    to: the end time of the scene change, an integer which must be greater than the from value.

    duration: the time required for the scene change, measured in milliseconds (ms).

    Returned Value

    /

    /

    Example

    The custom model animation starts at 14:00 on day one, and ends at 14:00 on day two, with a duration of 3 seconds:

    duchamp.getWidgetByName("Custom Model 1_Page 1").animateSceneTime({
         from: 14, //To start at 14:00 by default.
         to: 38, //To end at 14:00 the next day.
         duration: 3000 //Change duration of 3 seconds.
    });

    You can enable cyclic variations based on the above scene:

    iconNote:

    Currently, no API can be used to pause the scene time change.

    setInterval(function(){
    duchamp.getWidgetByName("Custom Model 1_Page 1").animateSceneTime({
         from: 14,
         to: 38,
         duration: 3000
    });
    },2000)
    Application Example

    Scene Time of FVS Custom Model Component.

    Mobile Terminal

    This API is not supported on mobile terminals.

    getMeshByName

    API

    getWidgetByName(name)

    Get the custom model object of a 3D component.

    Parameter

    name: string

    object name of the model mesh

    Returned Value

    Object

    name: object name of the model mesh

    visible: visibility

    scaling: scaling ratio

    rotation: rotation angle

    position: position

    focus: focusing on model position

    Example

    Example: You can get the scaling ratio of a model object by using this API.

    duchamp.getWidgetByName("Component Name ").getMeshByName("Model Name").scaling


    Application Example/
    Mobile Terminal

    This API is not supported on mobile terminals.

    iconNote:

    The following APIs – setVisible, setScaling, setRotation, setPosition, and focus – must be used after the model object is obtained.

    setVisible

    VIPsetVisible(visible:boolean)

    To set the model object to be visible or not.

    iconNote:
    If a parent-level model object is hidden, setting a child-level model object to be visible will not take effect.

    Parameter

    visible: boolean

    Visible or not, which is a boolean value.

    ·  true: visible

    ·  false: invisible

    Returned Value

    voidvoid

    Example

    Example: You can set a model object of a 3D component to be invisible by using this API.

    duchamp.getWidgetByName("Component Name").getMeshByName("Model Name").setVisible(false);


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    setScaling

    API

    setScaling(NumberArray3)

    To set the scaling ratio of a model object.

    Parameter

    NumberArray3

    Scaling ratio value: [X, Y, Z]

    Returned Valuevoid
    void
    Example

    Example: You can set the scaling ratio of a component in a 3D component by using this API.

    duchamp.getWidgetByName("Component Name").getMeshByName("Model Name").setScaling([10,10,10]);


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    setRotation

    API

    setRotation(NumberArray3)

    To set the rotation angle of a model object.

    PArameter

    NumberArray3

    Rotation angle value: [X, Y, Z]

    Returned Value

    voidvoid

    Example

    Example: You can set the rotation angle of a model object in a 3D component by using this API.

    duchamp.getWidgetByName("Component Name").getMeshByName("Model Name").setRotation([10,10,10]);


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    setPosition

    API

    setPosition(NumberArray3)

    To set the position of a model object.

    Parameter

    NumberArray3

    Position value: [X, Y, Z]

    Returned Valuevoidvoid
    Example

    Example: You can set the position of a model object in a 3D component by using this API.

    duchamp.getWidgetByName("Component Name").getMeshByName("Model Name").setPosition([10,10,10]);


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    focus

    API

    focus(options)

    To set the fast focus option of a model object.

    You are allowed to set camera control parameters (distance, center point, and array) in V1.15.0 and later versions.

    Parameter

    options: {

    target: "top" | "bottom" | "left" |"right" | "front" | "back" | "center";

    targetpos: (value: NumberArray3) => NumberArray3;

    viewRay: (value: NumberArray3) => NumberArray3;

    distance: (value: number) => number;

    }

    1. target: the camera focus position on the model (including the centers of the model's six faces and the volume center), which is set to top by default.

    2. targetpos: to fine-tune the focus point coordinate based on the focus position.

    3. viewRay: to change the view sight.

    iconNote:
    The vertical angle of a camera must remain within the specified range.

    The default view direction is determined by target. For example:

      ·  When the target value is top, bottom, front, or center, the view direction is diagonal downward along the y-z plane at 45°: [0, -1, 1].

      ·  When the target value is left, the view direction is diagonal downward along the x-z plane at 45°, facing the left side: [1, -1, 0].

      ·  When the target value is right, the view direction is diagonal downward along the x-z plane at 45°, facing the right side: [0, -1, 1].

    4. distance: to change the distance between a camera and a model.

    iconNote:
    The zoom setting of a camera must adhere to the specified range.

    The default distance is determined by the size of the target face. If target is set to center, the distance depends on the overall size of the model object.

    Returned Valuevoid
    void
    Example

    Example 1:

    duchamp.getWidgetByName("Component Name").getMeshByName("Model Name").focus();

    Example 2:

    const widget = duchamp.getWidgetByName("Component Name");
    const mesh = widget.getMeshByName("Model Name");
    mesh.focus({
       target: "center",
       viewRay: () => [1, -1, 1],
       distance: (v) => v * 0.8
    });

    Application Example

    FVS Click Event for Switching the Custom 3D Viewing Angle

    Mobile Terminal

    This API is not supported on mobile terminals.

    refreshData

    API

    refreshData()

    To refresh 3D component data while keeping the entire component unchanged.

    iconNote:

    In V1.17.1 and earlier versions, only FVS Custom Model Components and FVS 3D City Scene Components are supported.

    Parameter

    {para:"para"}

    Parameter name: parameter value

    Returned Value

    /

    /

    Example

    Example one: You can click the data of the component Custom Model to pass parameters.

    duchamp.getWidgetByName("Custom Model").refreshData({a:"Parameter a"});
    iconNote:

    The following text shows the syntax for passing multiple parameters.

    duchamp.getWidgetByName("Component").refresh({a:"parameter a", b:"parameter b"});

    Example two: You can add a Page Loading End Event for the template to refresh the data of a 3D component periodically.

    duchamp.getWidgetByName("Component").refresh({a:"parameter a", b:"parameter b"});
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    subscribeMarkerData

    API

    subscribeMarkerData((data, observer))

    To subscribe to monitoring data updates in the data layer of a 3D component: When the data in the data layer is updated or new data is generated, the callback is executed.

    iconNote:

    1. This function should be used together with the refresh API.

    2. Only FVS Custom Model Components and FVS 3D City Scene Components are supported.

    Parameter

    subscribeMarkerData(observer: (data: { [key: string]: any }, observer: {unsubscribe: () => {}}) => void): void;

      ·   data is a dictionary type, and its content depends on the configuration of the data layer. 

      ·  key is a selected field name in a dataset, and value is the corresponding value of the selected field.

      ·  unsubscribe is a function used to cancel the subscription to monitoring.

    Returned Value

    /

    /

    Example

    Example: You can control the visibility of the model based on the fields in the database table.

    async function perform() {
      // To obtain widget, dataLayer until the scene has finished loading.
      const widget = await future(() => duchamp.getWidgetByName("Parking Lot Model"));
      const dataLayer = await future(() => widget.getDataLayerByName("Vehicle Monitoring"));  // To hide the specified model based on the marker data in the data layer.
      const processMarkerData = data => {
        const visible = data["Any Car Present"] === "1";
        cons name= data["Vehicle ID"];
        const mesh = widget.getMeshByName(name);
        mesh.setVisible(visible);
      };
      
      // To subscribe to monitoring updates to the Marker data in the data layer. When Marker is updated, execute the subscription monitoring function.
      const observer = dataLayer.subscribeMarkerData(data => {    processMarkerData(data);
      });
      
      //  Refresh component data every 3 second.
      const refreshTimerId = setInterval(() => {    widget.refreshData();
      }, 3000); // Execute the loop. 
    }
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    updateMarkerData

    API

    updateMarkerData((data))

    To update the data of a specified model object in the 3D component data layer.

    Parameter

    updateMarkerData(predicate: (data) => boolean, updater: (data) => void);

      ·  predicator is the query function used to determine whether a data item needs to be updated. If the return value is true, an update is required.

      ·  updator is the update function used to update data verified by predicator with the returned value true.

    Returned Value

    /

    /

    Example

    Example: You can update multiple label values of the specified model object in the Vehicle Monitoring data layer of the Parking Lot Model by using this API.

    const widget = duchamp.getWidgetByName("Parking Lot Model");
    const dataLayer = widget.getDataLayerByName("Vehicle Monitoring");
      // To refresh data by using updatedMarkerData.
      dataLayer.updateMarkerData((markerData) => {
        return markerData["Vehicle ID"] === "Vehicle 006";
      }, (markerData) => {
        markerData["Vehicle Parking Time"] = 12;
    });
    Application Example

    You can use a text box widget to input the corresponding vehicle ID and parking duration. The model data will be updated accordingly after the editing. (The parking lot model triggers a red alert when parking duration exceeds 10 hours.) The following figure shows the effect.

    For details, you can download the template Updating Specific Model Data by JS.fvs

    Gif1.gif

    Mobile Terminal

    This API is not supported on mobile terminals.

    getRoamAnimations

    API

    getRoamAnimations()

    To get all roaming path information (the roaming path name by now) of a 3D component.

    Parameter

    /

    /

    Returned Value

    RoamAnimationsData[]

    interface RoamAnimationsData{
      /**
       * Roaming Path Name
       */
     name:string
    }

    Example

    Example: You can get the roaming path information of a Custom Model component by using this API.

    duchamp.getWidgetByName("Custom Model").getRoamAnimations();
    Application Example

    /

    Application Example

    This API is not supported on mobile terminals.

    playRoamAnimations

    API

    playRoamAnimations()

    To play the roaming animation.

    Parameter

    RoamAnimationOptions

    type RoamAnimationOptions = {
      /**
       * Roaming Path Name
       */
      names: string[];
      /**
       * Play mode: loop|once
       */
      playMode: "loop"|"once";
    };

    Returned Value

    /

    /
    Example

    Example one: You can add a click event to the title component to play the Roaming Path one animation of the Custom Model component by using this API.

    duchamp.getWidgetByName("Custom Model").playRoamAnimations({
       names:["Roaming Path 1"], 
       playMode: "once"
    })

    Example two: You can write code in the Add Page End Event to automatically play the roaming animation after the page has finished loading.

    setTimeout(()
    => {  
    duchamp.getWidgetByName("Warehouse Park").playRoamAnimations({
       names:["Roaming Path 1"],
       playMode: "once"
       })
       }, 5000)
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    updateRoamAnimationAction

    API

    updateRoamAnimationAction()

    To pause/continue/exit the roaming animation.

    Parameter

    "pause"|"continue"|"exit"


    "pause": to pause the roaming animation.

    "continue": to continue the roaming animation.

    "exit": to exit the roaming animation.

    Returned Value

    /

    /

    Example

    Example one: You can pause the roaming animation of the Custom Model component.

    duchamp.getWidgetByName("Custom Model").updateRoamAnimationAction("pause");

    Example two: You can continue the roaming animation of the Custom Model component.

    duchamp.getWidgetByName("Customer Model").updateRoamAnimationAction("continue");

    Example three: You can exit roam animation of the Custom Model component.

    duchamp.getWidgetByName("Custom Model").updateRoamAnimationAction("exit");
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    getAnimationByName

    API

    getAnimationByName("animationName")

    To get the animation objects of a 3D component.

    Parameter

    animationName

    Name of the animation

    The name corresponds to the animations[index].name obtained by getMeshByName.

    iconNote:
    The name refers to the specific animation name, rather than the name of the model itself, as shown in the following figure. 

    1.贴片机.png

    Returned Value

    /

    /

    Example

    You can obtain the 1. Explosion animation of the SMT Pick-and-Place Machine Explosion Reset model in 3D Custom Scene 1_Page 1.by using this API.

    const animation = duchamp.getWidgetByName(3D Custom Scene 1 - Page 1).getMeshByName(SMT Pick-and-Place Machine Explosion Reset).getAnimationByName(1. Explosion)

    You can start playing 1. Explosion animation by using this API.

    animation.play({
      // Whether to restart playing.
    isRestart:false,
    // Whether to execute the loop.
      isLoop:false,  
      // Whether to restore to the start status after finishing playing.
     isInitialOnPlaystop: false,
     // Playback end callback function
     onAnimationPlayStop:()=>{}
    })

    You can stop playing 1. Explode animation by using this API.

    animation.pause()

    You can end playing 1. Explode animation by using this API.

    //true: Stop the animation and restore the state before playback.
    //false: Stop the animation and remain at the current frame
    animation.stop(true)
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    camera.playAutoRotation()

    API

    camera.playAutoRotation(speed)

    To start/continue the camera view rotation of a 3D component.

    iconNote:
    You are advised to use this API after disabling the component hover, otherwise the view rotation may be affected by the hover interaction.
    Parameter

    speed

    Rotation speed

    Returned Value

    /

    /

    Example

    Example: You can start/continue the view rotation of 3D Custom Scene 1_Page 1, with a rotation speed of 15 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").camera.playAutoRotation(15)
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    camera.pauseAutoRotation()

    API

    camera.pauseAutoRotation()

    To pause the view rotation of a 3D component.

    iconNote:

    You are advised to use this API after disabling the component hover, otherwise the view rotation may be affected by the hover interaction.

    Parameter

    /

    /

    Returned Value

    /

    /

    Example

    Example: You can pause the view rotation of 3D Custom Scene 1_Page 1 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").camera.pauseAutoRotation()
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    camera.stopAutoRotation()

    API

    camera.stopAutoRotation(isInitial)

    To pause the view rotation of a 3D component.

    iconNote:

    You are advised to use this API after disabling the component hover, otherwise the view rotation may be affected by the hover interaction.

    Parameter

    isInitial: boolean

    To reset to initial view or not, which is a boolean value.

    ·  true: to reset the view to the initial view.

    ·  false: not to reset the view to the initial view.

    Returned Value

    /

    /

    Example

    Example: You can pause the view rotation of 3D Custom Scene 1_Page 1 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").camera.stopAutoRotation(true)
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    camera.getState

    API

    camera.getState()

    To get the view angle parameter information of a 3D Scene.

    Parameter

    /

    /

    Returned Value

    position: number

    target: number

    position: camera coordinate

    target: viewpoint coordinate

    Example

    Example: You can get the view point parameter information of 3D Custom Scene 1_Page 1 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").camera.getState()
    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    camera.setState

    API

    camera.setState(

    {

    position:number,

    target:number,

    duration:number,

    })

    To set the view point parameter information of a 3D scene.

    Parameter

    position:number

    target:number

    duration:number

    position: camera coordinate

    target: viewpoint coordinate

    duration: Animation transition time, optional, with a default value of 2000 (milliseconds).

    Returned Value/
    /
    Example

    Example: You can set the viewpoint parameter information of 3D Custom Scene 1_Page 1 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").camera.setState({ position: [20, 20, 10], target: [0, 0, 0]}, 2000)


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.

    getCameraPerspectiveByName

    API

    getCameraPerspectiveByName(name)

    To get the corresponding view point parameter information by camera view name.

    Parameter

    name: string

    Viewing angle name

    Returned Value

    position: NumberArray3

    target: NumberArray3

    position: camera coordinate

    target: viewpoint coordinate

    Example

    Example: You can get the view point parameter information of View Point one of component 3D Custom Scene 1_Page 1 by using this API.

    duchamp.getWidgetByName("3D Custom Scene 1_Page 1").getCameraPerspectiveByName("View Point 1")


    Application Example

    /

    Mobile Terminal

    This API is not supported on mobile terminals.


    Attachment List


    Theme: Secondary Development
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy